mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
fix: sCapHeight and sxHeight only exist when OS/2 version >= 2
This commit is contained in:
@ -775,11 +775,14 @@ pub const Face = struct {
|
|||||||
// available, otherwise we try to measure the `H` and `x` glyphs.
|
// available, otherwise we try to measure the `H` and `x` glyphs.
|
||||||
const cap_height: ?f64, const ex_height: ?f64 = heights: {
|
const cap_height: ?f64, const ex_height: ?f64 = heights: {
|
||||||
if (maybe_os2) |os2| {
|
if (maybe_os2) |os2| {
|
||||||
|
// The OS/2 table does not include these metrics in version 1.
|
||||||
|
if (os2.version >= 2) {
|
||||||
break :heights .{
|
break :heights .{
|
||||||
@as(f64, @floatFromInt(os2.sCapHeight)) * px_per_unit,
|
@as(f64, @floatFromInt(os2.sCapHeight)) * px_per_unit,
|
||||||
@as(f64, @floatFromInt(os2.sxHeight)) * px_per_unit,
|
@as(f64, @floatFromInt(os2.sxHeight)) * px_per_unit,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break :heights .{
|
break :heights .{
|
||||||
cap: {
|
cap: {
|
||||||
if (face.getCharIndex('H')) |glyph_index| {
|
if (face.getCharIndex('H')) |glyph_index| {
|
||||||
|
Reference in New Issue
Block a user