1
0
Fork 0

deps: update zenolith

This commit is contained in:
LordMZTE 2024-02-09 22:25:34 +01:00
parent f0b5f244af
commit ece4902a79
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
2 changed files with 12 additions and 10 deletions

View file

@ -9,9 +9,8 @@
.dependencies = .{ .dependencies = .{
.zenolith = .{ .zenolith = .{
//.path = "../zenolith", .url = "git+https://git.mzte.de/zenolith/zenolith.git#6f318242d7bb5dad079e5ad6421900744e5d03b4",
.url = "git+https://git.mzte.de/zenolith/zenolith.git#c4ae23938d9f64ffd8dd0662314f7b478818547a", .hash = "122034a7efb688149b6251c939407e31b1574de418c947a9b25478957d91aad69f5f",
.hash = "1220aa2f21fb19b4cb741e0709e84308a4d079f446dd655827206b0f834da8efa350",
}, },
.sdl2 = .{ .sdl2 = .{

View file

@ -65,11 +65,10 @@ pub fn getGlyph(self: *Sdl2Font, codepoint: u21, style: zenolith.text.Style) !ze
return glyph; return glyph;
} }
pub fn yOffset(self: *Sdl2Font, size: u31) u31 { pub fn heightMetrics(self: *Sdl2Font, size: u31) zenolith.text.HeightMetrics {
_ = self; if (c.FT_Set_Pixel_Sizes(self.face, 0, @intCast(size)) != 0)
// What is supposed to work: // TODO: WONK
//if (c.FT_Set_Pixel_Sizes(self.face, 0, @intCast(size)) != 0) @panic("Unable to FT_Set_Pixel_Sizes for determining height metrics");
// @panic("Unable to FT_Set_Pixel_Sizes for determining y offset");
// All these produce equally nonsensical results and there seems to be no consensus which one is actually correct: // All these produce equally nonsensical results and there seems to be no consensus which one is actually correct:
//return @intCast(self.face.*.size.*.metrics.height >> 6); //return @intCast(self.face.*.size.*.metrics.height >> 6);
@ -77,8 +76,12 @@ pub fn yOffset(self: *Sdl2Font, size: u31) u31 {
//return @intCast((c.FT_MulFix(self.face.*.bbox.yMax, self.face.*.size.*.metrics.y_scale) >> 6) - //return @intCast((c.FT_MulFix(self.face.*.bbox.yMax, self.face.*.size.*.metrics.y_scale) >> 6) -
// (c.FT_MulFix(self.face.*.bbox.yMin, self.face.*.size.*.metrics.y_scale) >> 6)); // (c.FT_MulFix(self.face.*.bbox.yMin, self.face.*.size.*.metrics.y_scale) >> 6));
// What actually works: const bpad: u31 = @intCast(@max(0, -(self.face.*.size.*.metrics.descender >> 6)));
return size;
return .{
.y_offset = size,
.bottom_padding = bpad,
};
} }
fn getSize(self: *Sdl2Font) zenolith.layout.Size { fn getSize(self: *Sdl2Font) zenolith.layout.Size {