Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
v0.93 release, name table fix
Browse files Browse the repository at this point in the history
  • Loading branch information
celestialphineas committed Sep 10, 2021
1 parent 5243423 commit 715f351
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
78 changes: 56 additions & 22 deletions src/font-build/tables/name.js
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 715f351

Please sign in to comment.