Skip to content

Commit

Permalink
Remove dotted circle for ാം rendering
Browse files Browse the repository at this point in the history
This has been a recurrent issue for the users. While browser and most
modern applications use recent shaping engines that remove the dotted circle,
applications like libreoffice has this issue unresolved for long time.

Here, remove the dotted circle if followed by aa sign and anuswara. This
rule will be picked up only if shaping engines had not removed the dotted
circle.
  • Loading branch information
santhoshtr committed Sep 29, 2023
1 parent 6719c04 commit 98a85c5
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
37 changes: 37 additions & 0 deletions sources/glyphs/ാം.mp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
input glyph;
beginglyph;
slant_ := tand(-8);
height_correction := thick/4;
z0=(0, m/2);
z1=(x0 + mw/3, m - height_correction);
z2=(x1 + mw/3, y0);
z3=(x2 - mw/3, height_correction);
paths[0] = z0 .. z1.. z2 .. z3 .. cycle;
paths[0] := paths[0] xyscaled(1,1) slanted slant_;
paths[0]:= paths[0] shifted (-slant_*m/2, 0);
paths[0]:= subpath(.3, 2.9) of paths[0] .. {dir 120}(x0, y0 - m/4);

pen_stroke(
nib(thinnib)(2)
nib(terminalnib rotated terminalangle 0 of paths[0])(0)
nib(terminalnib rotated terminalangle infinity of paths[0])(infinity)
)(paths[0])(strokes[0]);

clearxy;
z0=(0, (y1+y3)/2);
z1=((x2+x0)/2, m/2);
z2=(x0+mw/2.25 , y0);
z3=(x1, 0);
z4=(x0, y0);

paths[1] = z0{dir 90}..z1{dir 4}..z2{dir 266}..z3{dir 184}..{dir 90}z0;
paths[1] := reverse paths[1];
paths[1] := paths[1] shifted (xpart(point 2 of paths[0]) + 2thick,0);

pen_stroke(
nib(thicknib)(1, 3)
nib(thinnib)(0, 2, 4)
)(paths[1])(strokes[1]);


endglyph;
19 changes: 19 additions & 0 deletions sources/glyphs/◌.mp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
input glyph;
beginglyph;

clearxy;
z0=(0, (y1+y3)/2);
z1=((x2+x0)/2, m);
z2=(x0+mw , y0);
z3=(x1, 0);
z4=(x0, y0);

path fpath; fpath:= z0{dir 90}..z1{dir 4}..z2{dir 266}..z3{dir 184}..{dir 90}z0;
soften:=0;
for j=0 upto 3:
paths[j] := subpath(j, j + .5) of fpath;
pen_stroke( cut(thinnib, rel 90)(0,1, 2))(paths[j])(strokes[j]);
endfor;


endglyph;
18 changes: 18 additions & 0 deletions tools/malayalamfont.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,23 @@ def build_cons_ra_substitutions(self):
routine = Routine(rules=rules, name=name, languages=LANGUAGE_MALAYALAM)
self.fontFeatures.addFeature(feature, [routine])

def build_aam_sign(self):
"""
Remove dotted circle from aam sign 'ാം'
"""
feature = "akhn"
name = "remove_dotted_circle"

ligature_glyph_name = SVGGlyph.get_glyph_name("ാം")
sub = Substitution(
[[SVGGlyph.get_glyph_name("◌")], [SVGGlyph.get_glyph_name("ാ")], [SVGGlyph.get_glyph_name("ം")]],
replacement=[[ligature_glyph_name]],
)
rules = [sub]

routine = Routine(rules=rules, name=name, languages=LANGUAGE_MALAYALAM)
self.fontFeatures.addFeature(feature, [routine])

def build_cons_conj_vowel_signs(self):
feature = "psts"
name = "psts_vowel_signs"
Expand Down Expand Up @@ -553,6 +570,7 @@ def buildFeatures(self):
self.build_ra_sign()
self.build_cons_ra_substitutions()
self.build_cons_conj_vowel_signs()
self.build_aam_sign()
self.build_kern()
self.build_gpos()
self.build_gdef()
Expand Down
1 change: 1 addition & 0 deletions tools/svgglyph.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"dotlessj": 0x0237,
"jcaron": 0x01F0,
"notdef": 0,
"uni25CC": 0x25CC,
}
UV2AGL_EXTRA = {
0x0326: "commaaccent",
Expand Down

0 comments on commit 98a85c5

Please sign in to comment.