Commit Graph

90 Commits

Author SHA1 Message Date
Kovid Goyal
63d76ee837 macOS: When the Apple Color Emoji font lacks an emoji glyph search for it in other installed fonts
Fixes #3591
2021-05-09 07:17:32 +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
1f4fdb174a Fix rendering of the new infinite length ligatures on CoreText
Apparently on CoreText, harfbuzz gives incorrect values for glyph
positions. So we use it only for selection and grouping of glyphs.
Actual positioning is done using CoreText. This means sophisticated
positioning using GPOS tables is probably broken, but that isn't really
useable in a character grid anyway.

Also remove the hack where glyph_centering was done for calt ligatures
as it seems to not be needed with modern FiraCode and CoreText
rendering. Fixes #3372
2021-03-11 20:11:40 +05:30
Luflosi
bb88b33469 Fix memory leak
Found with the Clang Static Analyzer.
2020-11-05 13:15:19 +01:00
Luflosi
35f7388725 Fix memory leaks in coretext_all_fonts()
Found with the Clang Static Analyzer.
2020-10-25 17:40:51 +01:00
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
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
1bb6242020 macOS: no longer render emoji 20% below the baseline. This causes some emoji to be cut-off and also look misaligned with very high cells
Fixes #2873
2020-07-23 20:38:02 +05:30
Kovid Goyal
e803505aad CoreText: When centering glyphs ignore negative origins
This is needed for FiraCode ligatures to line up correctly. See
https://github.com/kovidgoyal/kitty/issues/2591#issuecomment-619937030
2020-04-27 18:02:53 +05:30
Kovid Goyal
859033415b macOS: Fix incorrect horizontal positioning of some full-width East Asian characters
Fixes #1457
Also render multi-cell PUA characters centered, matching behavior on other platforms
2020-04-09 13:25:19 +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
21c5610431 ... 2020-03-24 18:02:44 +05:30
Kovid Goyal
6dbdf72f40 CoreText: When matching fonts prefer non-expanded/condensed variants 2020-03-24 17:55:38 +05:30
Kovid Goyal
109a856b91 Fix #2313 2020-01-26 08:00:06 +05:30
Kovid Goyal
43fc335be2 more macOS float fixes 2019-09-27 20:05:11 +05:30
Luflosi
8e96a27d51 Use the OPT() macro where possible 2019-09-12 10:02:53 +02:00
Kovid Goyal
57542fc204 Only disable liga and dlig for nimbus mono 2019-08-10 08:22:36 +05:30
Luflosi
cdbe2f13ca Cocoa: Move slightly towards modern Objective-C
Inspired by 9a9568212c.
2019-07-25 17:14:32 -05:00
Kovid Goyal
cdb493cf50 Couple more MIN/MAX type fixes 2019-07-04 09:15:13 +05:30
Kovid Goyal
efad733cc5 DRYer 2019-06-30 18:42:20 +05:30
Kovid Goyal
1fcd6e1811 macOS: Fix finding fallback font for private use unicode symbols not working reliably
Fixes #1650
2019-06-30 18:11:58 +05:30
Kovid Goyal
1ae32b5742 Linux: Automatically increase cell height if the font being used is broken and draws the underscore outside the bounding box
See #690
2019-05-29 16:04:50 +05:30
Kovid Goyal
1369a36178 Exclude variation selectors when finding fallback font 2019-05-13 20:36:29 +05:30
Luflosi
4b65b4ac2b Fix potential undefined behaviour
When `gray_color_space` is `NULL`, it is passed into `CGBitmapContextCreate()`. Since there are no guarantees in https://developer.apple.com/documentation/coregraphics/1455939-cgbitmapcontextcreate?language=objc to what happens in that case, depending on the implementation there may be undefined behaviour.
2019-03-15 14:31:19 +01:00
Kovid Goyal
16c0871e22 Implement resizing cells rendering on CoreText 2019-03-04 19:54:11 +05:30
Daniel Hahler
3c4cb3c35b get_glyph_width for core text?! 2018-09-29 18:56:54 +02:00
Daniel Hahler
8e09e809aa fixup! render_glyphs_in_cells: skip centering glyph for PUA 2018-09-29 16:23:16 +02:00
Theodore Dubois
94052bb712 Add option to increase font thickness on macOS 2018-09-10 19:30:29 -07:00
Kovid Goyal
28c154ecf0 typo 2018-09-10 21:58:15 +05:30
Kovid Goyal
8176f661ea macOS: Fix small leak in glyph rendering code 2018-09-10 21:41:26 +05:30
Kovid Goyal
55f457caf4 macOS: Fix a character that cannot be rendered in any font causing font fallback for all subsequent characters that cannot be rendered in the main font to fail
Fixes #799
2018-09-04 14:21:36 +05:30
Kovid Goyal
8dea5b3e3e Reduce data sent to GPU per draw by 30%
Split up the Cell structure into a CPUCell and a GPUCell. Only the
GPUCell part needs to be sent to the GPU. Should make kitty use even
less system resources and make a performance difference on systems where
the GPU bandwidth is constrained.

Also allows adding more CPU only data in the future without affecting
GPU bandwidth. For example, hyperlinks or more combining characters.
2018-05-27 21:25:09 +05:30
Kovid Goyal
df9eab279a Implement changing the font size for individual top level (OS) windows 2018-05-27 12:37:49 +05:30
Kovid Goyal
ed44515318 All tests pass 2018-05-27 12:37:05 +05:30
Kovid Goyal
523aadaa3b Refactor font group handling
Allow kitty to manage multiple groups of fonts with different cell
sizes. Will eventually allow kitty to have different font sizes/dpi per
OSWindow
2018-05-27 12:37:05 +05:30
Kovid Goyal
96c93fa252 Add support for emoji presentation when choosing fallback fonts 2018-02-06 11:11:22 +05:30
Kovid Goyal
409bd37db5 Store combining chars as an array in the Cell
Makes it easier to increase the number of combining chars if needed,
rather than storing them as a mask.
2018-01-18 14:10:58 +05:30
Kovid Goyal
1ae7ae4a1d Fix consecutive separate ligatures being rendered in the same group
Rendering multiple ligatures in the smae group is bad for performance
and also causes incorrect rendering if the last ligature in the group
does not fit into the number of cells in the group.
2018-01-14 11:18:44 +05:30
Kovid Goyal
0fcce6ec58 Remove trailing whitespace from native code files 2017-12-20 08:44:47 +05:30
Kovid Goyal
b9d0ec0d4c CoreText: Use the layout engine to calculate cell height
Slower, but hopefully more accurate, since it takes into account
whatever kludges Apple is currently using to calculate line height
in its applications.
2017-12-13 14:12:23 +05:30
Kovid Goyal
869abc4d5c ... 2017-12-13 14:05:01 +05:30
Kovid Goyal
872118fcbe CoreText: Fix incorrect underline position and thickness calculation 2017-12-13 13:59:11 +05:30
Kovid Goyal
d25c0d42bc CoreText: Ensure cell_width and cell_height are never zero 2017-12-13 09:35:50 +05:30
Kovid Goyal
a1b4f7c92d Fix COreText leak on exit 2017-12-13 08:27:33 +05:30
Kovid Goyal
47704f24c1 CoreText: Get rid of the line height fudge factor
It was leading to larger line heights than in iTerm on High Sierra with
Menlo. Also as per Apple documentation, line height should be ascent +
descent + leading.
https://developer.apple.com/library/content/documentation/TextFonts/Conceptual/CocoaTextArchitecture/TypoFeatures/TextSystemFeatures.html
2017-12-13 08:22:26 +05:30
Kovid Goyal
a29b424477 CoreText: Implement resizing of glyphs too wide to fit 2017-12-11 20:34:23 +05:30
Kovid Goyal
005c4bf29e Finish up CoreText based rendering 2017-12-11 19:04:44 +05:30
Kovid Goyal
c86c166448 More work on positioning glyphs with CoreText 2017-12-11 18:48:14 +05:30
Kovid Goyal
0999ce159e Fix colors incorrect when rendering directly to buf 2017-12-11 10:43:32 +05:30
Kovid Goyal
98d8ab2953 Fix OT shaper not working on macOS
Also dont keep an extra reference to the hb font in fonts.c
2017-12-11 09:48:20 +05:30