Commit graph

135 commits

Author SHA1 Message Date
Daniel Eklöf
858a0d9906
font: initial support for double-width *and* color emoji glyphs
Fonts are now loaded with FT_LOAD_COLOR and we recognize and support
the FT_PIXEL_MODE_BGRA pixel mode.

This is mapped to a CAIRO_FORMAT_ARGB32 surface, that is blitted
as-is (instead of used as a mask like we do for gray and mono glyphs).

Furthermore, since many emojis are double-width, we add initial
support for double-width glyphs.

These are assumed to always be utf8. When PRINT:ing an utf8 character,
we check its width, and add empty "spacer" cells after the cell with
the multi-column glyph.

When rendering, we render the columns in each row backwards. This
ensures the spacer cells get cleared *before* we render the glyph (so
that we don't end up erasing part of the glyph).

Finally, emoji fonts are usually bitmap fonts with *large*
glyphs. These aren't automatically scaled down. I.e. even if we
request a glyph of 13 pixels, we might end up getting a 100px glyph.

To handle this, fontconfig must be configured to scale bitmap
fonts. When it is, we can look at the 'scalable' and 'pixelsizefixup'
properties, and use these to scale the rendered glyph.
2019-07-31 18:03:35 +02:00
Daniel Eklöf
caaf84dfd3
main: don't shadow final return value inside poll loop 2019-07-30 22:01:16 +02:00
Daniel Eklöf
6c2fe303c1
main: font metrics should be debug logged 2019-07-30 21:47:59 +02:00
Daniel Eklöf
7d702756ad
main: pty buffers appear to be ~20KB on modern linux kernels 2019-07-30 18:07:44 +02:00
Daniel Eklöf
73b4d5d05a
font: add support for fallback fonts
A top-level font now has a list of fallback fonts. When a glyph cannot
be found, we try each fallback font in turn, until we either find one
that has the glyph, or until we've exhausted the list.

To make this actually work in practise (read: to make performance
acceptable), the cache is re-worked and is now populated on demand.

It also supports non-ASCII characters, by using the 4-byte unicode
character as index instead.

Since having an array that can be indexed by a 4-byte value isn't
really viable, we now have a simple hash table instead of an array.
2019-07-30 18:04:28 +02:00
Daniel Eklöf
85ef9df586
render: add a 'clean' bit to each cell; only render cells that aren't clean
This patch takes a bit from the foreground color value in a
cell (todo: split up foreground/background into bitfields with a
separate field for 'foreground/background' has been set), and only
re-renders cells that aren't marked as clean.

Note: we use a 'clean' bit rather than a 'dirty' bit to make it easy
to erase cells - we can (keep doing) do that by simply memsetting a
cell range to 0.
2019-07-30 18:03:03 +02:00
Daniel Eklöf
c531795b83
wip: initial multithreaded renderer 2019-07-29 20:13:26 +02:00
Daniel Eklöf
fe882bddba
font: populate glyph cache (ASCII characters only) when instantiating font 2019-07-28 21:03:38 +02:00
Daniel Eklöf
175dc9cf94
cairo-ft: remove all usages of cairo-ft 2019-07-28 12:45:01 +02:00
Daniel Eklöf
c399c329b6
main: calculate *all* font metrics from the FreeType face 2019-07-28 12:39:56 +02:00
Daniel Eklöf
cb02c9cf41
font: load FreeType face, and set it's pixel sizes 2019-07-28 12:09:22 +02:00
Daniel Eklöf
e88cf4c8c8
mouse: use discrete axis event if available
This improves the scroll experience with certain devices
2019-07-26 18:48:59 +02:00
Daniel Eklöf
4838763d18
render: move frame_callback to term.render 2019-07-24 20:11:49 +02:00
Daniel Eklöf
ebf0a11fa0
render: add render_refresh() 2019-07-24 20:11:41 +02:00
Daniel Eklöf
bf4847d3e0
conf: allow the user to configure a fixed cursor color
The default is to reverse the foreground/background colors in the cell
with the cursor.

But, if the user configures a specific set of cursor colors, those
will always be used, regardless of other cell attributes (dim, reverse
etc).

The cursor color is specified as two color values, 'text' and
'cursor'.

The block cursor uses the 'cursor' color as background, and the 'text'
color for the glyph.

All other cursor styles uses the 'cursor' color for the cursor, but
uses the cell's foreground color for the glyph (meaning,
dim/reverse/etc applies).
2019-07-23 18:54:58 +02:00
Daniel Eklöf
49034bb759
csi: let CSI 0 q mean "switch to user configured cursor style"
According to the specs, \E[0 q means a blinking block cursor. However,
since it also states that \E[1 q *also* is a blinking block cursor,
and that it is the default, *and* given that fact that parameter-less
CSIs typically means "reset", let's make it mean "reset to the user
configured cursor style".
2019-07-22 20:19:27 +02:00
Daniel Eklöf
3ccdef3498
conf: make cursor's default style configurable 2019-07-22 20:15:14 +02:00
Daniel Eklöf
428b31f071
term: group 'blink' state together in a struct 2019-07-22 19:17:57 +02:00
Daniel Eklöf
196f9d67c2
term: group 'flash' state together in a struct 2019-07-22 19:15:56 +02:00
Daniel Eklöf
c1381fbb54
main: no need to damage the _entire_ view on blink timer 2019-07-21 20:15:18 +02:00
Daniel Eklöf
e21ab8cf33
blink: implement 'blink' 2019-07-21 20:11:20 +02:00
Daniel Eklöf
0dd8951cb3
flash: implement 'flash'
Use our own escape sequence for the 'flash' terminfo entry.

Implemented by arming a timer FD and setting a boolean that indicates
we're currently "flashing".

The renderer draws a semi-transparent yellowish layer over the entire
window when "flashing" is active.
2019-07-21 19:14:19 +02:00
Daniel Eklöf
2096753b52
dcs: we have no parent terminal to pass through to 2019-07-21 18:22:26 +02:00
Daniel Eklöf
64135ae365
csi: implement CSI 22t and CSI 23t
22;0|1|2t pushes the current window title/icon to the stack, while 23
pops it.

The second parameter, 0|1|2 has the following meaning:

0 - push/pop icon+title
1 - push/pop icon
2 - push/pop title
2019-07-21 17:48:06 +02:00
Daniel Eklöf
97350f6488
term: track current window title in terminal struct 2019-07-21 17:35:53 +02:00
Daniel Eklöf
4109d97263
conf: config now provides the colors (though still only hardcoded colors) 2019-07-21 11:06:28 +02:00
Daniel Eklöf
29d855d7c6
term: prepare for configurable colors; add color variables to terminal 2019-07-21 10:58:09 +02:00
Daniel Eklöf
b953326768
dcs: sort of implement DCS passthrough
We now store the passthrough characters in a buffer, and call
dcs_passthrough() on unhook.

However, dcs_passthrough() doesn't do anything.
2019-07-19 09:55:07 +02:00
Daniel Eklöf
153628a217
osc: allocate data buffer dynamically 2019-07-19 08:59:35 +02:00
Daniel Eklöf
7d7af62d84
main: allow TERM to be set on the command line 2019-07-18 14:34:45 +02:00
Daniel Eklöf
7e36027237
conf: TERM can now be set in footrc 2019-07-18 14:29:40 +02:00
Daniel Eklöf
67583540b4
main: use our own terminfo 'foot' by default 2019-07-18 14:14:05 +02:00
Daniel Eklöf
6e69cf9562
glyph-cache: generate at startup, never update while rendering 2019-07-18 13:03:21 +02:00
Daniel Eklöf
6e55be1557
render: cache generated glyphs for regular ASCII characters
To avoid having to re-generate glyphs, cache the glyphs.

For now, we only cache ASCII characters, as this allows us to lookup
the cache by simply indexing with the character (into a 256-entry
array).
2019-07-18 10:33:58 +02:00
Daniel Eklöf
de575ac58e
conf: improve configuration file parsing
* Strip whitespaces from keys and values
* Detect (and ignore) comments
* Detect syntax errors (no value specified etc)
* Error out on syntax errors and invalid keys
2019-07-17 10:12:14 +02:00
Daniel Eklöf
c11cc2be57
main: allow user to override shell on the command line 2019-07-17 09:55:36 +02:00
Daniel Eklöf
aa87be43ba
slave: report exec() failure back to main process 2019-07-17 09:39:12 +02:00
Daniel Eklöf
519f721577
main: jump to cleanup on failure to load cursor pointer theme 2019-07-17 09:38:54 +02:00
Daniel Eklöf
153894eb73
slave: exec shell from conf 2019-07-17 09:30:39 +02:00
Daniel Eklöf
9ded4b3de2
main: fallback for strikeout positioning seems to work 2019-07-16 16:07:55 +02:00
Daniel Eklöf
06f9495ae2
render: implement strikeout 2019-07-16 15:08:02 +02:00
Daniel Eklöf
d93ca2f654
render: implement 'underline' 2019-07-16 14:20:39 +02:00
Daniel Eklöf
ccc8ef9606
terminal: foreground/background in cell attributes are now uint32_t
This reduces the cell size, and thus improves the cache behavour
2019-07-16 13:17:51 +02:00
Daniel Eklöf
0d1b4449b9
conf: initial support for configuration file
* Look for configuration file in (in this order):
  - XDG_CONFIG_HOME/footrc
  - ~/.config/footrc
* Currently supports setting the font
2019-07-16 11:52:22 +02:00
Daniel Eklöf
22115e1cf4
main: default font is 'monospace' 2019-07-16 11:03:48 +02:00
Daniel Eklöf
5597856762
main: set TERM=xterm-direct 2019-07-15 12:36:00 +02:00
Daniel Eklöf
6077b57ca5
rename project to 'foot' 2019-07-11 20:10:59 +02:00
Daniel Eklöf
703aeecb95
selection: add support for pasting *from* primary 2019-07-11 17:38:03 +02:00
Daniel Eklöf
b50ec1a850
selection: initial copy-to-clipboard functionality 2019-07-11 17:38:02 +02:00
Daniel Eklöf
632790d5d8
selection: selections can be made, and are rendered
* Start selection on mouse button down
* Update selection on motion
* Button release cancels selection if there were no motion after start
* Renderer detects cells inside the selection and inverts their colors
2019-07-11 17:38:01 +02:00