-
Notifications
You must be signed in to change notification settings - Fork 5
/
sc_sub.ff
93 lines (88 loc) · 2.84 KB
/
sc_sub.ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright (C) 2009-2013 Andrey V. Panov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
lc_lang_c2sc = "LC caps to smallcaps subtable"
AddLookup("LC caps to smallcaps", "gsub_single", 0, [["c2sc",[["latn",["dflt"]],["cyrl",["dflt"]]]]])
AddLookupSubtable("LC caps to smallcaps", lc_lang_c2sc)
lc_lang_smcp = "LC small to smallcaps subtable"
AddLookup("LC small to smallcaps", "gsub_single", 0, [["smcp",[["latn",["dflt"]],["cyrl",["dflt"]]]]])
AddLookupSubtable("LC small to smallcaps", lc_lang_smcp)
SelectWorthOutputting()
selection=$selection
j=SizeOf(selection)
SelectNone()
i=0
#foreach
while(i<j)
if ( selection[i] && SelectIf(i) == 1)
name = GlyphInfo ("Name")
cap_end=Strstr(name, ".sc")
if (cap_end > 0)
cap_name=Strsub(name, 0, cap_end)
if (SelectIf(cap_name) == 1)
AddPosSub(lc_lang_c2sc, name);
endif
low = UCodePoint(ToLower(UnicodeFromName(cap_name)))
if (low > 0 && SelectIf(low) == 1)
Select(low)
AddPosSub(lc_lang_smcp, name);
endif
endif
endif
i++
endloop
# map *.cap glyphs to *.sc
i=0
while(i<j)
if ( selection[i] && SelectIf(i) == 1)
name = GlyphInfo ("Name")
cap_end=Strstr(name, ".cap")
if (cap_end > 0)
sc_name=Strsub(name, 0, cap_end) + ".sc"
if (InFont(sc_name) == 1)
AddPosSub(lc_lang_c2sc, sc_name);
endif
endif
endif
i++
endloop
SelectNone()
if (WorthOutputting("ff") && InFont("FF.sc"))
Select("ff"); AddPosSub(lc_lang_smcp,"FF.sc");
endif
if (WorthOutputting("fi") && InFont("FI.sc"))
Select("fi"); AddPosSub(lc_lang_smcp,"FI.sc");
endif
if (WorthOutputting("fl") && InFont("FL.sc"))
Select("fl"); AddPosSub(lc_lang_smcp,"FL.sc");
endif
if (WorthOutputting("ffi") && InFont("FFI.sc"))
Select("ffi"); AddPosSub(lc_lang_smcp,"FFI.sc");
endif
if (WorthOutputting("ffl") && InFont("FFL.sc"))
Select("ffl"); AddPosSub(lc_lang_smcp,"FFL.sc");
endif
if (WorthOutputting("longs") && InFont("S.sc"))
Select("longs"); AddPosSub(lc_lang_smcp,"S.sc");
endif
# map Cyrillic letter palochka to "afii10055.sc" (like I.sc)
if (WorthOutputting(0u4CF) && InFont("afii10055.sc"))
Select(0u4CF); AddPosSub(lc_lang_smcp,"afii10055.sc");
endif
if (WorthOutputting(0u4C0) && InFont("afii10055.sc"))
Select(0u4C0); AddPosSub(lc_lang_c2sc,"afii10055.sc");
endif
SelectNone()