Patch names

This commit is contained in:
kiliman
2017-09-12 15:43:26 -04:00
parent a560344cbe
commit c83c8689f2
+12
View File
@@ -54,6 +54,18 @@ async function patchNames(dom) {
const names = xpath.select('/name/namerecord', configDom); const names = xpath.select('/name/namerecord', configDom);
const targetName = xpath.select('/ttFont/name', dom, true); const targetName = xpath.select('/ttFont/name', dom, true);
// get font and family name
const familyName = getTextNode(configDom, '/name/namerecord[@nameID="1" and @platformID="1"]');
const fullName = getTextNode(configDom, '/name/namerecord[@nameID="4" and @platformID="1"]');
// patch CFFFont
const cffFont = xpath.select('/ttFont/CFF/CFFFont', dom, true);
cffFont.setAttribute('name', ligFontName);
setAttribute(cffFont, 'FullName', 'value', fullName);
setAttribute(cffFont, 'FamilyName', 'value', familyName);
// update existing names with new names
names.forEach(node => { names.forEach(node => {
const nameId = node.getAttribute('nameID'); const nameId = node.getAttribute('nameID');
const platformId = node.getAttribute('platformID'); const platformId = node.getAttribute('platformID');