Skip to content

Commit

Permalink
Make lam after alef shorter when spacing is compact
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Jan 8, 2024
1 parent 7c99302 commit b44cd8d
Show file tree
Hide file tree
Showing 14 changed files with 246 additions and 76 deletions.
Binary file modified docs/assets/fonts/Raqq.woff2
Binary file not shown.
Binary file modified fonts/Raqq.ttf
Binary file not shown.
Binary file modified fonts/Raqq.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion requirements-test.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fontbakery[shaping,googlefonts]
fontbakery[shaping,googlefonts] @ git+https://github.com/fonttools/fontbakery@shaping-variations
6 changes: 4 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ filelock==3.13.1
# via youseedee
font-v==2.1.0
# via fontbakery
fontbakery==0.10.8
# via -r requirements-test.in
fontbakery @ git+https://github.com/fonttools/fontbakery@shaping-variations
# via
# -r requirements-test.in
# fontbakery
fontfeatures==1.8.0
# via babelfont
fonttools==4.47.0
Expand Down
12 changes: 11 additions & 1 deletion scripts/update-shaping-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ def parsefeatures(text):
return features


def shape(font, text, direction, script, language, features):
def shape(font, text, direction, script, language, features, variations):
buffer = hb.Buffer()
buffer.add_str(text)
buffer.direction = direction
buffer.script = script
if language:
buffer.language = language

old_variations = font.get_var_coords_normalized()
if variations:
font.set_variations(variations)

hb.shape(font, buffer, features)

output = []
Expand All @@ -52,6 +56,9 @@ def shape(font, text, direction, script, language, features):
glyph += f",{pos.y_advance}"
output.append(glyph)

if variations:
font.set_var_coords_normalized(old_variations)

return "|".join(output)


Expand All @@ -66,13 +73,16 @@ def main(rags):
test = {k: v for k, v in test.items() if v}
if features := test.get("features"):
test["features"] = parsefeatures(features)
if variations := test.get("variations"):
test["variations"] = parsefeatures(variations)
test["expectation"] = shape(
font,
test.get("input"),
test.get("direction", "rtl"),
test.get("script", "arab"),
test.get("language"),
test.get("features"),
test.get("variations"),
)
tests.append(test)

Expand Down
22 changes: 22 additions & 0 deletions sources/Raqq.glyphspackage/fontinfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classes = (
code = "$[name LIKE \"*-ar\" && category == \"Letter\" && ! colorIndex == 0 &&
name != \"kashida-ar\" && name != \"hamza-ar\"]
lam-ar.short
period
threedots-ar
zerowidthspace
Expand Down Expand Up @@ -666,6 +667,8 @@ lookup short_lam {
sub lam-ar.medi by lam-ar.medi.short;
sub lam-ar.medi.round by lam-ar.medi.round.short;
sub alef-ar.fina by alef-ar.fina.short;
sub lam-ar by lam-ar.short;
sub lam-ar.init by lam-ar.init.short;
} short_lam;
lookup yehbarree_baseline {
Expand Down Expand Up @@ -712,6 +715,23 @@ lookup rlig_4 {
@aftermeem' lookup rounded;
;
} rlig_4;
conditionset compact {
SPAC -100 -95;
} compact;
variation rlig compact {
lookupflag IgnoreMarks;
ignore
sub [alef-ar alef-ar.fina fehDotless_alef-ar]
[lam-ar lam-ar.init]'
[lam-ar.medi.short lam-ar.medi.round.short lam-ar.fina.short]
;
sub [alef-ar alef-ar.fina fehDotless_alef-ar]
[lam-ar lam-ar.init]' lookup short_lam
;
} rlig;
";
name = misc;
},
Expand Down Expand Up @@ -1581,7 +1601,9 @@ _c.hah.noon = -25;
"seen-ar.medi.low" = -10;
};
"fehDotless_alef-ar" = {
"@MMK_L_lam" = -8;
"alef-ar" = -7;
"lam-ar.short" = -17;
};
"hah-ar.init" = {
"lam_alef-ar.fina" = -57;
Expand Down
53 changes: 6 additions & 47 deletions sources/Raqq.glyphspackage/glyphs/lam-ar.fina.short.glyph
Original file line number Diff line number Diff line change
Expand Up @@ -37,55 +37,14 @@ scale = (5,5);
layerId = m01;
shapes = (
{
closed = 1;
nodes = (
(175,-234,o),
(186,-222,o),
(186,-198,cs),
(186,-93,o),
(178,11,o),
(177,78,c),
(172,263,o),
(169,475,o),
(158,671,cs),
(157,694,o),
(143,700,o),
(133,681,cs),
(121,658,o),
(82,624,o),
(64,610,cs),
(49,597,o),
(55,584,o),
(56,574,cs),
(70,413,o),
(88,83,o),
(99,-166,c),
(119,-135,l),
(77,-145,o),
(40,-142,o),
(7,-131,cs),
(-1,-129,o),
(-11,-126,o),
(-17,-133,cs),
(-41,-162,o),
(-62,-192,o),
(-91,-211,cs),
(-104,-220,o),
(-109,-233,o),
(-96,-240,cs),
(-12,-283,o),
(91,-283,o),
(159,-243,cs)
);
alignment = -1;
ref = "lam-ar.short";
},
{
closed = 1;
nodes = (
(190,0,l),
(190,110,l),
(118,110,l),
(118,0,l)
);
alignment = -1;
pos = (130,0);
ref = _p.lam;
scale = (0.6,1);
}
);
width = 178;
Expand Down
27 changes: 3 additions & 24 deletions sources/Raqq.glyphspackage/glyphs/lam-ar.init.hah1.glyph
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,9 @@ scale = (5,5);
layerId = m01;
shapes = (
{
closed = 1;
nodes = (
(18,115,l),
(92,117,o),
(127,123,o),
(123,231,cs),
(118,378,o),
(107,590,o),
(98,786,cs),
(97,809,o),
(83,815,o),
(73,796,cs),
(61,773,o),
(22,739,o),
(4,725,cs),
(-11,712,o),
(-5,699,o),
(-4,689,cs),
(6,528,o),
(16,354,o),
(18,225,c),
(-20,225,l),
(-20,115,l)
);
alignment = -1;
pos = (0,115);
ref = "lam-ar.init.short";
}
);
width = 123;
Expand Down
66 changes: 66 additions & 0 deletions sources/Raqq.glyphspackage/glyphs/lam-ar.init.short.glyph
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
glyphname = "lam-ar.init.short";
kernLeft = lam;
kernRight = lam;
layers = (
{
anchors = (
{
name = damma;
pos = (5,173);
},
{
name = exit;
},
{
name = fatha;
pos = (-54,520);
},
{
name = kasra;
pos = (123,-36);
}
);
backgroundImage = {
alpha = 80;
angle = -0.1;
imagePath = "images/MS-ADD-01116-000-00003.jpg";
locked = 1;
pos = (-3157,-1867);
scale = (5,5);
};
layerId = m01;
shapes = (
{
closed = 1;
nodes = (
(18,0,l),
(92,2,o),
(127,8,o),
(123,116,cs),
(118,263,o),
(107,475,o),
(98,671,cs),
(97,694,o),
(83,700,o),
(73,681,cs),
(61,658,o),
(22,624,o),
(4,610,cs),
(-11,597,o),
(-5,584,o),
(-4,574,cs),
(6,413,o),
(16,239,o),
(18,110,c),
(-20,110,l),
(-20,0,l)
);
}
);
width = 123;
}
);
metricLeft = "=-20@0";
metricRight = "=0";
}
78 changes: 78 additions & 0 deletions sources/Raqq.glyphspackage/glyphs/lam-ar.short.glyph
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
glyphname = "lam-ar.short";
kernLeft = lam.fina;
layers = (
{
anchors = (
{
name = damma;
pos = (33,56);
},
{
name = fatha;
pos = (3,509);
},
{
name = kasra;
pos = (246,-135);
}
);
backgroundImage = {
alpha = 80;
angle = -0.2;
imagePath = "images/MS-ADD-01116-000-00005.jpg";
locked = 1;
pos = (-4737,-1764);
scale = (5,5);
};
layerId = m01;
shapes = (
{
closed = 1;
nodes = (
(175,-234,o),
(186,-222,o),
(186,-198,cs),
(186,-93,o),
(178,11,o),
(177,78,c),
(172,263,o),
(169,475,o),
(158,671,cs),
(157,694,o),
(143,700,o),
(133,681,cs),
(121,658,o),
(82,624,o),
(64,610,cs),
(49,597,o),
(55,584,o),
(56,574,cs),
(70,413,o),
(88,83,o),
(99,-166,c),
(119,-135,l),
(77,-145,o),
(40,-142,o),
(7,-131,cs),
(-1,-129,o),
(-11,-126,o),
(-17,-133,cs),
(-41,-162,o),
(-62,-192,o),
(-91,-211,cs),
(-104,-220,o),
(-109,-233,o),
(-96,-240,cs),
(-12,-283,o),
(91,-283,o),
(159,-243,cs)
);
}
);
width = 186;
}
);
metricLeft = "=-100@-220";
metricRight = "=0";
}
2 changes: 2 additions & 0 deletions sources/Raqq.glyphspackage/order.plist
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ space,
"kaf-ar.init",
"kaf-ar.init.alt",
"lam-ar",
"lam-ar.short",
"lam-ar.fina",
"lam-ar.fina.short",
"lam-ar.medi",
Expand All @@ -81,6 +82,7 @@ space,
"lam-ar.init.hah1.alt",
"lam-ar.init.hah2",
"lam-ar.init.hah2.alt",
"lam-ar.init.short",
"meem-ar",
"meem-ar.fina",
"meem-ar.fina.round",
Expand Down
Loading

0 comments on commit b44cd8d

Please sign in to comment.