Commit Graph
12787 Commits
Author SHA1 Message Date
Mitchell Hashimoto 134568c395 Merge pull request #333 from mitchellh/face-rework
font: Improve quirks mode performance, DeferredFace, Group refactor

This was motivated by #331. I realized with #331 that this added a lot of overhead on every render frame, because for each text run being rendered, we were (1) reloading the font name (unknown performance cost on macOS due to closed source, looks like [it ain't exactly free in Freetype](https://sourcegraph.com/github.com/freetype/freetype@4d8db130ea4342317581bab65fc96365ce806b77/-/blob/src/base/ftsnames.c?L44)) (2) doing multiple string compares (3) multiple function call overhead. And realistically, quirks mode will be _rare_, so paying a very active cost for a rare thing is 💩 .

In investigating that I finally shaved some yaks I've been wanting to shave on this path... the end result is that overall we should be doing [very] slightly less work no matter what and using slightly less memory. And on the renderer path, we're doing _way_ less work. 

- All loaded font `Face` structures must also check and cache their quirks mode settings. This makes #331 a single boolean check per text run which is effectively free compared to the actual shaping task. The cost is one additional byte on the face structure (well, whatever the alignment is).
- `DeferredFace` now only represents an _unloaded_ face (that can be loaded multiple times). This lowers memory usage significantly (`Face` was large) per deferred face.
- `DeferredFace.name()` now takes a buffer for output instead of just failing on no static space, weird decision. No performance impact but makes this function more robust.
- `Group.addFace` now takes a tagged union representing either a deferred or loaded face, this gets rid of all the weird `DeferredFace.initLoaded` wrappers that were unnecessary and dumb. No real performance impact.
- When a font face is loaded in `Group` (lots of things trigger this), the DeferredFace it came from is now deinitialized immediately. This should save on memory significantly because we free all the font discovery information. We can do this because a deferred face is only ever loaded _once_ when its part of a `Group`, and the group owns the deferred face.
- Auto-italicize moves into `Group` and is no longer duplicated between Deferred and normal Face. No performance change, less code.
2023-08-25 15:13:01 -07:00
Mitchell Hashimoto c15cf6d9f1 font: fontconfig adaptations to new api 2023-08-25 14:57:05 -07:00
Mitchell Hashimoto f4738210e1 font: determine quirks modes on font face load 2023-08-25 14:44:16 -07:00
Mitchell Hashimoto b51ef704f4 font: DeferredFace.name takes a buffer 2023-08-25 14:40:59 -07:00
Mitchell Hashimoto 167bf6f098 font: DeferredFace can no longer represent a loaded face 2023-08-25 13:28:46 -07:00
Mitchell Hashimoto ad6c2b6cc8 font: move auto-italicization to Group 2023-08-25 13:16:42 -07:00
Mitchell Hashimoto 1dcf921ed9 font: Group maintains face ownership 2023-08-25 13:00:04 -07:00
Mitchell Hashimoto ea3b957bc7 quirks: Menlo/Monaco should disable ligatures by default (#331)
* font: disable default font features for Menlo and Monaco

Both of these fonts have a default ligature on "fi" which makes terminal
rendering super ugly. The easiest thing to do is special-case these
fonts and disable ligatures. It appears other terminals do the same
thing.
2023-08-25 09:29:15 -07:00
Mitchell Hashimoto 63386e4a22 build: can select renderer with -Drenderer
Note that not all renderers work in all environments.
2023-08-25 08:12:31 -07:00
Mitchell Hashimoto e903ec382b Merge pull request #326 from mitchellh/kitty-modifier
input: kitty should not encode modifier-only key unless "report all"
2023-08-24 21:30:49 -07:00
Mitchell Hashimoto e7c11f7d13 input: kitty should not encode modifier-only key unless "report all" 2023-08-24 21:24:41 -07:00
Mitchell Hashimoto e0ee5d1763 Revert "Merge pull request #322 from mitchellh/big-glyphs"
This reverts commit 0ffbab00a4, reversing
changes made to 6751087bea.
2023-08-24 21:05:33 -07:00
Mitchell Hashimoto 5829ad51eb Merge pull request #323 from mitchellh/mac-strip-control
apprt/embedded: do not translate control characters
2023-08-24 15:15:25 -07:00
Mitchell Hashimoto 3a93aaf9cf apprt/embedded: do not translate control characters
macOS translates inputs such as shift+tab into the control character tab
(ascii 0x09). Linux/GTK does not translate character inputs except to
printable characters. We don't want control character translations
because these are all handled manually by our key encoder (i.e.
translating ctrl+c to 0x03).
2023-08-24 15:01:57 -07:00
Mitchell Hashimoto 0ffbab00a4 Merge pull request #322 from mitchellh/big-glyphs
renderer/opengl: glyphs that are too wide should be scaled down
2023-08-24 14:29:01 -07:00
Mitchell Hashimoto aad4bdb32a renderer/opengl: glyphs that are too wide should be scaled down
U+226A is 1-char wide according to the Unicode database but renders very
wide in many fonts. This causes it to leak outside of its grid cell. We
should scale down by x the same way we scale down by y.
2023-08-24 14:19:38 -07:00
Mitchell Hashimoto 6751087bea Merge pull request #318 from mitchellh/update-zig
update zig
2023-08-24 10:36:36 -07:00
Mitchell Hashimoto ab9f86cd23 update zig 2023-08-24 09:52:31 -07:00
Mitchell Hashimoto 86495e826c Merge pull request #317 from mitchellh/kitty-gfx
Kitty Graphics Protocol Initial Support
2023-08-24 08:50:13 -07:00
Mitchell Hashimoto 5aaf82065c remove kitty graphics from TODO 2023-08-24 08:50:01 -07:00
Mitchell Hashimoto 708d6a4323 terminal/kitty-gfx: todo notes 2023-08-24 08:48:45 -07:00
Mitchell Hashimoto f2f2b1eaf1 termio/exec: initial subprocess screen size should be sub padding 2023-08-24 08:45:32 -07:00
Mitchell Hashimoto c962bd0abf terminal/kitty-gfx: add error if both image id and num is set 2023-08-24 08:33:58 -07:00
Mitchell Hashimoto ec5dcf0850 terminal/kitty-gfx: do not send response on transmit/display unless I 2023-08-23 22:37:01 -07:00
Mitchell Hashimoto 35f1a9a478 terminal/kitty-gfx: transmission only sends response when no more chunks 2023-08-23 22:01:21 -07:00
Mitchell Hashimoto bf7054eeb6 terminal/kitty-gfx: ignore extra base64 padding 2023-08-23 21:52:50 -07:00
Mitchell Hashimoto 21ce787cff terminal/kitty-gfx: data chunk can be zero size 2023-08-23 19:31:46 -07:00
Mitchell Hashimoto 53452bab78 terminal/kitty-gfx: chunked transmit and display 2023-08-23 17:55:41 -07:00
Mitchell Hashimoto 23c7d95ee1 terminal/kitty-gfx: only enable on Metal for now 2023-08-23 17:07:50 -07:00
Mitchell Hashimoto 46ba3189f6 config: image-storage-limit to set maximum image memory per terminal 2023-08-23 16:58:16 -07:00
Mitchell Hashimoto 79ea2ff2db terminal/kitty-gfx: update todo 2023-08-23 16:45:23 -07:00
Mitchell Hashimoto 83e396044b terminal/kitty-gfx: add per-screen storage limit 2023-08-23 14:14:31 -07:00
Mitchell Hashimoto 91a4be4ca1 terminal/kitty-gfx: add file loading safety checks from Kitty 2023-08-23 11:52:31 -07:00
Mitchell Hashimoto 7c6bbae6a6 ci: disable wasm build for now 2023-08-23 11:45:46 -07:00
Mitchell Hashimoto 135250018e terminal/kitty-gfx: get rid of selection 2023-08-23 11:41:49 -07:00
Mitchell Hashimoto de3ef0f78c terminal/kitty-gfx: hook up delete 2023-08-23 11:37:14 -07:00
Mitchell Hashimoto 81498fe9be terminal/kitty-gfx: delete newest 2023-08-23 11:35:14 -07:00
Mitchell Hashimoto c0b58802ba terminal/kitty-gfx: images store transmit time 2023-08-23 11:17:58 -07:00
Mitchell Hashimoto 73976824a1 terminal/kitty-gfx: delete by column, row, z 2023-08-23 11:12:51 -07:00
Mitchell Hashimoto 6f7a9c4523 terminal/kitty-gfx: we need to use rect, not sel 2023-08-23 11:07:48 -07:00
Mitchell Hashimoto 98f1b55ea4 terminal/kitty-gfx: delete intersection 2023-08-23 11:00:13 -07:00
Mitchell Hashimoto 9ab25ef350 terminal/kitty-gfx: delete intersecting cursor 2023-08-23 10:53:38 -07:00
Mitchell Hashimoto 6244cc38cc terminal/kitty-gfx: delete by id 2023-08-23 10:38:40 -07:00
Mitchell Hashimoto 4b38fb96db terminal/kitty-gfx: honor "z" setting 2023-08-23 09:55:13 -07:00
Mitchell Hashimoto a082e4c1a2 terminal: delete lines (CSI M) should clamp count to remaining lines 2023-08-22 16:43:21 -07:00
Mitchell Hashimoto 5e45dc3386 input: kitty encoding should only output unmodified utf8 if printable 2023-08-22 15:00:53 -07:00
Mitchell Hashimoto 33c21c7339 terminal: mark kitty images as dirty on resize 2023-08-22 14:46:23 -07:00
Mitchell Hashimoto 7ff76ca00d terminal/kitty-gfx: respect display c/r params 2023-08-22 14:43:50 -07:00
Mitchell Hashimoto 3bbfee676b terminal/kitty-gfx: process source rectangle display params 2023-08-22 14:33:41 -07:00
Mitchell Hashimoto 84c72bbe46 renderer/metal: honor cell offset graphics command 2023-08-22 13:28:40 -07:00