166 Commits

Author SHA1 Message Date
Kovid Goyal
0c7dd7edb2 Implement horizontal alignment for font based rendering
Still need to do it for box chars
2025-02-19 09:04:22 +05:30
Kovid Goyal
25cceb2c5c Same for cell_as_utf8_for_fallback 2025-02-16 10:08:30 +05:30
Kovid Goyal
20821f4beb macOS: Fix fallback font rendering for bold/italic text not working for some symbols that are present in the Menlo regular face but not the bold/italic faces
Fixes #8282
2025-02-03 11:06:42 +05:30
Kovid Goyal
c599b7e02f API to render a single codepoint using a Face 2025-02-03 10:56:52 +05:30
Kovid Goyal
1784823c18 macos implementation for face_apply_scale 2025-02-03 10:56:44 +05:30
Kovid Goyal
8993386399 Store font related cell metrics in a single struct 2025-02-03 10:56:44 +05:30
Kovid Goyal
155990ce0b Fix some method declarations for Python API compat 2024-12-24 22:54:22 +05:30
Kovid Goyal
8dd6686c86 Fix bug pointed out by ASAN 2024-11-04 09:10:08 +05:30
Kovid Goyal
d88b7e945a Port the CoreText backend to use ListOfChars 2024-11-04 09:10:07 +05:30
Kovid Goyal
6834e366be macOS: Fix a regression in the previous release that caused junk to be rendered in font previews in the choose fonts kitten and crash on Intel macs
Fixes #7892
2024-09-26 01:44:14 +05:30
Kovid Goyal
866c14249b fix minor memory leak in buffers 2024-09-26 01:32:36 +05:30
Kovid Goyal
ab3cefd81f Output font features in debug info 2024-08-25 11:19:36 +05:30
Kovid Goyal
60601a6dba Fix #7772 2024-08-24 11:12:37 +05:30
Kovid Goyal
eab801cd17 DRYer 2024-08-18 11:59:34 +05:30
Kovid Goyal
fd5b96b43b Use builtin NERD font for symbol_map if no system NERD font is available 2024-07-02 15:33:07 +05:30
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
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
0cc8dd28de Add support for font features when rendering sample text 2024-06-24 07:54:19 +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
0f76d3e13b Code to read features from GSUB/GPOS tables 2024-06-24 07:54:18 +05:30
Kovid Goyal
22ecba93e5 Forgot to initialize canvas when rendering sample text onto it 2024-06-24 07:54:15 +05:30
Kovid Goyal
1763cbde46 Function to get the named style used by a variable font instance 2024-06-24 07:54:14 +05:30
Kovid Goyal
b44ffb9815 Get variable font selection working on coretext 2024-06-24 07:54:14 +05:30
Kovid Goyal
aaa34bb1d6 Fix crash on CoreText for very large font sizes 2024-06-24 07:54:14 +05:30
Kovid Goyal
852889a561 Implement rendering of sample text 2024-06-24 07:54:14 +05:30
Kovid Goyal
f0cac79143 Work on rendering sample text for a font 2024-06-24 07:54:14 +05:30
Kovid Goyal
d826265fd7 Get query terminal working again
Also return current OS Window's font size
2024-06-24 07:54:13 +05:30
Kovid Goyal
48ed369342 Code to read the STAT OpenType table 2024-06-24 07:54:12 +05:30
Kovid Goyal
6d7c54bcb2 Make CoreText signatures for some font finding methods the same as their equivalents in fontconfig 2024-06-24 07:54:12 +05:30
Kovid Goyal
b385ccbc45 Output resolved fonts in debug config 2024-06-24 07:53:16 +05:30
Kovid Goyal
3ca20ebc4e Implement parsing of fvar table
Cant rely on CoreText for this as it has incomplete and buggy APIs
2024-06-24 07:53:16 +05:30
Kovid Goyal
ba1a268de0 Implement postscript variation name prefix for CoreText as well 2024-06-24 07:53:16 +05:30
Kovid Goyal
f7f8b4cdf6 Use the full name from CoreText when available 2024-06-24 07:53:16 +05:30
Kovid Goyal
a864127e4f Prune listings of variable fonts
Show only one entry per style per variable font as identified by path
2024-06-24 07:53:16 +05:30
Kovid Goyal
189ec26dbc Cleanup resource management
Also add slant to CTFont descriptor
2024-06-24 07:53:16 +05:30
Kovid Goyal
2244b664bc Get variable font data from CoreText 2024-06-24 07:53:15 +05:30
Kovid Goyal
2f3578ad93 Start work on listing variable fonts under macOS 2024-06-24 07:53:15 +05:30
Kovid Goyal
8fc96c5bd7 Make the debug logging functions consistent
They now all output the same format of:
[time since program start] msg
2024-04-08 12:53:55 +05:30
Kovid Goyal
f7a7765ba2 Clean up debug rendering output 2024-03-26 13:06:08 +05:30
Kovid Goyal
af82938427 Dont bother applying zero style to fallback
Micro-optimization
2024-03-22 15:37:58 +05:30
Kovid Goyal
42994bac37 DRYer 2024-03-22 15:19:39 +05:30