feat(font): port font metrics, atlas and the sprite font
Ports ZIG/src/font/{Metrics,Atlas,Glyph}.zig and the whole sprite font
(font/sprite/**): box drawing, block elements, braille, branch/git
graph symbols, geometric shapes, powerline, and the symbols for legacy
computing (+ supplement, incl. the octants table).
Ghostty draws sprites with z2d; we use tiny-skia for path coverage,
composited onto an alpha8 canvas, while following the Zig geometry
(positions, thickness, rounding). Comptime discovery of draw functions
is replaced by explicit, overlap-checked codepoint range tables.
Upstream reference sheets are vendored in testdata/ and compared with a
tolerance: braille and U+1CD00 are pixel-identical; other sheets differ
only in antialiasing on thin diagonals/curves. Review renders are written
to target/sprite_sheets/.
The crate temporarily drops its config/unicode/terminal deps until the
rest of the font engine is ported (Phase 3).
Test Plan:
- cargo test -p ghostty-font (49 tests incl. reference sheet comparison)
- inspect target/sprite_sheets/review-all-18x36.png
This commit is contained in:
1 parent
b2b248e003
commit
1388f117d3
58 files changed
+9331
-6
No files matched your search
@@ -0,0 +1,21 @@
|
||||
//! Glyph is a single loaded glyph for a face. Port of `font/Glyph.zig`.
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub struct Glyph {
|
||||
/// width of glyph in pixels
|
||||
pub width: u32,
|
||||
|
||||
/// height of glyph in pixels
|
||||
pub height: u32,
|
||||
|
||||
/// left bearing
|
||||
pub offset_x: i32,
|
||||
|
||||
/// top bearing
|
||||
pub offset_y: i32,
|
||||
|
||||
/// coordinates in the atlas of the top-left corner. These have to
|
||||
/// be normalized to be between 0 and 1 prior to use in shaders.
|
||||
pub atlas_x: u32,
|
||||
pub atlas_y: u32,
|
||||
}
|
||||
Reference in new issue
Block a user