Skip to content

Commit

Permalink
EPUB: Don't override font when explicitly set to monospace
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Dec 13, 2023
1 parent e9cf1d3 commit e3b55b4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dom/epub/lib/sanitize-and-render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ export class StyleScoper {
if (styleRule.style.display === 'table' || styleRule.style.display === 'inline-table') {
this.tableSelectors.add(styleRule.selectorText);
}

// If this rule sets a monospace font, make it !important so that it overrides the default content font
if (styleRule.style.fontFamily && /\bmono(space)?\b/i.test(styleRule.style.fontFamily)) {
styleRule.style.setProperty('font-family', styleRule.style.fontFamily, 'important');
}
}
else if (rule.constructor.name === 'CSSImportRule') {
let importRule = rule as CSSImportRule;
Expand Down

0 comments on commit e3b55b4

Please sign in to comment.