Skip to content

Commit

Permalink
Use TypeTuner for the language specific nuktas
Browse files Browse the repository at this point in the history
  • Loading branch information
devosb committed Feb 3, 2023
1 parent d6f465d commit da3bc53
Show file tree
Hide file tree
Showing 12 changed files with 1,002 additions and 893 deletions.
11 changes: 11 additions & 0 deletions source/master.feax
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,20 @@ lookup cv01 {
feature ccmp {
lookup FontCheck;
# lookup NuktaLigs;

# InDesign will fire here for Tamil nukta (and for Latin script),
# but is overridden by the locl feature below.
# DirectWrite will fire here, but only for U+1133C, and not for Latin script
} ccmp;

feature locl {
# Notepad, Word, and InDesign will all fire here.

# If using the language specific code Notepad fires with
# - script tml2 and language dflt for U+0323 and U+1133B
# - script DFLT and language dflt for U+1133C
# Not sure how Word and InDesign handle the language specific code

script DFLT;
language IRU;
lookup NuktaIRU;
Expand Down
23 changes: 1 addition & 22 deletions source/master.gdl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ table(feature)
nuka
{
id = "cv01";
name.LG_USENG = string("Double and single nuktas");
name.LG_USENG = string("Nukta forms");
default = ring;
settings
{
Expand All @@ -35,26 +35,6 @@ nuka
}
}

snuk
{
id = "cv02";
name.LG_USENG = string("Single nukta (future)");
default = dot;
settings
{
dot
{
value = 0;
name.LG_USENG = string("Single dot");
}
ring
{
value = 1;
name.LG_USENG = string("Single ring");
}
}
}

endtable;

table(language)
Expand All @@ -77,7 +57,6 @@ irula {
chetti {
languages = ("ctt");
nuka = dot;
snuk = ring;
}

endtable;
Expand Down
47 changes: 47 additions & 0 deletions source/typetuner/feat_all.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- © SIL International 2007 -->

<!-- DOCTYPE all_features SYSTEM "feat_all.dtd" --> <!-- put at top of XML file to validate -->

<!ELEMENT all_features (feature+, interactions?, cmd_blocks?, aliases?, old_names?)>
<!ATTLIST all_features
version CDATA #REQUIRED>
<!ELEMENT feature (value+)>
<!ATTLIST feature
name CDATA #REQUIRED
value CDATA #REQUIRED
tag CDATA #REQUIRED>
<!ELEMENT value (cmd | cmds)+>
<!ATTLIST value
name CDATA #REQUIRED
tag CDATA #REQUIRED>
<!ELEMENT cmd EMPTY>
<!ATTLIST cmd
name CDATA #REQUIRED
args CDATA #REQUIRED>
<!ELEMENT cmds EMPTY>
<!ATTLIST cmds
name CDATA #REQUIRED>
<!ELEMENT interactions (test*)>
<!ELEMENT test (cmd | cmds)+>
<!ATTLIST test
select CDATA #REQUIRED>
<!ELEMENT cmd_blocks (cmd_block*)>
<!ELEMENT cmd_block (cmd | cmds)+>
<!ATTLIST cmd_block
name CDATA #REQUIRED>
<!ELEMENT aliases (alias*)>
<!ELEMENT alias EMPTY>
<!ATTLIST alias
name CDATA #REQUIRED
value CDATA #REQUIRED>
<!ELEMENT old_names (old_feature | old_value)+>
<!ELEMENT old_feature EMPTY>
<!ATTLIST old_feature
name CDATA #REQUIRED
tag CDATA #REQUIRED>
<!ELEMENT old_value EMPTY>
<!ATTLIST old_value
feature CDATA #REQUIRED
name CDATA #REQUIRED
tag CDATA #REQUIRED>
19 changes: 19 additions & 0 deletions source/typetuner/feat_all.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE all_features SYSTEM "feat_all.dtd">
<all_features version="1.0">
<feature name="Language" value="Default" tag="Lng">
<value name="Default" tag="Def">
<cmd name="null" args="null"/>
</value>
<value name="Irula" tag="Iru">
<cmd name="encode" args="0323 u1133C.ringdbl"/>
<cmd name="encode" args="1133B u1133C.ringdbl"/>
<cmd name="encode" args="1133C u1133C.ringdbl"/>
</value>
<value name="Chetti" tag="Ctt">
<cmd name="encode" args="0323 u1133C.dot"/>
<cmd name="encode" args="1133B u1133C.dot"/>
<cmd name="encode" args="1133C u1133C.dot"/>
</value>
</feature>
</all_features>
19 changes: 19 additions & 0 deletions source/typetuner/feat_set.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- DOCTYPE all_features SYSTEM "feat_all.dtd" --> <!-- put at top of XML file to validate -->

<!ELEMENT features_set (feature+, imported_line_metrics?)>
<!ATTLIST features_set
version CDATA #REQUIRED>
<!ELEMENT feature (value+)>
<!ATTLIST feature
name CDATA #REQUIRED
value CDATA #REQUIRED>
<!ELEMENT value EMPTY>
<!ATTLIST value
name CDATA #REQUIRED>
<!ELEMENT imported_line_metrics EMPTY>
<!ATTLIST imported_line_metrics
font CDATA #REQUIRED
em-sqr CDATA #REQUIRED
metrics CDATA #REQUIRED>
9 changes: 9 additions & 0 deletions source/typetuner/feat_set_ctt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE features_set SYSTEM "feat_set.dtd">
<features_set version="1.0">
<feature name="Language" value="Chetti">
<value name="Default"/>
<value name="Irula"/>
<value name="Chetti"/>
</feature>
</features_set>
9 changes: 9 additions & 0 deletions source/typetuner/feat_set_iru.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE features_set SYSTEM "feat_set.dtd">
<features_set version="1.0">
<feature name="Language" value="Irula">
<value name="Default"/>
<value name="Irula"/>
<value name="Chetti"/>
</feature>
</features_set>
1,622 changes: 811 additions & 811 deletions tests/nuktas.ftml

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions tools/psfgenftml.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,22 @@ def setBackgroundColor(uids):
ftml.closeTest()

if test.lower().startswith("nuktas"):
ftml.startTestGroup('Nukta codepoints')
test_name = test.lower().split()[0]
with open(f'tests/{test_name}.template') as nuktas:
line_number = 0
for line in nuktas:
line = line.strip()
line_number += 1
if line == '':
continue
for n in below_marks:
for v in above_marks:
text = line.replace('N', chr(n))
text = text.replace('V', chr(v))
ftml.addToTest(None, text, label=f'line {line_number}', comment=f'n={n:04X} v={v:04X}')
ftml.closeTest()

ftml.startTestGroup('Akhands with nukta')
for a in akhands:
c = a[0]
Expand Down Expand Up @@ -273,22 +289,6 @@ def setBackgroundColor(uids):
builder.render((a+(nukta,)+(m,)+(nukta,)), ftml, label=f'{c:04X}', comment=builder.char(c).basename)
ftml.closeTest()

ftml.startTestGroup('Nukta codepoints')
test_name = test.lower().split()[0]
with open(f'tests/{test_name}.template') as nuktas:
line_number = 0
for line in nuktas:
line = line.strip()
line_number += 1
if line == '':
continue
for n in below_marks:
for v in above_marks:
text = line.replace('N', chr(n))
text = text.replace('V', chr(v))
ftml.addToTest(None, text, label=f'line {line_number}', comment=f'n={n:04X} v={v:04X}')
ftml.closeTest()

if test.lower().startswith("extra"):
ftml.startTestGroup('Akhands with nukta')
for mp in matra_plus:
Expand Down
17 changes: 5 additions & 12 deletions web/ThiruValluvar-webfont-example.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
/*
ThiruValluvar-webfont-example.css
ThiruValluvar
This file is part of ThiruValluvar font family (http://www.nlci.in/fonts/).
This file is part of ThiruValluvar font project (http://www.nlci.in/fonts/).
This Font Software is Copyright (c) 2009-2023, NLCI (http://www.nlci.in/fonts/)
with Reserved Font Names "ThiruValluvar" and "Auvaiyar" and "Vaigai" and "NLCI".
Latin glyphs Copyright (c) 2003-2013, SIL International (http://www.sil.org/)
Latin glyphs in ThiruValluvar and Auvaiyar are Copyright (c) 2003-2019, SIL International (http://www.sil.org/)
with Reserved Font Names "Gentium" and "SIL".
Additional Latin glyphs Copyright (c) 1997-2014, SIL International (http://www.sil.org/)
Latin glyphs in Vaigai are Copyright (c) 1997-2019, SIL International (http://www.sil.org/)
with Reserved Font Names "Charis" and "SIL".
Indian Rupee Sign Copyright (c) 2007-2017, SIL International (http://www.sil.org/)
with Reserved Font Names "Annapurna" and "SIL".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
You should have received a copy of the license along with this Font Software.
If this is not the case, go to (http://scripts.sil.org/OFL) for all the details including a FAQ.
This Font Software is licensed under the SIL Open Font License,
Version 1.1 (http://scripts.sil.org/OFL).
*/

/* use ThiruValluvar - Regular in .woff format */
Expand Down
83 changes: 52 additions & 31 deletions web/ThiruValluvar-webfont-example.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
<!DOCTYPE html>
<html>
<!--
ThiruValluvar-webfont-example.html
ThiruValluvar
This file is part of ThiruValluvar font family (http://www.nlci.in/fonts/).
This file is part of ThiruValluvar font project (http://www.nlci.in/fonts/).
This Font Software is Copyright (c) 2009-2023, NLCI (http://www.nlci.in/fonts/)
with Reserved Font Names "ThiruValluvar" and "Auvaiyar" and "Vaigai" and "NLCI".
Latin glyphs Copyright (c) 2003-2013, SIL International (http://www.sil.org/)
Latin glyphs in ThiruValluvar and Auvaiyar are Copyright (c) 2003-2019, SIL International (http://www.sil.org/)
with Reserved Font Names "Gentium" and "SIL".
Additional Latin glyphs Copyright (c) 1997-2014, SIL International (http://www.sil.org/)
Latin glyphs in Vaigai are Copyright (c) 1997-2019, SIL International (http://www.sil.org/)
with Reserved Font Names "Charis" and "SIL".
Indian Rupee Sign Copyright (c) 2007-2017, SIL International (http://www.sil.org/)
with Reserved Font Names "Annapurna" and "SIL".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
You should have received a copy of the license along with this Font Software.
If this is not the case, go to (http://scripts.sil.org/OFL) for all the details including a FAQ.
This Font Software is licensed under the SIL Open Font License,
Version 1.1 (http://scripts.sil.org/OFL).
-->
<head>
<link rel="stylesheet" href="ThiruValluvar-webfont-example.css" type="text/css">
Expand All @@ -29,50 +22,78 @@

<h1>Using ThiruValluvar webfonts</h1>
<p>RenderingUnknown.</p>
<p>The page demonstrates how to use the WOFF version of ThiruValluvar for web pages, using local copies of the .woff files in this archive. For more information on this technique
- and how to use the normal TrueType version as a web font - see <a href="http://scripts.sil.org/using_web_fonts">Using SIL Fonts on Web Pages</a>.</p>

<p>The body of this document is styled using an external stylesheet, with ThiruValluvar set as the default font, and loaded directly as a WOFF file using the @font-face rule.
If you're seeing a serif font here then it is working. Otherwise the text will be in a sans-serif or your browser default.
This technique should work only in Firefox 3.6+, Chrome 6, the IE9 beta, and in development versions of Safari.</p>
<p>
The page demonstrates how to use the WOFF2 version of Narnoor for web pages, using local copies of the .woff2 files in this archive.
For more information on this technique - and how to use the normal TrueType version as a web font - see <a href="http://software.sil.org/fonts/webfonts">Using SIL Fonts on Web Pages</a>.
</p>

<p>
The body of this document is styled using an external stylesheet, with ThiruValluvar set as the default font, and loaded directly as a WOFF2 file using the @font-face rule.
If you're seeing a serif font here then it is working. Otherwise the text will be in a sans-serif or your browser default. This technique is supported in all modern browsers.
</p>

<h1>General behavior of Tamil script using webfonts</h1>

<p>To see specifically how these techniques are specified in the CSS and HTML view the source to this page and the accompanying CSS file.</p>
<p>
Tamil sample text (taken from <a href="https://unicode.org/udhr/d/udhr_tam.txt">Universal Declaration of Human Rights - Tamil</a>):
1948 திசெம்பர் மாதம் 10ஆம் தேதி, ஐக்கிய நாடுகள் பொதுச்சபை, மனித உரிமை பற்றிய உலகப் பிரகடனத்தை ஏற்றுச் சாற்றியது. அப்பிரகடனம் மேல்வரும் பக்கங்களில் முற்றுமுழுதாகத் தரப்படுகின்றது. வரலாற்று முக்கியத்துவம் வாய்ந்த அந்நடவடிக்கையின் பின்னர் சபையானது, பிரகடனத்தை வெளியிடுமாறும், அவ்வாறு வெளியிடப் பெற்றதை "நாடுகள் அல்லது ஆள்பலங்களின் அரசியல் அந்தஸ்துக் காரணமாக எவ்வித வேறுபாடுமில்லாவகையில் எல்லாப் பள்ளிகளிலும் பிற கல்வி நிறுவனங்களிலும் பரப்பவும், காட்சிக்கு வைக்கவும், வாசிக்கச் செய்யவும், விளக்கவும்" செயற்படுமாறு அங்கத்துவ நாடுகள் யாவற்றையும் கேட்டுக் கொண்டது.
</p>

<h2>Test general behavior of Tamil script in webfonts</h2>
<h1>Different nukta styles</h1>

<p>Tamil sample text (taken from <a href="https://unicode.org/udhr/d/udhr_tam.txt">Universal Declaration of Human Rights - Tamil</a>):
1948 திசெம்பர் மாதம் 10ஆம் தேதி, ஐக்கிய நாடுகள் பொதுச்சபை, மனித உரிமை பற்றிய உலகப் பிரகடனத்தை ஏற்றுச் சாற்றியது. அப்பிரகடனம் மேல்வரும் பக்கங்களில் முற்றுமுழுதாகத் தரப்படுகின்றது. வரலாற்று முக்கியத்துவம் வாய்ந்த அந்நடவடிக்கையின் பின்னர் சபையானது, பிரகடனத்தை வெளியிடுமாறும், அவ்வாறு வெளியிடப் பெற்றதை "நாடுகள் அல்லது ஆள்பலங்களின் அரசியல் அந்தஸ்துக் காரணமாக எவ்வித வேறுபாடுமில்லாவகையில் எல்லாப் பள்ளிகளிலும் பிற கல்வி நிறுவனங்களிலும் பரப்பவும், காட்சிக்கு வைக்கவும், வாசிக்கச் செய்யவும், விளக்கவும்" செயற்படுமாறு அங்கத்துவ நாடுகள் யாவற்றையும் கேட்டுக் கொண்டது.</p>
<p>
For each type of nukta (single or double, dot or ring), there are three lines of text.
The lines have different codepoints for the nukta. The codepoints used, in order that the lines are in, are U+0323, U+1133B, U+1133C.
</p>

<h1>Test data has U+1133C for the nukta</h1>
<h2>Test character variants</h2>
<h3>cv01</h3>
<p>ring</p>
<p class=cv01x>க𑌼</p>
<p class=cv01x>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cv01x>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cv01x>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

<p>ring [cv01=0]</p>
<p class=cv010>க𑌼</p>
<p class=cv010>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cv010>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cv010>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

<p>dot [cv01=2]</p>
<p class=cv012>க𑌼</p>
<p class=cv012>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cv012>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cv012>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

<p>double ring [cv01=3]</p>
<p class=cv013>க𑌼</p>
<p class=cv013>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cv013>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cv013>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

<p>double dot [cv01=1]</p>
<p class=cv011>க𑌼</p>
<p class=cv011>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cv011>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cv011>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

<h2>Test language specific features</h2>
<p>ring</p>
<p class=cvlng>க𑌼</p>
<p class=cvlng>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cvlng>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cvlng>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

<p>ring</p>
<p class=cvlng lang=xub>க𑌼</p>
<p class=cvlng lang=xub>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cvlng lang=xub>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cvlng lang=xub>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

<p>dot CTT</p>
<p class=cvlng lang=ctt>க𑌼</p>
<p class=cvlng lang=ctt>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cvlng lang=ctt>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cvlng lang=ctt>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

<p>double ring IRU</p>
<p class=cvlng lang=iru>க𑌼</p>
<p class=cvlng lang=iru>கெ̣ க̣ெ க̣ெ̣</p>
<p class=cvlng lang=iru>கெ𑌻 க𑌻ெ க𑌻ெ𑌻</p>
<p class=cvlng lang=iru>கெ𑌼 க𑌼ெ க𑌼ெ𑌼</p>

</div>
</body>
Expand Down
4 changes: 3 additions & 1 deletion wscript
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ for f in faces:
make_params = '-l last -p 1',
params = '-e ${DS:FILENAME_BASE}_gdlerr.txt'
),
typetuner = typetuner('source/typetuner/feat_all.xml'),
#classes = fontbase + 'thiruvalluvar_classes.xml',
ap = generated + '${DS:FILENAME_BASE}.xml',
version = VERSION,
Expand All @@ -135,7 +136,8 @@ for f in faces:
(fontname, dash, remaining) = fontfilename.target.rpartition('-')
langfontfilename = fontname + langname.replace(' ', '') + '-' + remaining
n = font(target = process(langfontfilename,
cmd('psfdeflang -L ' + langcode + ' ${DEP} ${TGT}'),
# cmd('psfdeflang -L ' + langcode + ' ${DEP} ${TGT}'),
cmd('typetuner -o ${TGT} ' + f' applyset ../source/typetuner/feat_set_{langcode}.xml ' + '${DEP}'),
cmd(set_line_spacing(langcode, fontname) + ' ${DEP} ${TGT}'),
name(f + langname)
),
Expand Down

0 comments on commit da3bc53

Please sign in to comment.