All files / lib charset.ts

100% Statements 5/5
85.71% Branches 6/7
100% Functions 3/3
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16        1x     77799x 77799x         79813x    
/**
 * The characters the subset fonts contain (see scripts/subset-fonts.py).
 * Anything outside this set would render in a fallback font.
 */
const extras = " ©×–—‘’“”•…";
 
export function isSupportedChar(char: string): boolean {
  const code = char.codePointAt(0) ?? 0;
  return (code >= 0x20 && code <= 0x7e) || extras.includes(char);
}
 
/** Characters in `text` the fonts can't render, deduplicated. */
export function unsupportedChars(text: string): string[] {
  return [...new Set([...text].filter((c) => c !== "\n" && !isSupportedChar(c)))];
}