diff --git a/package.json b/package.json index dba6f48..b55f890 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "glow-sans", - "version": "0.9.2", + "version": "0.9.3", "description": "Glow Sans CJK typeface", "main": "examples/index.js", "gypfile": true, diff --git a/src/font-build/tables/name.js b/src/font-build/tables/name.js index a3b0294..51f8df5 100644 --- a/src/font-build/tables/name.js +++ b/src/font-build/tables/name.js @@ -1,4 +1,3 @@ -const zh_hans_MAC = 25, zh_hant_MAC = 2, ja_MAC = 1, ro_MAC = 0; const zh_CN_WIN = 0x0804, zh_HK_WIN = 0x0C04, zh_MO_WIN = 0x1404, zh_SG_WIN = 0x1004, zh_TW_WIN = 0x0404, ja_WIN = 0x0411; @@ -19,8 +18,14 @@ function record(nameID, nameString, { languageID = 0x0409, platformID = WINDOWS, encodingID = 1 } = {}) { return ({ platformID, encodingID, languageID, nameID, nameString }); } -const designerStr = 'Ryoko NISHIZUKA 西塚涼子 (kana, bopomofo & ideographs); Paul D. Hunt (Latin, Greek & Cyrillic); Sandoll Communications 산돌커뮤니케이션, Soo-young JANG 장수영 & Joo-yeon KANG 강주연 (hangul elements, letters & syllables); Glow Sans is built by Celestial Phineas.'; -const descriptionStr = 'Source Han Sans is built by Dr. Ken Lunde (project architect, glyph set definition & overall production); Masataka HATTORI 服部正貴 (production & ideograph elements)'; +if (typeof(btoa) === 'undefined') { + function btoa (str) { + return Buffer.from(str, 'binary').toString('base64') + } +} + +const designerStr = 'Ryoko NISHIZUKA (kana, bopomofo & ideographs); Paul D. Hunt (Latin, Greek & Cyrillic); Sandoll Communications, Soo-young JANG & Joo-yeon KANG (hangul elements, letters & syllables); Glow Sans is built by Celestial Phineas.'; +const descriptionStr = 'Source Han Sans is built by Dr. Ken Lunde (project architect, glyph set definition & overall production); Masataka HATTORI (production & ideograph elements)'; const licenseDescStr = 'This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software.'; /** Get the `name` table @@ -30,60 +35,89 @@ const licenseDescStr = 'This Font Software is licensed under the SIL Open Font L * @param { string } verStr Font version string */ function getTable (langStr, weightStr, widthStr, verStr) { const postFamilyName = [ 'Regular', 'Bold' ].includes(weightStr) ? '' : ` ${weightStr}`; - const macConfig = { languageID: ro_MAC, encodingID: 0, platformID: MACINTOSH }; + const macConfig = { languageID: 0, encodingID: 0, platformID: MACINTOSH }; + const macScConfig = { languageID: 33, encodingID: 25, platformID: MACINTOSH }; + const macTcConfig = { languageID: 19, encodingID: 2, platformID: MACINTOSH }; + const macJConfig = { languageID: 11, encodingID: 1, platformID: MACINTOSH }; + const name = [ - record(copyrightNotice, 'Glow Sans © 2020 Project Welai', macConfig), - record(copyrightNotice, 'Glow Sans © 2020 Project Welai'), + record(copyrightNotice, 'Glow Sans (c) 2021 Project Welai', macConfig), record(familyName, `Glow Sans ${langStr} ${widthStr}`, macConfig), - record(familyName, `Glow Sans ${langStr} ${widthStr}${postFamilyName}`), record(subfamilyName, `${weightStr}`, macConfig), - record(subfamilyName, weightStr === 'Bold' ? 'Bold' : 'Regular'), record(identifier, `${verStr};WELA;GlowSans${langStr}-${widthStr}-${weightStr}`, macConfig), - record(identifier, `${verStr};WELA;GlowSans${langStr}-${widthStr}-${weightStr}`), record(fullName, `Glow Sans ${langStr} ${widthStr} ${weightStr}`, macConfig), - record(fullName, `Glow Sans ${langStr} ${widthStr} ${weightStr}`), record(versionStr, `Version ${verStr}`, macConfig), - record(versionStr, `Version ${verStr}`), record(psName, `GlowSans${langStr}-${widthStr}-${weightStr}`, macConfig), - record(psName, `GlowSans${langStr}-${widthStr}-${weightStr}`), record(designer, designerStr, macConfig), - record(designer, designerStr), record(description, descriptionStr, macConfig), - record(description, descriptionStr), record(urlVendor, 'https://github.com/welai', macConfig), - record(urlVendor, 'https://github.com/welai'), record(urlDesigner, 'https://github.com/celestialphineas', macConfig), - record(urlDesigner, 'https://github.com/celestialphineas'), record(licenseDesc, licenseDescStr, macConfig), - record(licenseDesc, licenseDescStr), record(urlLicense, 'http://scripts.sil.org/OFL', macConfig), + record(typoFamilyName, `Glow Sans ${langStr}`, macConfig), + record(typoSubfamilyName, `${widthStr} ${weightStr}`, macConfig), + + record(copyrightNotice, 'Glow Sans (c) 2021 Project Welai'), + record(familyName, `Glow Sans ${langStr} ${widthStr}${postFamilyName}`), + record(subfamilyName, weightStr === 'Bold' ? 'Bold' : 'Regular'), + record(identifier, `${verStr};WELA;GlowSans${langStr}-${widthStr}-${weightStr}`), + record(fullName, `Glow Sans ${langStr} ${widthStr} ${weightStr}`), + record(versionStr, `Version ${verStr}`), + record(psName, `GlowSans${langStr}-${widthStr}-${weightStr}`), + record(designer, designerStr), + record(description, descriptionStr), + record(urlVendor, 'https://github.com/welai'), + record(urlDesigner, 'https://github.com/celestialphineas'), + record(licenseDesc, licenseDescStr), record(urlLicense, 'http://scripts.sil.org/OFL'), record(typoFamilyName, `Glow Sans ${langStr}`), - record(typoFamilyName, `Glow Sans ${langStr}`), + record(typoSubfamilyName, `${widthStr} ${weightStr}`), record(sampleText, '青青子衿,悠悠我心。縱我不往,子寧不嗣音?') ]; + switch (langStr) { case 'SC': name.push( + record(familyName, btoa(`\xCE\xB4\xC0\xB4\xD3\xAB\xBA\xDA ${widthStr}`), macScConfig), + record(subfamilyName, btoa(weightStr), macScConfig), + record(fullName, btoa(`\xCE\xB4\xC0\xB4\xD3\xAB\xBA\xDA ${widthStr} ${weightStr}`), macScConfig), + record(typoFamilyName, btoa(`\xCE\xB4\xC0\xB4\xD3\xAB\xBA\xDA`), macScConfig), + record(typoSubfamilyName, btoa(`${widthStr} ${weightStr}`), macScConfig), + record(familyName, `未来荧黑 ${widthStr}${postFamilyName}`, { languageID: zh_CN_WIN }), record(subfamilyName, weightStr === 'Bold' ? 'Bold' : 'Regular', { languageID: zh_CN_WIN }), record(fullName, `未来荧黑 ${widthStr} ${weightStr}`, { languageID: zh_CN_WIN }), record(typoFamilyName, `未来荧黑`, { languageID: zh_CN_WIN }), record(typoSubfamilyName, `${widthStr} ${weightStr}`, { languageID: zh_CN_WIN }) ); break; + case 'TC': name.push( - record(familyName, `未来熒黑${widthStr}${postFamilyName}`, { languageID: zh_TW_WIN }), + record(familyName, btoa(`\xA5\xBC\xA8\xD3\xBA\xB7\xB6\xC2 ${widthStr}`), macTcConfig), + record(subfamilyName, btoa(weightStr), macTcConfig), + record(fullName, btoa(`\xA5\xBC\xA8\xD3\xBA\xB7\xB6\xC2 ${widthStr} ${weightStr}`), macTcConfig), + record(typoFamilyName, btoa(`\xA5\xBC\xA8\xD3\xBA\xB7\xB6\xC2`), macTcConfig), + record(typoSubfamilyName, btoa(`${widthStr} ${weightStr}`), macTcConfig), + + record(familyName, `未來熒黑 ${widthStr}${postFamilyName}`, { languageID: zh_TW_WIN }), record(subfamilyName, weightStr === 'Bold' ? 'Bold' : 'Regular', { languageID: zh_TW_WIN }), - record(fullName, `未来熒黑 ${widthStr} ${weightStr}`, { languageID: zh_TW_WIN }), - record(typoFamilyName, `未来熒黑`, { languageID: zh_TW_WIN }), - record(typoSubfamilyName, `${widthStr} ${weightStr}`, { languageID: zh_TW_WIN }), + record(fullName, `未來熒黑 ${widthStr} ${weightStr}`, { languageID: zh_TW_WIN }), + record(typoFamilyName, `未來熒黑`, { languageID: zh_TW_WIN }), + record(typoSubfamilyName, `${widthStr} ${weightStr}`, { languageID: zh_TW_WIN }) ); break; + case 'J': name.push( + record(familyName, btoa(`\x83\x71\x83\x4A\x83\x8A\x8A\x70\x83\x53 ${widthStr}`), macJConfig), + record(subfamilyName, btoa(weightStr), macJConfig), + record(fullName, btoa(`\x83\x71\x83\x4A\x83\x8A\x8A\x70\x83\x53 ${widthStr} ${weightStr}`), macJConfig), + record(typoFamilyName, btoa(`\x83\x71\x83\x4A\x83\x8A\x8A\x70\x83\x53`), macJConfig), + record(typoSubfamilyName, btoa(`${widthStr} ${weightStr}`), macJConfig), + record(familyName, `ヒカリ角ゴ ${widthStr}${postFamilyName}`, { languageID: ja_WIN }), record(subfamilyName, weightStr === 'Bold' ? 'Bold' : 'Regular', { languageID: ja_WIN }), record(fullName, `ヒカリ角ゴ ${widthStr} ${weightStr}`, { languageID: ja_WIN }), record(typoFamilyName, `ヒカリ角ゴ`, { languageID: ja_WIN }), record(typoSubfamilyName, `${widthStr} ${weightStr}`, { languageID: ja_WIN }) ); break; + default: throw Error(`Unimplemented language for ${langStr}`); } return name;