mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-01-02 19:42:38 +00:00
Up to this point, every font I've experienced with ligatures has replaced the codepoints that were replaced for combining with a space. For example, if a font has a ligature for "!=" to turn it into a glyph, it'd shape to `[not equal glyph, space]`, so it'd still take up two cells, allowing us to style both. Monaspace, however, does not do this. It turns "!=" into `[not equal glyph]` so styles like backgrounds, underlines, etc. were not extending. This commit detects multi-cell glyphs and inserts synthetic blank cells so that styling returns. I decided to do this via synthetic blank cells instead of introducing a `cell_width` to the shaper result because this simplifies the renderers to assume each shaper cell is one cell. We can change this later if we need to. Annoyingly, this does make the shaper slightly slower for EVERYONE to accomodate one known font that behaves this way. I haven't benchmarked it but my belief is that the performance impact will be negligible because to figure out cell width we're only accessing subsequent cells so they're likely to be in the CPU cache and also 99% of cells are going to be width 1.
22 lines
1.0 KiB
Zig
22 lines
1.0 KiB
Zig
//! Fonts that can be embedded with Ghostty. Note they are only actually
|
|
//! embedded in the binary if they are referenced by the code, so fonts
|
|
//! used for tests will not result in the final binary being larger.
|
|
//!
|
|
//! Be careful to ensure that any fonts you embed are licensed for
|
|
//! redistribution and include their license as necessary.
|
|
|
|
/// Fonts with general properties
|
|
pub const fontRegular = @embedFile("res/Inconsolata-Regular.ttf");
|
|
pub const fontBold = @embedFile("res/Inconsolata-Bold.ttf");
|
|
pub const fontEmoji = @embedFile("res/NotoColorEmoji.ttf");
|
|
pub const fontEmojiText = @embedFile("res/NotoEmoji-Regular.ttf");
|
|
pub const fontVariable = @embedFile("res/Lilex-VF.ttf");
|
|
|
|
/// Cozette is a unique font because it embeds some emoji characters
|
|
/// but has a text presentation.
|
|
pub const fontCozette = @embedFile("res/CozetteVector.ttf");
|
|
|
|
/// Monaspace has weird ligature behaviors we want to test in our shapers
|
|
/// so we embed it here.
|
|
pub const fontMonaspaceNeon = @embedFile("res/MonaspaceNeon-Regular.otf");
|