Skip to content

Commit

Permalink
Make sure all character data is included when adaptiveCSS is false. (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvc committed Jan 31, 2022
1 parent 6b38558 commit e7c3eaa
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion ts/output/chtml/FontData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ export class CHTMLFontData extends FontData<CHTMLCharOptions, CHTMLVariantData,
//
// Add the styles for delimiters and characters
//
this.updateStyles(styles);
if (this.options.adaptoveCSS) {
this.updateStyles(styles);
} else {
this.allStyles(styles);
}
//
// Return the final style sheet
//
Expand All @@ -209,6 +213,35 @@ export class CHTMLFontData extends FontData<CHTMLCharOptions, CHTMLVariantData,
return styles;
}

/**
* @param {StyleList} styles The style list to add characters to
*/
protected allStyles(styles: StyleList) {
//
// Create styles needed for the delimiters
//
for (const n of Object.keys(this.delimiters)) {
const N = parseInt(n);
this.addDelimiterStyles(styles, N, this.delimiters[N]);
}
//
// Add style for all character data
//
for (const name of Object.keys(this.variant)) {
const variant = this.variant[name];
const vletter = variant.letter;
for (const n of Object.keys(variant.chars)) {
const N = parseInt(n);
const char = variant.chars[N];
if ((char[3] || {}).smp) continue;
if (char.length < 4) {
(char as CHTMLCharData)[3] = {};
}
this.addCharStyles(styles, vletter, N, char);
}
}
}

/**
* @param {StyleList} styles The style object to add styles to
* @param {StyleList} fonts The default font-face directives with %%URL%% where the url should go
Expand Down

0 comments on commit e7c3eaa

Please sign in to comment.