From 98a85c5885579bc249dab1003024260f35ce25a6 Mon Sep 17 00:00:00 2001 From: Santhosh Thottingal Date: Fri, 29 Sep 2023 13:57:52 +0530 Subject: [PATCH] =?UTF-8?q?Remove=20dotted=20circle=20for=20=E0=B4=BE?= =?UTF-8?q?=E0=B4=82=20rendering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- "sources/glyphs/\340\264\276\340\264\202.mp" | 37 ++++++++++++++++++++ "sources/glyphs/\342\227\214.mp" | 19 ++++++++++ tools/malayalamfont.py | 18 ++++++++++ tools/svgglyph.py | 1 + 4 files changed, 75 insertions(+) create mode 100644 "sources/glyphs/\340\264\276\340\264\202.mp" create mode 100644 "sources/glyphs/\342\227\214.mp" diff --git "a/sources/glyphs/\340\264\276\340\264\202.mp" "b/sources/glyphs/\340\264\276\340\264\202.mp" new file mode 100644 index 00000000..b48d1571 --- /dev/null +++ "b/sources/glyphs/\340\264\276\340\264\202.mp" @@ -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; diff --git "a/sources/glyphs/\342\227\214.mp" "b/sources/glyphs/\342\227\214.mp" new file mode 100644 index 00000000..90f24088 --- /dev/null +++ "b/sources/glyphs/\342\227\214.mp" @@ -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; diff --git a/tools/malayalamfont.py b/tools/malayalamfont.py index c07cb741..8188d147 100644 --- a/tools/malayalamfont.py +++ b/tools/malayalamfont.py @@ -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" @@ -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() diff --git a/tools/svgglyph.py b/tools/svgglyph.py index 51f1ba2b..f658908f 100644 --- a/tools/svgglyph.py +++ b/tools/svgglyph.py @@ -49,6 +49,7 @@ "dotlessj": 0x0237, "jcaron": 0x01F0, "notdef": 0, + "uni25CC": 0x25CC, } UV2AGL_EXTRA = { 0x0326: "commaaccent",