fix(fonts): stop SC and TC from claiming kana (#2473)

This commit is contained in:
Hampus
2026-09-05 22:25:44 +02:00
committed by GitHub
parent fed8b2d089
commit 622bd124b9
854 changed files with 4583 additions and 4105 deletions
@@ -193,6 +193,20 @@ describe('the cascade the gate is computed from', () => {
expect(chain.indexOf('Fluxer Sans TC')).toBeLessThan(chain.indexOf('Fluxer Sans JP'));
});
it('leaves kana to JP, so the Han tie-break cannot claim text that is only ever Japanese', () => {
for (const sheet of ['script-sc.css', 'script-tc.css']) {
const text = readFileSync(join(FONTS_CSS, sheet), 'utf8');
for (const [, value] of text.matchAll(/unicode-range:([^;]*);/g)) {
for (const part of value.split(',')) {
const [start, end] = part.trim().replace('U+', '').split('-');
const from = Number.parseInt(start, 16);
const to = end === undefined ? from : Number.parseInt(end, 16);
expect(from > 0x30ff || to < 0x3040, `${sheet} claims ${part.trim()}`).toBe(true);
}
}
}
});
it('hoists the family hanChunkForLanguage picks, for every locale rule that exists', () => {
const expected: Record<string, string> = {
ja: 'Fluxer Sans JP',
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More