608 Commits

Author SHA1 Message Date
Qwerasd
a0f017d6fd freetype: update expected ul pos in tests to account for removed fudge factor 2024-09-25 12:11:04 -06:00
Qwerasd
003b100707 font: remove fudge factors in ul and st position calculations
These were present because of an incorrect calculation in the underline
sprite renderer, and are no longer necessary.
2024-09-25 12:01:24 -06:00
Qwerasd
9a87001fa6 font/sprite: correct underline placement calculation 2024-09-25 11:56:01 -06:00
Qwerasd
ac68686036 freetype: fix underline position calculation 2024-09-23 22:30:59 -06:00
Qwerasd
7a1d304fa9 font: further improve ul/st position calculations 2024-09-23 22:10:43 -06:00
Qwerasd
49a3008919 font/sprite: reduce uneven gaps in dotted underline 2024-09-23 20:08:57 -06:00
Qwerasd
c7d6227bef freetype: improve strikethrough position guess by using ex height 2024-09-23 19:18:44 -06:00
Qwerasd
3ec36e4d23 coretext: improve strikethrough position calculation 2024-09-23 19:01:15 -06:00
Qwerasd
b3a7901b79 font/sprite: rework underline rendering, adjust positioning 2024-09-23 18:22:11 -06:00
Qwerasd
6917bcacad font/sprite: fix 1px gap at right edge of dotted and dashed underlines 2024-09-23 18:13:46 -06:00
Mitchell Hashimoto
c9523a6ee0 font/sprite: avoid invalid glyph if unsupported codepoint is attempted 2024-09-05 20:22:51 -07:00
Mitchell Hashimoto
bdcc21942d config: font-synthetic-style to enable/disable synthetic styles
This adds a new configuration "font-synthetic-style" to enable or
disable synthetic styles. This is different from "font-style-*" which
specifies a named style or disables a style completely.

Instead, "font-synthetic-style" will disable only the creation of
synthetic styles in the case a font does not support a given style.
This is useful for users who want to obviously know when a font doesn't
support a given style or a user who wants to explicitly only use the
styles that were designed by the font designer.

The default value is to enable all synthetic styles.
2024-08-26 20:52:34 -07:00
Mitchell Hashimoto
c1e978e33d font/coretext: tweak synthetic bold amount to be slightly lighter 2024-08-26 09:37:01 -07:00
Mitchell Hashimoto
915ec029ee font/freetype: synthetic bold 2024-08-25 09:51:09 -07:00
Mitchell Hashimoto
5f0daa23b9 font/freetype: synthetic italic 2024-08-24 21:03:54 -07:00
Mitchell Hashimoto
def4abf6a9 font: support variations for coretext_freetype backend 2024-08-24 20:35:54 -07:00
Mitchell Hashimoto
ac3e2163f3 typos 2024-08-24 19:49:04 -07:00
Mitchell Hashimoto
ce6c5517af font: synthesize bold italic 2024-08-23 21:08:41 -07:00
Mitchell Hashimoto
d22551cd31 font/coretext: support synthetic bold 2024-08-23 20:53:22 -07:00
Mitchell Hashimoto
74291793db font: rename auto-italicize to synthetic italic 2024-08-23 20:34:37 -07:00
Mitchell Hashimoto
9941440f47 font: bold italic fallback has to avoid nested alias entry 2024-08-23 20:20:44 -07:00
Mitchell Hashimoto
963c843d1a font: if variation is set for a style and style isn't found, retry reg 2024-08-23 19:59:36 -07:00
Mitchell Hashimoto
ad22e068a2 font: use proper variation axes for non-default 2024-08-23 19:48:26 -07:00
Mitchell Hashimoto
47fb7f0115 font: Collection can't use segmentedlist prealloc 2024-08-23 19:18:21 -07:00
Mitchell Hashimoto
5befe75a1f font/harfbuzz: work with new collection API 2024-08-23 15:30:57 -07:00
Mitchell Hashimoto
874caf29da font: completeStyles 2024-08-23 15:21:26 -07:00
Mitchell Hashimoto
1f3ccb2d66 font: Collection uses SegmentedList for styles for pointer stability 2024-08-23 14:50:04 -07:00
Mitchell Hashimoto
c183e71a92 font: support aliased entries in the font collection style table 2024-08-23 14:31:29 -07:00
Mitchell Hashimoto
a3247366fb font/coretext: font-thicken renders with additional padding on context
At certain font sizes, this avoids clipping the text. This is due to a
limitation of the CoreText API, which does not provide a way to measure
the exact size of the text that will be rendered when antialiasing is
enabled.
2024-08-19 20:47:39 -07:00
Mitchell Hashimoto
318dc85c02 pkg/macos: yeet more usingns 2024-08-16 16:50:41 -07:00
Mitchell Hashimoto
ba29bf759b lots more yeeting 2024-08-16 14:35:10 -07:00
Mitchell Hashimoto
14e3f43db2 font: yeet usingns 2024-08-16 10:47:15 -07:00
Mitchell Hashimoto
59de7d8239 Merge pull request #2087 from qwerasd205/murica
spelling: normalize grey -> gray
2024-08-11 18:03:22 -07:00
Mitchell Hashimoto
ed49670d2f font: remove broken test (on purpose) due to improvements in shaping 2024-08-11 15:46:08 -07:00
Qwerasd
10b8ca3c69 spelling: normalize grey -> gray 2024-08-11 18:31:01 -04:00
Mitchell Hashimoto
e385e0f9d0 font/shaper: split text runs on common bad ligature pairs
Fixes #2081

Many fonts have a bad ligature for "fl", "fi", or "st". We previously
maintained a list of such fonts in quirks.zig. However, these are so
common that it was suggested we do something more systematic and this
commit is that.

This commit changes our text run splitting algorithm to always split on
`fl`, `fi`, and `st`. This will cause some more runs for well behaved
fonts but the combination of those characters is rare enough and our
caching algorithm is good enough that it should be minimal overhead.

This commit renders our existing quirks fonts obsolete but I kept that
logic around so we can add to it if/when we find other quirky font
behaviors.
2024-08-11 15:26:36 -07:00
Mitchell Hashimoto
de9ea2d735 font: add test for fl lig 2024-08-11 15:04:56 -07:00
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
77ee2f413c terminal: hasText no longer special cases kitty placeholders 2024-07-29 14:36:49 -07:00
Mitchell Hashimoto
4b5ad77b70 font: fontconfig always prefer monospace in pattern
Fixes #1984
2024-07-21 09:48:07 -07:00
Mitchell Hashimoto
f4c26dfaf5 shaper/coretext: use pointer address for cache comparison 2024-07-18 18:46:09 -07:00
Qwerasd
12e8d96b1a shaper/coretext: reset font cache on grid change
Not doing this caused issues with spacing of ligatures and
multi-substitutions when changing the font size with cmd +/-
2024-07-18 17:39:57 -04:00
Mitchell Hashimoto
3b36dbb53e font/coretext: cached fonts uses unmanaged arraylist 2024-06-22 20:56:23 -07:00
Mitchell Hashimoto
2607446235 font: add noop endFrame calls to all other shapers 2024-06-22 20:49:10 -07:00
Mitchell Hashimoto
71353d016e coretext shaper owns CFReleaseThread, works on both Metal and OpenGL now 2024-06-22 20:42:59 -07:00
Mitchell Hashimoto
4325dc51bc font: coretext shaper owns the cf release pool 2024-06-22 20:32:24 -07:00
Qwerasd
053500da38 shaper/coretext: update tests 2024-06-14 01:57:46 -04:00
Qwerasd
626ec2b5ac perf: introduce CFReleaseThread for running CoreFoundation releases
Some CoreFoundation objects, such as those produced by CoreText, have
expensive callbacks that run when they are released. By offloading the
CFRelease calls to another thread, we can avoid important threads being
blocked by unexpectedly expensive callbacks.

This commit also changes the way that the coretext shaper's run iterator
builds its string. Rather than using a CFMutableString, an ArrayList of
unichars is built which is passed to CFStringCreateWithCharactersNoCopy,
which is a lot more efficient since it avoids all the CoreFoundation
overhead.
2024-06-14 01:43:02 -04:00
Qwerasd
04896a14b4 perf(shaper/coretext): cache fonts between shape calls 2024-06-14 00:14:53 -04:00
Qwerasd
8d76b5f283 perf: introduce CacheTable strcture, use it for shaper cache 2024-06-10 13:58:35 -04:00