| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
alt_styles = |
| 15 |
{ |
| 16 |
Reg = { 400, 12 }, |
| 17 |
SixPt = { 400, 6 }, |
| 18 |
EightPt = { 400, 8 }, |
| 19 |
TenPt = { 400, 10 }, |
| 20 |
FourteenPt = { 400, 14 }, |
| 21 |
EighteenPt = { 400, 18 }, |
| 22 |
ExtraLight = { 200, 12 }, |
| 23 |
SixPtExtraLight = { 200, 6 }, |
| 24 |
EightPtExtraLight = { 200, 8 }, |
| 25 |
TenPtExtraLight = { 200, 10 }, |
| 26 |
FourteenPtExtraLight = { 200, 14 }, |
| 27 |
EighteenPtExtraLight = { 200, 18 }, |
| 28 |
Light = { 300, 12 }, |
| 29 |
SixPtLight = { 300, 6 }, |
| 30 |
EightPtLight = { 300, 8 }, |
| 31 |
TenPtLight = { 300, 10 }, |
| 32 |
FourteenPtLight = { 300, 14 }, |
| 33 |
EighteenPtLight = { 300, 18 }, |
| 34 |
Medium = { 500, 12 }, |
| 35 |
SixPtMedium = { 500, 6 }, |
| 36 |
EightPtMedium = { 500, 8 }, |
| 37 |
TenPtMedium = { 500, 10 }, |
| 38 |
FourteenPtMedium = { 500, 14 }, |
| 39 |
EighteenPtMedium = { 500, 18 }, |
| 40 |
Semibold = { 600, 12 }, |
| 41 |
SixPtSemibold = { 600, 6 }, |
| 42 |
EightPtSemibold = { 600, 8 }, |
| 43 |
TenPtSemibold = { 600, 10 }, |
| 44 |
FourteenPtSemibold = { 600, 14 }, |
| 45 |
EighteenPtSemibold = { 600, 18 }, |
| 46 |
Bold = { 700, 12 }, |
| 47 |
SixPtBold = { 700, 6 }, |
| 48 |
EightPtBold = { 700, 8 }, |
| 49 |
TenPtBold = { 700, 10 }, |
| 50 |
FourteenPtBold = { 700, 14 }, |
| 51 |
EighteenPtBold = { 700, 18 }, |
| 52 |
ExtraBold = { 800, 12 }, |
| 53 |
SixPtExtraBold = { 800, 6 }, |
| 54 |
EightPtExtraBold = { 800, 8 }, |
| 55 |
TenPtExtraBold = { 800, 10 }, |
| 56 |
FourteenPtExtraBold = { 800, 14 }, |
| 57 |
EighteenPtExtraBold = { 800, 18 } |
| 58 |
} |
| 59 |
|
| 60 |
optical_sizes = { |
| 61 |
elstob_at_RopszOne = 6, |
| 62 |
elstob_at_IopszOne = 6, |
| 63 |
elstob_at_BopszOne = 6, |
| 64 |
elstob_at_BIopszOne = 6, |
| 65 |
elstob_at_RopszTwo = 7, |
| 66 |
elstob_at_IopszTwo = 7, |
| 67 |
elstob_at_BopszTwo = 7, |
| 68 |
elstob_at_BIopszTwo = 7, |
| 69 |
elstob_at_RopszThree = 8, |
| 70 |
elstob_at_IopszThree = 8, |
| 71 |
elstob_at_BopszThree = 8, |
| 72 |
elstob_at_BIopszThree = 8, |
| 73 |
elstob_at_RopszFour = 9, |
| 74 |
elstob_at_IopszFour = 9, |
| 75 |
elstob_at_BopszFour = 9, |
| 76 |
elstob_at_BIopszFour = 9, |
| 77 |
elstob_at_RopszFive = 10, |
| 78 |
elstob_at_IopszFive = 10, |
| 79 |
elstob_at_BopszFive = 10, |
| 80 |
elstob_at_BIopszFive = 10, |
| 81 |
elstob_at_RopszSix = 11, |
| 82 |
elstob_at_IopszSix = 11, |
| 83 |
elstob_at_BopszSix = 11, |
| 84 |
elstob_at_BIopszSix = 11, |
| 85 |
elstob_at_RopszSeven = 12, |
| 86 |
elstob_at_IopszSeven = 12, |
| 87 |
elstob_at_BopszSeven = 12, |
| 88 |
elstob_at_BIopszSeven = 12, |
| 89 |
elstob_at_RopszEight = 13, |
| 90 |
elstob_at_IopszEight = 13, |
| 91 |
elstob_at_BopszEight = 13, |
| 92 |
elstob_at_BIopszEight = 13, |
| 93 |
elstob_at_RopszNine = 14, |
| 94 |
elstob_at_IopszNine = 14, |
| 95 |
elstob_at_BopszNine = 14, |
| 96 |
elstob_at_BIopszNine = 14, |
| 97 |
elstob_at_RopszTen = 15, |
| 98 |
elstob_at_IopszTen = 15, |
| 99 |
elstob_at_BopszTen = 15, |
| 100 |
elstob_at_BIopszTen = 15, |
| 101 |
elstob_at_RopszEleven = 16, |
| 102 |
elstob_at_IopszEleven = 16, |
| 103 |
elstob_at_BopszEleven = 16, |
| 104 |
elstob_at_BIopszEleven = 16, |
| 105 |
elstob_at_RopszTwelve = 17, |
| 106 |
elstob_at_IopszTwelve = 17, |
| 107 |
elstob_at_BopszTwelve = 17, |
| 108 |
elstob_at_BIopszTwelve = 17, |
| 109 |
elstob_at_RopszThirteen = 18, |
| 110 |
elstob_at_IopszThirteen = 18, |
| 111 |
elstob_at_BopszThirteen = 18, |
| 112 |
elstob_at_BIopszThirteen = 18 |
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
regular_weights = { |
| 117 |
elstob_at_RwghtOne = { 460, 390, 560, 290 }, |
| 118 |
elstob_at_IwghtOne = { 460, 390, 560, 290 }, |
| 119 |
elstob_at_RwghtTwo = { 452.5, 377.5, 550, 277.5 }, |
| 120 |
elstob_at_IwghtTwo = { 452.5, 377.5, 550, 277.5 }, |
| 121 |
elstob_at_RwghtThree = { 445, 365, 540, 265 }, |
| 122 |
elstob_at_IwghtThree = { 445, 365, 540, 265 }, |
| 123 |
elstob_at_RwghtFour = { 437.5, 352.5, 530, 252.5 }, |
| 124 |
elstob_at_IwghtFour = { 437.5, 352.5, 530, 252.5 }, |
| 125 |
elstob_at_RwghtFive = { 430, 340, 520, 240 }, |
| 126 |
elstob_at_IwghtFive = { 430, 340, 520, 240 }, |
| 127 |
elstob_at_RwghtSix = { 410, 315, 510, 215 }, |
| 128 |
elstob_at_IwghtSix = { 410, 315, 510, 215 }, |
| 129 |
elstob_at_RwghtSeven = { 390, 290, 500, 200 }, |
| 130 |
elstob_at_IwghtSeven = { 390, 290, 500, 200 }, |
| 131 |
elstob_at_RwghtEight = { 370, 270, 490, 170 }, |
| 132 |
elstob_at_IwghtEight = { 370, 270, 490, 170 }, |
| 133 |
elstob_at_RwghtNine = { 365, 265, 480, 165 }, |
| 134 |
elstob_at_IwghtNine = { 365, 265, 480, 165 }, |
| 135 |
elstob_at_RwghtTen = { 360, 260, 470, 160 }, |
| 136 |
elstob_at_IwghtTen = { 360, 260, 470, 160 }, |
| 137 |
elstob_at_RwghtEleven = { 355, 255, 460, 155 }, |
| 138 |
elstob_at_IwghtEleven = { 355, 255, 460, 155 }, |
| 139 |
elstob_at_RwghtTwelve = { 350, 250, 450, 150 }, |
| 140 |
elstob_at_IwghtTwelve = { 350, 250, 450, 150 }, |
| 141 |
elstob_at_RwghtThirteen = { 345, 245, 440, 145 }, |
| 142 |
elstob_at_IwghtThirteen = { 345, 245, 440, 145 }, |
| 143 |
} |
| 144 |
|
| 145 |
|
| 146 |
bold_weights = { |
| 147 |
elstob_at_BwghtOne = { 790, 660, 860 }, |
| 148 |
elstob_at_BIwghtOne = { 790, 660, 860 }, |
| 149 |
elstob_at_BwghtTwo = { 777.5, 650, 850 }, |
| 150 |
elstob_at_BIwghtTwo = { 777.5, 650, 850 }, |
| 151 |
elstob_at_BwghtThree = { 765, 640, 840 }, |
| 152 |
elstob_at_BIwghtThree = { 765, 640, 840 }, |
| 153 |
elstob_at_BwghtFour = { 752.5, 630, 830 }, |
| 154 |
elstob_at_BIwghtFour = { 752.5, 630, 830 }, |
| 155 |
elstob_at_BwghtFive = { 740, 620, 820 }, |
| 156 |
elstob_at_BIwghtFive = { 740, 620, 820 }, |
| 157 |
elstob_at_BwghtSix = { 715, 610, 810 }, |
| 158 |
elstob_at_BIwghtSix = { 715, 610, 810 }, |
| 159 |
elstob_at_BwghtSeven = { 690, 600, 800 }, |
| 160 |
elstob_at_BIwghtSeven = { 690, 600, 800 }, |
| 161 |
elstob_at_BwghtEight = { 670, 590, 790 }, |
| 162 |
elstob_at_BIwghtEight = { 670, 590, 790 }, |
| 163 |
elstob_at_BwghtNine = { 665, 580, 780 }, |
| 164 |
elstob_at_BIwghtNine = { 665, 580, 780 }, |
| 165 |
elstob_at_BwghtTen = { 650, 570, 770 }, |
| 166 |
elstob_at_BIwghtTen = { 650, 560, 770 }, |
| 167 |
elstob_at_BwghtEleven = { 655, 560, 760 }, |
| 168 |
elstob_at_BIwghtEleven = { 655, 560, 760 }, |
| 169 |
elstob_at_BwghtTwelve = { 650, 550, 750 }, |
| 170 |
elstob_at_BIwghtTwelve = { 650, 550, 750 }, |
| 171 |
elstob_at_BwghtThirteen = { 645, 540, 740 }, |
| 172 |
elstob_at_BIwghtThirteen = { 645, 540, 740 } |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
function mkaltcommands() |
| 178 |
for k, v in pairs(alt_styles) do |
| 179 |
romdef = k .. "Def" |
| 180 |
romsizedef = k .. "SizeDef" |
| 181 |
italsizedef = k .. "ItalicSizeDef" |
| 182 |
romfeat = k .. "Features" |
| 183 |
romsizefeat = k .. "SizeFeatures" |
| 184 |
italsizefeat = k .. "ItalicSizeFeatures" |
| 185 |
if k == "Reg" then |
| 186 |
romdef = "RegDef" |
| 187 |
italsizedef = "ItalicSizeDef" |
| 188 |
romfeat = "RegularFeatures" |
| 189 |
romsizefeat = "RegularSizeFeatures" |
| 190 |
italsizefeat = "ItalicSizeFeatures" |
| 191 |
end |
| 192 |
tex.print("\\newcommand{\\" .. romdef .. "}{}") |
| 193 |
tex.print("\\newcommand{\\" .. romsizedef .. "}{SizeFeatures={{Size={5-}, RawFeature={axis={wght=" .. |
| 194 |
v[1] .. ",opsz=" .. v[2] .. "}}}}}") |
| 195 |
tex.print("\\newcommand{\\" .. italsizedef .. "}{SizeFeatures={{Size={5-}, RawFeature={axis={wght=" .. |
| 196 |
v[1] .. ",opsz=" .. v[2] .. ",slnt=\\elstob@Islnt}}}}}") |
| 197 |
tex.print("\\DeclareOptionX{" .. romfeat .. "}{\\renewcommand*{\\" .. romdef .. "}{#1,}}") |
| 198 |
tex.print("\\DeclareOptionX{" .. romsizefeat .. "}{\\renewcommand*{\\" .. romsizedef .. "}{\\directlua{mksizecommand({#1})}}}") |
| 199 |
tex.print("\\DeclareOptionX{" .. italsizefeat .. "}{\\renewcommand*{\\" .. italsizedef .. "}{\\directlua{mksizecommand({#1})}}}") |
| 200 |
end |
| 201 |
end |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
function mkfontcommands() |
| 206 |
for k, v in pairs(alt_styles) do |
| 207 |
romdef = k .. "Def" |
| 208 |
romsizedef = k .. "SizeDef" |
| 209 |
italsizedef = k .. "ItalicSizeDef" |
| 210 |
romfontname = "e" .. k |
| 211 |
italfontname = "e" .. k .. "Italic" |
| 212 |
if k == "Reg" then |
| 213 |
romdef = "RegDef" |
| 214 |
romsizedef = "RegSizeDef" |
| 215 |
italsizedef = "ItalicSizeDef" |
| 216 |
romfontname = "eRegular" |
| 217 |
italfontname = "eItalic" |
| 218 |
end |
| 219 |
tex.print("\\elstob@newfont{\\" .. romfontname .. "}{Elstob}{\\" .. romdef .. "}{\\" .. romsizedef .. "}") |
| 220 |
tex.print("\\elstob@newfont{\\" .. italfontname .. "}{Elstob-Italic}{\\" .. romdef .."}{\\" .. italsizedef .. "}") |
| 221 |
end |
| 222 |
end |
| 223 |
|
| 224 |
function adjustopsz(original, adjustment) |
| 225 |
adjusted = original + adjustment |
| 226 |
if adjusted > 18 then adjusted = 18 end |
| 227 |
if adjusted < 6 then adjusted = 6 end |
| 228 |
return adjusted |
| 229 |
end |
| 230 |
|
| 231 |
function adjustwght(original, adjustment) |
| 232 |
adjusted = original + adjustment |
| 233 |
if adjusted > 800 then adjusted = 800 end |
| 234 |
if adjusted < 200 then adjusted = 200 end |
| 235 |
return adjusted |
| 236 |
end |
| 237 |
|
| 238 |
function mkopszcommands(adjustment) |
| 239 |
for k, oz in pairs(optical_sizes) do |
| 240 |
cmd, n = string.gsub(k, "_at_", "@") |
| 241 |
tex.print("\\newcommand*{\\" .. cmd .. "}{" .. adjustopsz(oz,adjustment) .. "}") |
| 242 |
end |
| 243 |
end |
| 244 |
|
| 245 |
function mkregcommands(wtidx, adjustment) |
| 246 |
for k, wt in pairs(regular_weights) do |
| 247 |
cmd, n = string.gsub(k, "_at_", "@") |
| 248 |
tex.print("\\newcommand*{\\" .. cmd .. "}{" .. adjustwght(wt[wtidx],adjustment) .. "}") |
| 249 |
end |
| 250 |
end |
| 251 |
|
| 252 |
function mkboldcommands(wtidx, adjustment) |
| 253 |
for k, wt in pairs(bold_weights) do |
| 254 |
cmd, n = string.gsub(k, "_at_", "@") |
| 255 |
tex.print("\\newcommand*{\\" .. cmd .. "}{" .. adjustwght(wt[wtidx],adjustment) .. "}") |
| 256 |
end |
| 257 |
end |
| 258 |
|
| 259 |
function mksizecommand(sizetable) |
| 260 |
result = "Nothing yet" |
| 261 |
if #sizetable > 0 then |
| 262 |
result = "SizeFeatures={" |
| 263 |
lastsize = 0 |
| 264 |
for i, v in ipairs(sizetable) do |
| 265 |
if v["size"] then |
| 266 |
axiscount = 0 |
| 267 |
sizeitem = "{Size={" |
| 268 |
currentsize = v["size"] |
| 269 |
csnum = v["size"] |
| 270 |
if i == #sizetable then |
| 271 |
currentsize = currentsize .. "-" |
| 272 |
elseif lastsize == 0 then |
| 273 |
currentsize = "-" .. currentsize |
| 274 |
else |
| 275 |
currentsize = lastsize .. "-" .. currentsize |
| 276 |
end |
| 277 |
lastsize = csnum |
| 278 |
sizeitem = sizeitem .. currentsize .. "},RawFeature={axis={" |
| 279 |
if v["wght"] then |
| 280 |
sizeitem = sizeitem .. "wght=" .. v["wght"] |
| 281 |
axiscount = axiscount + 1 |
| 282 |
end |
| 283 |
if v["opsz"] then |
| 284 |
if axiscount >= 1 then sizeitem = sizeitem .. "," end |
| 285 |
sizeitem = sizeitem .. "opsz=" .. v["opsz"] |
| 286 |
axiscount = axiscount + 1 |
| 287 |
end |
| 288 |
if v["slnt"] then |
| 289 |
if axiscount >= 1 then sizeitem = sizeitem .. "," end |
| 290 |
sizeitem = sizeitem .. "slnt=" .. v["slnt"] |
| 291 |
axiscount = axiscount + 1 |
| 292 |
end |
| 293 |
if v["GRAD"] then |
| 294 |
if axiscount >= 1 then sizeitem = sizeitem .. "," end |
| 295 |
sizeitem = sizeitem .. "GRAD=" .. v["GRAD"] |
| 296 |
axiscount = axiscount + 1 |
| 297 |
end |
| 298 |
if v["SPAC"] then |
| 299 |
if axiscount >= 1 then sizeitem = sizeitem .. "," end |
| 300 |
sizeitem = sizeitem .. "SPAC=" .. v["SPAC"] |
| 301 |
end |
| 302 |
sizeitem = sizeitem .. "}}}," |
| 303 |
result = result .. sizeitem |
| 304 |
end |
| 305 |
end |
| 306 |
result = result .. "}" |
| 307 |
tex.print(result) |
| 308 |
end |
| 309 |
end |
| 310 |
|
| 311 |
|