268 Commits

Author SHA1 Message Date
Mitchell Hashimoto
22f437aac6 font: coretext cell width calculation 2022-10-08 11:49:23 -07:00
Mitchell Hashimoto
f393049988 fix compilation 2022-10-08 11:25:54 -07:00
Mitchell Hashimoto
0e167ae24c font: coretext initialize face from memory 2022-10-08 11:21:24 -07:00
Mitchell Hashimoto
a21dda2b08 font: lower interface requirement for face 2022-10-08 10:07:35 -07:00
Mitchell Hashimoto
0ff79a0623 font: coretext glyphIndex 2022-10-08 10:04:17 -07:00
Mitchell Hashimoto
723db8be2f font: coretext face presentation 2022-10-08 09:55:22 -07:00
Mitchell Hashimoto
90f3b9391c font: begin coretext Face 2022-10-08 09:43:54 -07:00
Mitchell Hashimoto
71ec509930 Make font face a compile time interface, stub for coretext 2022-10-08 09:19:21 -07:00
Mitchell Hashimoto
a44d4ea33b Fix underline/strikeout position with larger fonts 2022-10-06 15:40:43 -07:00
Mitchell Hashimoto
b18309187e Strikethrough (#19)
Not as straightforward as it sounds, but not hard either:

* Read OS/2 sfnt tables from TrueType fonts
* Calculate strikethrough position/thickness (prefer font-advertised if possible, calculate if not)
* Plumb the SGR code through the terminal state -- does not increase cell memory size
* Modify the shader to support it

The shaders are getting pretty nasty after this... there's tons of room for improvement. I chose to follow the existing shader style for this to keep it straightforward but will likely soon refactor the shaders.
2022-10-06 15:03:19 -07:00
Mitchell Hashimoto
3a7e53e2e4 font: calculate correct offset for non-scalable emoji fonts 2022-10-06 14:12:03 -07:00
Mitchell Hashimoto
3b549e0709 more accurately compute font metrics 2022-10-06 11:07:49 -07:00
Mitchell Hashimoto
3d4aacd51d underline is derived from the primary font 2022-10-04 11:08:07 -07:00
Mitchell Hashimoto
c149696f61 redoing some of the baseline calcs, remove from shader 2022-10-04 10:00:32 -07:00
Mitchell Hashimoto
a4e8b5ae8c calculate font metrics per face 2022-10-03 12:31:07 -07:00
Mitchell Hashimoto
f41cbf228b font: set "backend" enum vs booleans 2022-10-02 09:41:37 -07:00
Mitchell Hashimoto
12c9482d48 Mac Font Discovery with CoreText (#17)
This implements font discovery so the `--font-family` flag works for macOS. Fonts are looked up using the Core Text API so any installed font on the Mac system can be used. 

We still use FreeType for rendering, and CoreText doesn't _quite_ give us all the information we need to build the exact face in FreeType. So a TODO after this is to now implement glyph _rendering_ using Core Text and Core Graphics. Until then, a couple fonts don't quite work (i.e. Monaco, a big one!) but many do!
2022-10-01 22:21:30 -07:00
Mitchell Hashimoto
b6a4fff6d8 search for fonts on startup 2022-09-29 11:57:29 -07:00
Mitchell Hashimoto
30a5041a38 font Group has Lib, loads deferred faces when needed 2022-09-29 10:30:45 -07:00
Mitchell Hashimoto
b11ed06fc2 font: test loading deferred face for fontconfig 2022-09-24 13:34:56 -07:00
Mitchell Hashimoto
88a4cb65f3 src/font: working on initiaizing deferred fonts from fc 2022-09-23 14:12:38 -07:00
Mitchell Hashimoto
bc9a0a36a8 store requested size alongside deferred font for loading 2022-09-23 14:12:38 -07:00
Mitchell Hashimoto
92251ed913 font group works with deferred faces exclusively 2022-09-23 14:12:38 -07:00
Mitchell Hashimoto
ac26c20e94 font discovery builds up a set of deferred faces 2022-09-23 14:12:38 -07:00
Mitchell Hashimoto
1c1da63c7e deferred face hasCodepoint 2022-09-23 14:12:38 -07:00
Mitchell Hashimoto
141182aa13 start adding fontconfig conditional compilation 2022-09-23 14:12:38 -07:00
Mitchell Hashimoto
7bde20a43d a cell is empty only if it also has no styling
Previously we only checked if it had no character. With text shaping,
this was causing runs of only empty backgrounds to not render.
2022-09-13 10:12:44 -07:00
Mitchell Hashimoto
97aef76501 avoid large shaper buffer allocation on every frame 2022-09-07 20:27:36 -07:00
Mitchell Hashimoto
98dff5a163 better handling of combination characters 2022-09-07 20:10:06 -07:00
Mitchell Hashimoto
8d90292cb2 remove font conversion stuff 2022-09-07 16:17:41 -07:00
Mitchell Hashimoto
278d9ad9d6 add tracing 2022-09-07 16:10:16 -07:00
Mitchell Hashimoto
85dff335f1 much more accurate run splits and cell widths in runs 2022-09-07 10:30:40 -07:00
Mitchell Hashimoto
3f1942223b only test presentation VS15/16 if directly adjacent to codepoint 2022-09-06 14:26:43 -07:00
Mitchell Hashimoto
da7843e8b4 test shaping a long emoji 2022-09-06 14:25:29 -07:00
Mitchell Hashimoto
f40eb3663a kind of handle VS15/16 better, its not blank anymore, but its wrong 2022-09-06 13:56:20 -07:00
Mitchell Hashimoto
e326bc4921 fonts are presentation format aware (text vs emoji) 2022-09-06 13:30:29 -07:00
Mitchell Hashimoto
302889bfb3 font don't include convert 2022-09-05 22:53:29 -07:00
Mitchell Hashimoto
0d2c03c21c Font face handles zero-width glyphs (weird but happens) 2022-09-05 22:53:00 -07:00
Mitchell Hashimoto
90d250a3ba Rebase 2022-09-05 11:41:40 -07:00
Mitchell Hashimoto
480d262bc1 Calculate grid_width properly, use that instead of wide mask in shader 2022-09-05 11:38:53 -07:00
Mitchell Hashimoto
3231b84927 Ligatures
This introduces a naive first pass at integrating ligatures. The basic
ligatures (such as "==" in some fonts) work great. Skin-toned emoji are
struggling a bit.

This isn't the most performant way to do this, either, and I plan on
improving that.
2022-09-05 11:38:52 -07:00
Mitchell Hashimoto
47242ad12a test writing graphemes 2022-09-05 10:29:52 -07:00
Mitchell Hashimoto
77c8ec0a20 the big screen switchover 2022-09-01 00:58:47 -07:00
Mitchell Hashimoto
39376feae0 font: shape API, calls shape and outputs some debug 2022-08-29 20:15:29 -07:00
Mitchell Hashimoto
dafc99746d font: Face initializes a hb_font alongside every face 2022-08-29 16:46:53 -07:00
Mitchell Hashimoto
0505018186 Line segmentation into text runs 2022-08-29 16:39:48 -07:00
Mitchell Hashimoto
2cab94e64d move cell metrics calculation out into src/font 2022-08-29 11:44:05 -07:00
Mitchell Hashimoto
bd9c048c02 use new font.GroupCache, remove unused font structs 2022-08-29 11:34:21 -07:00
Mitchell Hashimoto
a0aa100815 font: GroupCache is like Group, but with caching... 2022-08-29 11:10:50 -07:00
Mitchell Hashimoto
a75035c042 font: introduce Group which will eventually replace FallbackSet
This is more oriented around glyph indexes and also introduces an
important concept in the FontIndex which can be cached ahead of time so
that we can eventually break down text into runs for text shaping.
2022-08-29 10:16:53 -07:00