Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-dropped-kerns
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Oct 31, 2024
2 parents 4176632 + 5d14e33 commit c20cc1c
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 26 deletions.
99 changes: 85 additions & 14 deletions tests/data/RTL_kerning_v3.glyphs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
.appVersion = "3149";
.appVersion = "3324";
.formatVersion = 3;
DisplayStrings = (
"אב",
Expand Down Expand Up @@ -43,6 +43,7 @@ name = Regular;
axesValues = (
100
);
iconName = Bold;
id = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
metricValues = (
{
Expand All @@ -68,7 +69,9 @@ name = Bold;
glyphs = (
{
glyphname = A;
lastChange = "2022-12-13 14:06:47 +0000";
kernLeft = A;
kernRight = A;
lastChange = "2024-10-31 10:36:16 +0000";
layers = (
{
layerId = m01;
Expand All @@ -83,20 +86,30 @@ unicode = 65;
},
{
glyphname = B;
lastChange = "2024-10-31 10:35:36 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 66;
},
{
glyphname = C;
lastChange = "2024-10-31 10:35:36 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 67;
Expand Down Expand Up @@ -167,69 +180,113 @@ unicode = 1488;
},
{
glyphname = "bet-hb";
kernLeft = leftBet;
kernRight = rightBet;
lastChange = "2022-02-21 11:18:27 +0000";
lastChange = "2024-10-31 10:43:24 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 1489;
},
{
glyphname = "he-hb";
lastChange = "2022-02-17 09:36:21 +0000";
lastChange = "2024-10-31 10:35:36 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 1492;
},
{
glyphname = "one-ar";
kernLeft = "left-one-ar";
lastChange = "2022-02-21 14:41:31 +0000";
glyphname = space;
lastChange = "2024-10-31 10:35:36 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 1633;
unicode = 32;
},
{
glyphname = "one-ar.wide";
glyphname = quotesingle;
kernLeft = quotesingle;
kernRight = quotesingle;
lastChange = "2024-10-31 10:43:13 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 39;
},
{
glyphname = "one-ar";
kernLeft = "left-one-ar";
lastChange = "2022-02-21 14:56:37 +0000";
lastChange = "2024-10-31 10:35:36 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 1633;
},
{
glyphname = one;
glyphname = "one-ar.wide";
kernLeft = "left-one-ar";
lastChange = "2024-10-31 10:35:36 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 49;
},
{
glyphname = space;
glyphname = one;
lastChange = "2024-10-31 10:35:36 +0000";
layers = (
{
layerId = m01;
width = 600;
},
{
layerId = "B0D53B35-34A4-475E-9EF4-52C3D10908C6";
width = 600;
}
);
unicode = 32;
unicode = 49;
}
);
instances = (
Expand All @@ -243,15 +300,29 @@ instanceInterpolations = {
name = Regular;
}
);
kerningLTR = {
m01 = {
"@MMK_L_A" = {
"@MMK_R_quotesingle" = -49;
};
"@MMK_L_quotesingle" = {
"@MMK_R_A" = -49;
};
};
};
kerningRTL = {
m01 = {
"@MMK_R_leftAlef" = {
"@MMK_L_rightBet" = -20;
"he-hb" = 4;
};
"@MMK_R_leftBet" = {
"@MMK_L_quotesingle" = -30;
"@MMK_L_rightAlef" = 20;
};
"@MMK_R_quotesingle" = {
"@MMK_L_rightBet" = -20;
};
"@MMK_R_reh-ar" = {
"@MMK_L_hah-ar.init.swsh" = -50;
};
Expand Down
40 changes: 28 additions & 12 deletions tests/glyphs3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,34 @@ def test_glyphs3_rtl_kerning(datadir, ufo_module):
designspace = glyphsLib.to_designspace(original_glyphs_font, ufo_module=ufo_module)
first_derivative_ufos = [source.font for source in designspace.sources]

print(first_derivative_ufos[0].groups)
assert first_derivative_ufos[0].groups["public.kern1.reh-ar"] == ["reh-ar"]
assert first_derivative_ufos[0].groups["public.kern2.hah-ar.init.swsh"] == [
"hah-ar.init.swsh"
]
assert (
first_derivative_ufos[0].kerning[
("public.kern1.reh-ar", "public.kern2.hah-ar.init.swsh")
]
== -50
)
assert first_derivative_ufos[0].kerning[("he-hb", "he-hb")] == -21
assert first_derivative_ufos[0].groups == {
"public.kern1.A": ["A"],
"public.kern2.A": ["A"],
"public.kern1.quotesingle": ["quotesingle"],
"public.kern2.quotesingle": ["quotesingle"],
"public.kern1.hah-ar.init": ["hah-ar.init"],
"public.kern2.hah-ar.init.swsh": ["hah-ar.init.swsh"],
"public.kern2.left-one-ar": ["one-ar", "one-ar.wide"],
"public.kern1.reh-ar": ["reh-ar"],
"public.kern1.leftAlef": ["alef-hb"],
"public.kern1.leftBet": ["bet-hb"],
"public.kern2.rightBet": ["bet-hb"],
}
assert first_derivative_ufos[0].kerning == {
("public.kern1.A", "public.kern2.quotesingle"): -49,
# the (@quotesingle, @A) pair should not be overwritten by the
# (@quotesingle, @rightBet), both can co-exist in the combined kerning
# https://github.com/googlefonts/glyphsLib/issues/1039
("public.kern1.quotesingle", "public.kern2.A"): -49,
("public.kern1.quotesingle", "public.kern2.rightBet"): -20,
("public.kern1.leftBet", "public.kern2.quotesingle"): -30,
("public.kern1.leftBet", "public.kern2.rightAlef"): 20,
("public.kern1.leftAlef", "public.kern2.rightBet"): -20,
("public.kern1.leftAlef", "he-hb"): 4,
("public.kern1.reh-ar", "public.kern2.hah-ar.init.swsh"): -50,
("he-hb", "public.kern2.rightAlef"): -2,
("he-hb", "he-hb"): -21,
}

# Round-tripping back to Glyphs
round_tripped_glyphs_font = glyphsLib.to_glyphs(first_derivative_ufos)
Expand Down

0 comments on commit c20cc1c

Please sign in to comment.