Commit Graph

167 Commits

Author SHA1 Message Date
Kovid Goyal
f0cac79143 Work on rendering sample text for a font 2024-06-24 07:54:14 +05:30
Kovid Goyal
48ed369342 Code to read the STAT OpenType table 2024-06-24 07:54:12 +05:30
Kovid Goyal
56f8fb9f75 Implement basic support for selecting font variations in fontconfig 2024-06-24 07:54:09 +05:30
Kovid Goyal
b385ccbc45 Output resolved fonts in debug config 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
98dac1020d Show the postscript variations name prefix when listing fonts 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
fcbf0782b5 Fix building on older FreeType 2024-06-24 07:53:15 +05:30
Kovid Goyal
f4311d4b61 Add information about variable fonts to list-fonts output 2024-06-24 07:53:15 +05:30
Kovid Goyal
57770f2f55 Code to get variable data from freetype to python 2024-06-24 07:53:15 +05:30
Kovid Goyal
54fb6be112 Work on list variable fonts on Linux 2024-06-24 07:53:15 +05:30
Kovid Goyal
bb3b5df99a better field name 2024-04-18 22:46:20 +05:30
Kovid Goyal
2e2caa167a Better fix for #7263
Don't blank the upper 16 bits when copying index from freetype face
2024-04-18 22:36:00 +05:30
Kovid Goyal
d9ccbcd0ce Font fallback: Fix the font used to render a character sometimes dependent on the order in which characters appear on screen
We ameliorate the performance hit by storing a hash table mapping cell
text to the loaded fallback font index so that lookups for previously
seen text are still fast.

Fixes #6865
2023-12-11 20:27:21 +05:30
Kovid Goyal
32588939ae Deprecate the adjust_baseline adjust_line_height and adjust_column_width options in favor of modify_font
Unifies handling and allow using pt units for those adjustments.
Note that the behavior of percentage sizes for adjust baseline is
backwards incompatible. It now uses the baseline value as the base
rather than the cell height.
2022-07-15 15:29:42 +05:30
Kovid Goyal
e227264bad Nicer error message when failing to load FreeType face 2022-03-09 14:28:38 +05:30
Kovid Goyal
cc11326baa Linux: Do not rescale fallback fonts to match the main font cell height
Fixes #4707
2022-02-15 07:51:15 +05:30
Kovid Goyal
dddff91fad Linux: Fix rendering of emoji when using scalable fonts such as Segoe UI Emoji 2022-02-06 13:31:11 +05:30
pagedown
49fbeb9a56 Remove the always true conditions
Unsigned integers are always greater than or equal to zero.
The else branch is always the opposite.
2022-01-01 21:27:01 +08:00
Kovid Goyal
55319cd6d6 FreeType: Round glyph advances
The old code would simply add advances and store as a float with
individual glyph positioning using floor() based on the advance +
offset. This breaks rendering of infinite length ligatures at some font
sizes as they either under or overflow. Rounding the advances seems to
fix it. Dont know if it will have other ill-effects for non infinite
length ligatures. If it does we can test total ligature length and
use rounding only for long ligatures.

Fixes #3896
2021-08-04 08:40:49 +05:30
Kovid Goyal
be34af4555 Remove inline from .c files
It is ignored by compilers and hides unused static functions
2021-08-03 09:11:17 +05:30
Kovid Goyal
cea8d4a87d ... 2021-07-06 09:05:50 +05:30
Kovid Goyal
e07ba2c53d Dont move back glyph on overflow in infinite ligatures 2021-07-05 14:47:01 +05:30
Kovid Goyal
0af3f102aa ... 2021-07-05 14:38:07 +05:30
Yang Tang
bfdbf06731 Remove redundant code 2021-06-16 11:44:27 -04:00
Kovid Goyal
0fb2f383ac Clean up the baseline adjustment PR 2021-06-16 20:39:00 +05:30
Yang Tang
e964ac86d5 Allow specifying adjust_baseline as either pixels or percentage 2021-06-16 01:11:51 -04:00
Kovid Goyal
e01bb09e8c Fix ligatures not working with the Iosevka font
Fixes #297
2021-06-04 12:18:17 +05:30
Kovid Goyal
6d6273af48 Properly scale emoji rendered in the CSD 2021-04-01 22:07:00 +05:30
Kovid Goyal
55dc354e68 Improve at exit cleanup functions
Now they are run in a defined order not based on
the order of initialization
2021-04-01 11:48:36 +05:30
Kovid Goyal
dd2b6119b3 Implement rendering of emoji for CSD 2021-03-31 15:23:05 +05:30
Kovid Goyal
da0009a46b More work on CSD title rendering 2021-03-30 22:12:54 +05:30
Kovid Goyal
d7e1e53450 More work on text rendering for CSD 2021-03-30 08:25:01 +05:30
Kovid Goyal
4a3c57054f Function to get fallback font for a char 2021-03-29 15:35:38 +05:30
Kovid Goyal
41b9495588 More work on text rendering 2021-03-29 14:56:49 +05:30
Kovid Goyal
133b580262 Avoid error prints when rendering the space glyph and freetype fails to load it
Also a micro-optimization, since there is no need to actually render the
space glyph
2021-01-05 12:21:06 +05:30
Kovid Goyal
3e76cf87ce Linux: Fix rendering of emoji followed by the graphics variation selector not being colored with some fonts
Harfbuzz, for some reason has started rendering variation selector
glyphs. These fail to load for some fonts. https://github.com/harfbuzz/harfbuzz/issues/2804

Fixes #3211
2021-01-05 09:35:21 +05:30
Kovid Goyal
f72ff73344 Correct return type 2021-01-05 09:17:17 +05:30
Kovid Goyal
9aae346ab5 Better error message when failing to load glyph 2021-01-05 09:10:35 +05:30
Kovid Goyal
229134cf31 Misc. fixes for issues reported by clang's static analyzer
Most of them are false positives. A couple of mem leaks after unlikely
failure conditions.
2020-09-10 10:47:28 +05:30
Kovid Goyal
4062365b19 Revert "Adjust cell height automatically for buggy fonts that draw brackets outside the bounding box"
This reverts commit 5555a66638.
Since it does not fix the issue.
2020-08-06 21:20:54 +05:30
Kovid Goyal
df475dfde5 Fix indentation 2020-08-06 17:55:02 +05:30
Kovid Goyal
5555a66638 Adjust cell height automatically for buggy fonts that draw brackets outside the bounding box
See https://github.com/cormullion/juliamono/issues/14
2020-08-06 14:06:06 +05:30
Kovid Goyal
e678c41f56 More code scanning warning fixes 2020-07-07 10:24:57 +05:30
Kovid Goyal
ee3462592a Silence more code scanning warnings 2020-07-07 10:01:38 +05:30
Kovid Goyal
ee47a10b37 Simplify code a bit 2020-07-07 09:44:51 +05:30
Kovid Goyal
209b78a3ec Silence a code scanning warning 2020-07-07 09:20:59 +05:30
Kovid Goyal
a325a5fdee Merge branch 'strikethrough-info-from-font' of https://github.com/trygveaa/kitty 2020-03-31 09:34:07 +05:30
Trygve Aaberge
931e91f1a7 Read strikethrough info from font when using FreeType
This reads the strikethrough position and thickness from the font so it
is rendered correctly.

This is only implemented for FreeType, not Core Text, because I didn't
find any way to get the info from Core Text, and I don't have a Mac to
test it on either. When using Core Text or when the font doesn't provide
the info, the same approximation as before is used.
2020-03-30 20:09:30 +02:00
Kovid Goyal
0d68b7078c Check for float conversion issues on build
Useful to catch any errors left over from the migration of times from
double to int64_t
2019-09-27 19:47:25 +05:30