Commit Graph

7491 Commits

Author SHA1 Message Date
Kovid Goyal
a783e5d85a Ensure builtin NERD font is used only if glyph is not found by normal font fallback 2024-07-02 14:18:22 +05:30
Kovid Goyal
66034d54fb DRYer
Use same algorithm for checking if cell can be rendered everywhere
2024-07-02 10:28:07 +05:30
Kovid Goyal
642dbc6f64 Dont print an error for failure to find fallback font on CoreText 2024-07-02 10:28:07 +05:30
Kovid Goyal
aaf65ec155 Move checking if font has cell text into the font backends
Gives us better control
2024-07-02 10:28:07 +05:30
Kovid Goyal
89cf58ba2b Fix add application font on macOS 2024-07-02 10:28:07 +05:30
Kovid Goyal
98c85d2923 Use builtin NERD fonts
Prevents users from having to install their own NERD font. System fonts
are still used preferentially on Linux but on macOS the builtin one is
used preferentially. Cant find any CoreText API to change this.

Still has to be implemented on macOS. And need to add code to the build
system to bundle the font when building.
2024-07-02 10:28:07 +05:30
Kovid Goyal
99258f6621 Nicer error message when running command line only kittens 2024-07-02 10:22:15 +05:30
Kovid Goyal
cc1b464151 Fix #7583 2024-07-01 13:25:05 +05:30
Kovid Goyal
1393fa6239 Fix #7581 2024-06-30 06:58:37 +05:30
Kovid Goyal
5eccdd3d13 ... 2024-06-29 16:24:35 +05:30
Kovid Goyal
226cc92b01 API to add font file to system font lookup 2024-06-29 16:18:43 +05:30
Kovid Goyal
78d1275601 macOS: Fix rendering of the unicode hyphen (U+2010) character when using a font that does not include a glyph for it
The problem was caused by CoreText falling back to the glyph for the
ASCII hyphen U+00AD when the font does not contain a glyph for U+2010.
However, HarfBuzz does not do this automatic fallback (see
https://github.com/harfbuzz/harfbuzz/issues/517). This leads to the
character not being rendered.

To fix this we specialize HarfBuzz glyph lookup for this character
to follow CoreText. HarfBuzz should really do this automatically when
the hb_font is based on a CTFontRef, but I dont have the time/energy to
argue with its maintainers. Note that HarfBuzz already does this
automatic fallback for U+2011.

Hopefully, there aren't many more such special cases in CoreText.

Fixes #7525
2024-06-29 14:22:04 +05:30
Kovid Goyal
0a98d848de Wayland redraw OS window twice after resize
Needed on, for instance sway to get it to recognize that the framebuffer
has been resized.
2024-06-29 11:07:02 +05:30
Kovid Goyal
190566be8e Wayland: Fix specifying the output name for the panel kitten not working
Fixes #7573
2024-06-25 12:53:37 +05:30
Kovid Goyal
a8daf06737 Linux: choose-fonts: fix rendering of ligatures in preview text 2024-06-25 11:28:47 +05:30
Kovid Goyal
190048080c ... 2024-06-24 21:04:11 +05:30
Kovid Goyal
9ddcedc126 Update docs of font_family to reference the choose-fonts kitten 2024-06-24 11:21:15 +05:30
Kovid Goyal
fb19bf057e Update docs of font_features to note that it is not needed for main font configuration anymore 2024-06-24 11:14:21 +05:30
Kovid Goyal
ac712f5d2d ... 2024-06-24 07:54:20 +05:30
Kovid Goyal
18ab18d090 Fix matching against style names in presence of elision 2024-06-24 07:54:19 +05:30
Kovid Goyal
47499d2711 Output features in spec_from_face 2024-06-24 07:54:19 +05:30
Kovid Goyal
67a9ee680b Automatically propagate features from regular face to the other faces when they are set to auto 2024-06-24 07:54:19 +05:30
Kovid Goyal
0633000c50 ... 2024-06-24 07:54:19 +05:30
Kovid Goyal
0cc8dd28de Add support for font features when rendering sample text 2024-06-24 07:54:19 +05:30
Kovid Goyal
f10f4e8e5b ... 2024-06-24 07:54:18 +05:30
Kovid Goyal
e2919a0f2d Fix preview rendering when height of previewed font greater than cell height 2024-06-24 07:54:18 +05:30
Kovid Goyal
a69d71d416 Render font feature list in UI 2024-06-24 07:54:18 +05:30
Kovid Goyal
57edb412e6 Add tests to validate feature-from-spec 2024-06-24 07:54:18 +05:30
Kovid Goyal
060732b428 work on passing font features via font specs 2024-06-24 07:54:18 +05:30
Kovid Goyal
7e56920fa3 Get feature human readable names 2024-06-24 07:54:18 +05:30
Kovid Goyal
a2a0f3cf41 List of all known OpenType font features 2024-06-24 07:54:18 +05:30
Kovid Goyal
0f76d3e13b Code to read features from GSUB/GPOS tables 2024-06-24 07:54:18 +05:30
Kovid Goyal
58c94105a3 Centralize FontSpec related code 2024-06-24 07:54:18 +05:30
Kovid Goyal
c5fd544d25 Fix O(n^2) algorithm 2024-06-24 07:54:17 +05:30
Kovid Goyal
679abf0e84 Ensure bold face is at least as heavy as regular face when auto selecting 2024-06-24 07:54:17 +05:30
Kovid Goyal
d205b147eb Improve auto selection of variable faces 2024-06-24 07:54:17 +05:30
Kovid Goyal
b017cc0c1e Handle variable fonts like cascadia code that dont have a postfix variation prefix name for some of their faces 2024-06-24 07:54:17 +05:30
Kovid Goyal
28f2919753 Fix medium face selection when more than family specified 2024-06-24 07:54:17 +05:30
Kovid Goyal
ff89f5187d Dont log an error when the default famil "monospace" is not found 2024-06-24 07:54:17 +05:30
Kovid Goyal
8ba6d5a296 CoreText: When finding medium face for a family prefer variable font if available 2024-06-24 07:54:16 +05:30
Kovid Goyal
7fd9bca845 IBM Plex Mono workaround is needed only under fontconfig 2024-06-24 07:54:16 +05:30
Kovid Goyal
2652342544 DRYer 2024-06-24 07:54:16 +05:30
Kovid Goyal
c27c731ffb Get font selection for the cascadia code variable fonts working 2024-06-24 07:54:16 +05:30
Kovid Goyal
7cdcbe6aeb Better scoring for malformed fonts with weird weight ranges 2024-06-24 07:54:16 +05:30
Kovid Goyal
304ecdd8c2 Refactor scoring 2024-06-24 07:54:16 +05:30
Kovid Goyal
b06a2bb937 Add more font selection tests 2024-06-24 07:54:16 +05:30
Kovid Goyal
46f391ae63 CoreText: Fix selection of font file with multi-file variant font
Also prefer semibold and use similar scorer as fontconfig
2024-06-24 07:54:16 +05:30
Kovid Goyal
1780028420 fontconfig: Prefer semi-bold as bold weight even for system selection 2024-06-24 07:54:16 +05:30
Kovid Goyal
ea65ede572 fontconfig: Lift axes spec to named style 2024-06-24 07:54:16 +05:30
Kovid Goyal
4ab8c16184 ... 2024-06-24 07:54:16 +05:30