Commit graph

452 commits

Author SHA1 Message Date
Daniel Eklöf
67b4b9401d
render: always damage two cells when rendering the cursor
Hack to render cursor-at-double-width-characters correctly. Should be
replaced with something better.
2019-07-31 21:16:37 +02:00
Daniel Eklöf
4a01be5522
render: draw cell decorations (cursor, underline etc) correctly for double-width characters 2019-07-31 21:15:40 +02:00
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
748a1f229c
vt: disable flash on bell, it's too annoying in e.g. zsh 2019-07-30 22:11:32 +02:00
Daniel Eklöf
e1f7fc459b
vt: BELL is now logged at info level, and flashes the screen 2019-07-30 22:09:07 +02:00
Daniel Eklöf
0d1ba1ffb2
osc: reduce flash interval to 50ms 2019-07-30 22:08:58 +02:00
Daniel Eklöf
e3dc184882
term: break out 'flash' to a separate 'term' function 2019-07-30 22:06:02 +02:00
Daniel Eklöf
89f1b3ae73
footrc: add 'workers' 2019-07-30 22:03:13 +02:00
Daniel Eklöf
db6939fdc5
config: remove commented out code 2019-07-30 22:03:07 +02:00
Daniel Eklöf
10536aad3f
render: make resize log messages debug messages 2019-07-30 22:01:49 +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
b82dc02505
selection: add a couple of word-breaking characters
When "auto-selecting" a word, we used to only break on space
characters. Now we break on a number of other characters as
well.
2019-07-30 21:57:48 +02:00
Daniel Eklöf
c03aeb1b4f
log: syslog: tag unused function arguments as unused 2019-07-30 21:50:08 +02:00
Daniel Eklöf
c9138c6d7d
log: log to syslog too 2019-07-30 21:48:14 +02:00
Daniel Eklöf
6c2fe303c1
main: font metrics should be debug logged 2019-07-30 21:47:59 +02:00
Daniel Eklöf
8acc3b891d
vt: remove almost all abort() calls
Replace with generic error log messages that simply says the
ESC/CSI/OSC sequence is unhandled. This can mean either invalid or
unimplemented, depending on the context.
2019-07-30 21:42:46 +02:00
Daniel Eklöf
84f868f88d
render: don't pass a struct buffer when all we need is a cairo_t 2019-07-30 20:43:37 +02:00
Daniel Eklöf
d8ab96b8d9
render: don't call wl_surface_set_buffer_scale()
Since we don't support scaling, don't call
wl_surface_set_buffer_scale(). This way, at least will get auto-scaled
by the compositor.
2019-07-30 20:33:17 +02:00
Daniel Eklöf
2c3f2269fc
render: remove #if 0 code 2019-07-30 20:31:59 +02:00
Daniel Eklöf
51c1fc344a
vt: remove duplicate initialization warnings (clang) 2019-07-30 20:30:05 +02:00
Daniel Eklöf
f630633a81
render: fix 'suggest braces around initialization...' warning (clang) 2019-07-30 20:28:21 +02:00
Daniel Eklöf
263d3bb2ba
input: fix 'comparison ... is always true' warning (clang) 2019-07-30 20:27:19 +02:00
Daniel Eklöf
20af289759
render: only explicitly re-render old cursor cell if it isn't dirty
If it is dirty, it will be rendered in the normal rendering
process.
2019-07-30 20:18:58 +02:00
Daniel Eklöf
3b36fb9d74
render: last_cursor.cell must not be const 2019-07-30 20:18:20 +02:00
Daniel Eklöf
efdb69f2d8
render: remove all traces of glyph-sequence
This was used to optimize the call(s) to cairo_show_glyphs(), which we
aren't using anymore.
2019-07-30 19:33:56 +02:00
Daniel Eklöf
f5e9b7b048
input: use keyboard enter serial only for selection serial 2019-07-30 19:29:04 +02:00
Daniel Eklöf
f39d848368
Merge branch 'multithreaded-renderer' 2019-07-30 18:08:27 +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
d1b88f67e4
Merge branch 'use-freetype-to-render-glyphs' 2019-07-29 20:12:33 +02:00
Daniel Eklöf
4302d3eb68
font: set FT load and render flags from FontConfig properties 2019-07-29 20:10:55 +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
9e57ba2108
font: add font_glyph_for_utf8()
This function fills in a struct glyph with glyph bitmap data for the
provided utf-8 character (essentially a FT_Bitmap wrapped in a cairo
surface).
2019-07-28 20:37:59 +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
27dca15caf
render: use FreeType face from font, instead of from cairo's scaled font 2019-07-28 12:11:44 +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
90d357befb
render: poc: use freetype to render glyphs
Initial POC that uses freetype to render the glyphs. The bitmap
produced by freetype contains the alpha value.

We use this bitmap in a mask surface and then draw the final glyph
with cairo by applying the source rgb using the OVER operator and the
freetype generated alpha mask as surface mask.

Note that we only support grayscale antialiasing (and no
antialiasing).

We are probably not setting the antialias options correctly either.
2019-07-26 18:54:14 +02:00
Daniel Eklöf
709c29c7c4
render: reset "last cursor" when resizing
The cell pointer is likely invalid since we realloc the
grids. Besides. we're redrawing the entire window anyway.
2019-07-26 18:51:47 +02:00
Daniel Eklöf
269e04fa1b
render: flush glyph sequence after erase previous cursor
If not, we may have scrolled when we later flush the glyph sequence,
causing the glyph to be rendered in wrong location.
2019-07-26 18:50:41 +02:00
Daniel Eklöf
3e06dca12d
input: generate escape sequences for "other" keys
This corresponds to xterm's modifyOtherKeys option, though the code
needs more testing and cleanup.
2019-07-26 18:49:09 +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
bb3e33948f
render: add render_row() 2019-07-24 20:31:21 +02:00
Daniel Eklöf
a712ca40e1
render: minor 2019-07-24 20:26:32 +02:00
Daniel Eklöf
d7dd14ea6a
footrc: add cursor color 2019-07-24 20:23:26 +02:00
Daniel Eklöf
f93384b9c9
render: move local static variables into the terminal struct 2019-07-24 20:21:41 +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