diff --git a/tests/data/RTL_kerning_v3.glyphs b/tests/data/RTL_kerning_v3.glyphs index 627a34c74..c2f129798 100644 --- a/tests/data/RTL_kerning_v3.glyphs +++ b/tests/data/RTL_kerning_v3.glyphs @@ -1,5 +1,5 @@ { -.appVersion = "3149"; +.appVersion = "3324"; .formatVersion = 3; DisplayStrings = ( "אב", @@ -43,6 +43,7 @@ name = Regular; axesValues = ( 100 ); +iconName = Bold; id = "B0D53B35-34A4-475E-9EF4-52C3D10908C6"; metricValues = ( { @@ -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; @@ -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; @@ -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 = ( @@ -243,6 +300,16 @@ instanceInterpolations = { name = Regular; } ); +kerningLTR = { +m01 = { +"@MMK_L_A" = { +"@MMK_R_quotesingle" = -49; +}; +"@MMK_L_quotesingle" = { +"@MMK_R_A" = -49; +}; +}; +}; kerningRTL = { m01 = { "@MMK_R_leftAlef" = { @@ -250,8 +317,12 @@ m01 = { "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; }; diff --git a/tests/glyphs3_test.py b/tests/glyphs3_test.py index b2f7479db..2c1c49329 100644 --- a/tests/glyphs3_test.py +++ b/tests/glyphs3_test.py @@ -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)