Commit graph

2053 commits

Author SHA1 Message Date
Daniel Eklöf
a24a3520c7
script: generate-unicode-precompose: generate a complete header file 2020-05-02 18:25:15 +02:00
Daniel Eklöf
5a5b8140c4
readme: utf8proc is no longer a dependency 2020-05-02 17:36:22 +02:00
Daniel Eklöf
83e6b6df5d
changelog: try to fix link for Codebergs markdown parser 2020-05-02 17:35:04 +02:00
Daniel Eklöf
2df7b3c611
changelog: remove bad ']' in link 2020-05-02 17:34:19 +02:00
Daniel Eklöf
d945b68b73
unicode-combine: remove utf8proc dependency
We only used utf8proc to try to pre-compose a glyph from a base and
combining character.

We can do this ourselves by using a pre-compiled table of valid
pre-compositions. This table isn't _that_ big, and binary searching it
is fast.

That is, for a very small amount of code, and not too much extra RO
data, we can get rid of the utf8proc dependency.
2020-05-02 17:29:00 +02:00
Daniel Eklöf
8389c76549
unicode-combining: don't limit ourselves to the (western) diacritics blocks 2020-05-02 16:11:51 +02:00
Daniel Eklöf
3b29aa95c9
render: de-indent #if statement 2020-05-01 21:51:40 +02:00
Daniel Eklöf
4ae0e7c922
unicode-combining: pack struct 2020-05-01 21:47:38 +02:00
Daniel Eklöf
0c7a94dfdc
unicode-combine: leave a note saying we might need more than 2 combining chars 2020-05-01 20:19:46 +02:00
Daniel Eklöf
50543983ad
unicode-combine: only compose if we don't have any other combining characters
If the client sent the sequence SAB, where SA does NOT have a composed
representation, but SB does, the old code would compose SB and throw
away A.

This patch fixes this by only allowing a compose if there aren't
any pre-existing combining characters.
2020-05-01 20:17:37 +02:00
Daniel Eklöf
a6cd151cc7
meson: emit a 'summary()' at the end 2020-05-01 12:32:10 +02:00
Daniel Eklöf
99172e7f8e
Merge branch 'unicode-combining-for-real' 2020-05-01 12:06:09 +02:00
Daniel Eklöf
3474624c2c
unicode-combining: completely remove unicode combining characters when feature is disabled 2020-05-01 12:05:38 +02:00
Daniel Eklöf
66e5abdda3
term: combining characters: reduce max number of combining characters 2020-05-01 12:00:36 +02:00
Daniel Eklöf
9f3d07ff21
changelog: rewrite entry for combining characters 2020-05-01 12:00:01 +02:00
Daniel Eklöf
623329cf23
selection: extract text: also copy combining characters 2020-05-01 11:59:09 +02:00
Daniel Eklöf
76567e9ef0
render: render combining characters
This is basically just a loop that renders additional glyphs on top
off the base glyph.

Since we now need access to the row struct, for the combining
characters, the function prototype for 'render_cell()' has changed.

When rendering the combining characters we also need to deal with
broken fonts; some fonts use positive offsets (as if the combining
character was a regular character), while others use a negative
offset (to be used as if you had already advanced the pen position).

We handle both - a positive offset is rendered just like a regular
glyph. When we see a negative offset we simply add the width of a cell
first.
2020-05-01 11:56:13 +02:00
Daniel Eklöf
40bf01a8e6
grid: reflow: copy combining characters 2020-05-01 11:55:22 +02:00
Daniel Eklöf
cb5f80ec6a
vt: utf8: track combining characters that we failed to compose
When we detect a combining character, we first try to compose it with
the base character (like before).

When this fails, we instead add the combining character to the base
cell's combining characters array.

The reason for using a composed character when possible is twofold:
one, the rendered glyph will look better since it will be a single
glyph instead of two separate glyphs (possibly from different
fonts(!)). And two, for performance. A composed glyph is a single
glyph to render, while a decomposed glyph sequence means the renderer
has to render multiple glyphs for a single cell.
2020-05-01 11:52:40 +02:00
Daniel Eklöf
67614df9f9
term: print: reset combining characters for this cell
This is the *only* place combining characters are reset. In
particular, we do *not* reset them in a normal cell erase.

This is a performance design decision - clearing the combining
characters in erase is way too slow.

This way, we clear it only when we *have* to. Anything looking at the
combining characters must first ensure the base character is not 0.
2020-05-01 11:50:38 +02:00
Daniel Eklöf
b2c4115f3e
grid: add per-cell combining characters
The data is *not* added to the cell struct, since that one is too
performance critical.

Instead, the data is added as a separate array in the row struct.

This allows our performance critical code paths that e.g. clear cells
to perform as before.
2020-05-01 11:49:11 +02:00
Daniel Eklöf
69c3e74498
util.h: new header file defining commonly used macros 2020-05-01 11:46:24 +02:00
Daniel Eklöf
fc2e385d87
term: don't enable ptmx FDM callback until Wayland window has been configured
The way things works right now, we cannot enable the ptmx FDM callback
right away. We need to wait for the Wayland window to have been
configured.

Before the window is configured, we don't have a size, and no
grid. Thus, if we try to process ptmx data we'll crash since we have
no where to write it to.

So, registering the ptmx fd with the FDM is now delayed until we've
received the first 'configure' event from Wayland.
2020-04-30 17:22:57 +02:00
Daniel Eklöf
ae5af7bb06
term: start slave before loading fonts and starting rendering threads
This allows the client to load in parallel with our font loading,
which should improve startup time.
2020-04-30 11:39:41 +02:00
Daniel Eklöf
242bcb9550
main: only set LC_CTYPE
This is the only locale variable we need. This ensures LC_NUMERIC in
particular remains as "C", which is needed by fcft when instantiating
new fonts.
2020-04-29 20:09:41 +02:00
Daniel Eklöf
589e984b91
term: font size adjust: re-load fonts in parallel 2020-04-29 20:09:21 +02:00
Daniel Eklöf
1d67f37045
term: destroy: handle rendering threads not being initialized
We sort of already did this. However, we did not handle the case where
the thread array itself hadn't yet been allocated.
2020-04-29 20:08:19 +02:00
Daniel Eklöf
84e945a851
term: initialize rendering worker threads after instantiating fonts
This ensures the resources (e.g. stack) used by the transient threads
used to load the primary fonts can be re-used by the rendering worker
threads.
2020-04-29 20:07:21 +02:00
Daniel Eklöf
74d30dc410
csd: buttons: use default color table as default colors
If the user hasn't configured any CSD button colors, use the color
scheme's default colors for blue/green/red.
2020-04-29 20:06:16 +02:00
Daniel Eklöf
02d4a093bb
changelog: change -> changes 2020-04-28 22:11:12 +02:00
Daniel Eklöf
3adcbf7d4d
term: load primary fonts in parallel
Use four threads to load the four primary font variants - normal,
bold, italic and bold italic.

This speeds up initial startup, and reloading of fonts on a DPI
change.
2020-04-28 22:07:02 +02:00
Daniel Eklöf
2fd5a9ee8d
wayland: monitor unplug: call surface_leave() to handle terminal unmapping 2020-04-28 19:05:10 +02:00
Daniel Eklöf
9cfe720000
wayland: handle outputs disappearing
That is, deal with monitors being unplugged.

At least on Sway 1.4, surfaces are not unmapped before the output is
removed. Thus, in addition to free:ing the monitor resources, we also
need to update all terminals that are mapped on this output - remove
the output from their "mapped on" list.
2020-04-27 20:46:40 +02:00
Daniel Eklöf
37871aad84
wayland: group handle_global() together with handle_global_removed() 2020-04-27 20:18:03 +02:00
Daniel Eklöf
c4e3b9f69d
Merge branch 'unicode-combining' 2020-04-27 15:53:34 +02:00
Daniel Eklöf
3f3fff768a
vt: lazily reset utf8 in action_utf8_*_entry
action_clear() is in the super hot code path. Avoid resetting utf8
state there, as utf8 input is relatively uncommon.

Instead, reset it when we explicitly enter any of the utf8 collecting
states, as this is exactly the point where we need it.
2020-04-27 15:50:44 +02:00
Daniel Eklöf
d1fc419e34
vt: action_utf8_print: idx is cleared in action_clear() 2020-04-27 15:49:07 +02:00
Daniel Eklöf
4278af99d2
vt: utf8-*-entry: idx is cleared in action_clear() 2020-04-27 15:47:44 +02:00
Daniel Eklöf
e478874dd9
term: remove unneeded utf8.left member 2020-04-27 15:06:23 +02:00
Daniel Eklöf
3fb3b63d93
readme: link to utf8proc was cut off 2020-04-27 12:27:00 +02:00
Daniel Eklöf
aae998d9a3
readme: add link to utf8proc 2020-04-27 12:26:39 +02:00
Daniel Eklöf
2008207929
readme: add utf8proc to the list of dependencies 2020-04-27 12:25:35 +02:00
Daniel Eklöf
4283a8c51b
utf8: add support for unicode combining characters
This feature lets foot combine e.g. "a\u0301" to "á".

We first check if the current character (that we're about to print) is
a combining character, by checking if it's in one of the following
ranges:

* Combining Diacritical Marks (0300–036F), since version 1.0, with
  modifications in subsequent versions down to 4.1
* Combining Diacritical Marks Extended (1AB0–1AFF), version 7.0
* Combining Diacritical Marks Supplement (1DC0–1DFF), versions 4.1 to 5.2
* Combining Diacritical Marks for Symbols (20D0–20FF), since version
  1.0, with modifications in subsequent versions down to 5.1
* Combining Half Marks (FE20–FE2F), versions 1.0, with modifications
  in subsequent versions down to 8.0

If it is, we check if the last cell appears to contain a valid symbol,
and if so, we attempt to compose (combine) the last cell with the
current character, using utf8proc.

If the result is a combined character, we replace the content in the
previous cell with the new, combined character.

Thus, if you select and copy the printed character, you would get
e.g. "\u00e1" instead of "a\u0301".

This feature can be disabled. By default, it is enabled if the
utf8proc library is found, but can be explicitly disabled, or enabled,
with 'meson -Dunicode-combining=disabled|enabled'.
2020-04-27 12:13:30 +02:00
Daniel Eklöf
d959b98822
meson: bump C standard to c18 2020-04-26 19:39:08 +02:00
Daniel Eklöf
e9ed3025a8
damage: remove 'scroll' sub struct
There is no other types of damage but scroll damage.
2020-04-26 12:47:19 +02:00
Daniel Eklöf
ce280537de
render: make 'glyph' assignment more readable 2020-04-26 12:39:42 +02:00
Daniel Eklöf
db0ac438be
changelog: CSI 13;2t and CSI 14t have also been implemented 2020-04-25 23:09:10 +02:00
Daniel Eklöf
b22c7c4d0a
changelog: use backticks for full escape sequence too, and shorten entry 2020-04-25 23:07:47 +02:00
Daniel Eklöf
cb7103dadc
doc: foot.5: man page references do not embolden the section number 2020-04-25 22:40:29 +02:00
Daniel Eklöf
6b464fcf31
doc: foot.5: user -> users 2020-04-25 22:40:19 +02:00