Skip to content

Update Noto CJK or add Source Han #18

Open

Description

@YDX-2147483647

Why update?

typst/typst#7415 fixes an issue of the OpenType locl (Localized Forms) feature, but no test is added because typst-dev-assets doesn't have any font supporting locl.
The latest Noto CJK supports locl, but the current version in typst-dev-assets are too old. (See typst/typst#7396 (comment) for details.)

Relates-to: mattfbacon/typst-bot#41

Also relates to typst/typst#954 and typst/typst#2648, when the current Noto Serif CJK JP/SC/TC fonts were added from https://github.com/CodePlayer/webfont-noto, and typst/typst#1360, when the current Noto Serif CJK KR was added from an unknown source.

Previous discussion

(Discord, 2025-11-25)

yes, we can update it

okay, then perhaps it's better for the official team to handle this? It's approximately 6 × 20 MB (without subsetting) and may affect many test cases.
(6 = (sc+tc) × (regular+bold) + (jp+kr) × regular)

That's definitely too large. We'd need to do subsetting.
I can't say when I could look at this, so if you want to take a stab yourself, that would be fine by me.

(Discord, 2026-10-30)

How large a file can be tolerated in typst-dev-assets, if I add the latest Source Han Sans fonts while keeping the old Noto Serif CJK fonts? I guess 4 MiB?
I can make the storage more efficient by collecting all five fonts (jp, kr, sc, tc, hc) in a single VF OTC file, and letting them reuse glyphs data. In that case, can the threshold be raised? Say, 8 MiB?

For reference:

  • 32.1 MiB — full SourceHanSans-VF.otf.ttc (variable weights, jp+kr+sc+tc+hc)
  • 15.8 MiB — full SourceHanSansSC-Regular.otf (single weight, sc only)
  • 12.7 MiB — full TwitterColorEmoji.ttf in dev-assets (the largest font there)
  • 11.4 MiB — sum of subsets NotoSerifCJK*.otf in dev-assets (two weights, jp+kr+sc+tc)
  • 4.49 MiB — subset NotoColorEmoji-Regular-COLR.subset.ttf in dev-assets (the second largest font there)
  • 2.94 MiB — subset NotoSerifCJKjp-Regular.otf in dev-assets (single weight, jp only, the third largest font there)

If it gives us a real advantage in being able to test something new, 8MiB would probably be okay. I just want to avoid it growing evermore.

Further considerations

Subsetting might be more complex then it seems to be, because we want font features to be preserved for future tests. (e.g. for typst/typst#6735).
Noto Serif CJK (Source Han Serif) has a 27-page (excluding changelog) font readme…

Also, perhaps we should replace Noto Serif CJK with Source Han Serif, considering that:

Characters used by the existing test cases

��������
� ������������������ !"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[]^_`abcdefghijklmnopqrstuvwxyz{|}~��� ¡¢£¤¥§¨©ª«¬­®¯°±´µ¶·¸º»½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖרÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýÿāăćčēėěĝġĤħīĮİıĶļľŒœŕśŞşšūŬůųŸžſƊƏƒƙƠơƢƫưƷDŽLJnjǗǙǜǦǩǾȍȓȘțȡȨȭȷȹɄɉɏɓɖɗəɧɪɬɭɮɯɹʟʧʬʭʺʼʽ˄ˆˇ˕˘˙˚˛˜˝ˡ˽͵ͷ͹ͺͿ΄ΆΈΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩάέήίαβγδεζηθικλμνξοπρςστυφχψωόύώϑϖϗϚϛϜϝϞϟϠϡϬϯϴϵϿЈЉБГЗКЛНПРСТУФХЪЭабвгдежзийклмнопрстуфцчшъыьэяіїјљѷ҇ҜҤүҹһӃӅӋӌӍӑӓӖӛӞӡӯӱӷӽԌԔԦԭԱԲԳԽՃՆՏՓՔՠադէըթկղյնոջսվտրւ֋אבגדהוזחטיכלםמןנסעפצקרשת׫״׶׺؉،آأؤإئابةتثجحخدذرزسشصضطظعغػـفقكلمنهوىي٠١٢٣٤٥٦٧٨٩٫ٲٹپڊڐڕڝڦکہۃۆۇۋیێە۪ۛ۰۱۲۳۴۵۶۷۸۹ۼ܌܎ܔܚܪݘݚݠݣݨދޗު޶޼޾ߗߣߤ߷߻ंअआऋकगचटठणतथदनपभमरलषस०१२३४५६७८९কখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ০১২৩৪৫৬৭৮৯ৰਕਖਗਤਧਬਮਰਲਵਸ਼ਸਹટનપબલાુેଚଛଟଠତନପବରଲଷସஅஉடணபமளவఆకగజటతథపబయరలవషಕಗಚಟತಥಪಯರಳವಷಸഉകചടതപരളി്ගටථනපමයරලවසහกคงจชซญณดตทนบปพฟมยรฤลวษสหอฮัาเแโไກງຕທນບລສອຮະາີູເ້ໜ་།ཀགངཆཐདཔམཞའརཤསაგევილნრსტუშცხሃልመሞሥረሰቢትኄንዋዏዕዘዥይዲገጠጽፍកគងតថទនបពមរសảầệụἃἔἰἴἶὅὐὲὴὶίόῆῦῳῷ ‌‍–—‖‘’‚“”„†‡•…‰′″‴‹›‾⁄⁗€⃣ℎℕ™Å⅋←→↔↞↠↢↣↦↪↼⇀⇎⇏⇒⇔⇜⇝∂∅∆∏∑−∗∘√∛∜∞∨∫∳∼≈≉≔≕≠≤≥≪≫⊥⋅⋘⋙⋮⋯⋰⋱⌈⌉⌊⌋⌜⌝⌞⌟⎰⎱⎴⎵⏜⏝⏞⏟⏠⏡⏰⑞①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⓪⓵⓶⓷⓸⓹⓺⓻⓼⓽⓾△▷◊○☐☒♔♕♖♗♘♙♚♛♜♝♞♟⚠⚧⛓✅✓✨❌❤⟂⟅⟆⟇⟑⟦⟧⟨⟩⟪⟫⟵⟶⟷⟸⟹⟺⟾⟿⤃⤄⤇⨋⨜⨳⩴⬳⭐ 、。〈〉《》「」『』【】〔〕〖〗あいうえおかがきくけこさしすせそただちっつてでとなにぬねのはひびふへほまみむめもやゆよらりるれろわゐゑをんアィイウェエオカガキクケコサシジスズセソタチッツテデトナニヌネノハヒフプヘペホボマミムメモヤユヨラリルレロワヰヱヲン・ーㄱㄴㄷㄹㅁㅂㅅㅇㅈㅊㅋㅌㅍㅎ㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿㥳㧒䦓一丁七万三上下不且世丙东两个中为主之乘乙九也书了事于五亚些交人介付代以件任伍众会但体何作你使來依修克全公兰共其典内写冬决凑分列刘则別利别制前剧劈加動北区医十华南卜占卡即卿原叁参及取另台号司合同名后吗否吸告和唐唯営因団図国图圎圖在地坡坦執基增壹外多大太夫失好如始姐子孔字孚季学完官审家宽寄对导専小尔尦就尾山岭已巴常年幸广库度异式引強强当录形彩很律得德忆志念急您成或戴所扉手执技拉拍括拼拾拿持捕换排掩插播收整文斑料斜斯新方族日早时易是更書最月有服本朱来杨杰松林柒标格業楷次正母毛民水汉江法注洲活浅测海深混港湾演澳点爱版物独献玖玩现理用由甲申电界略百的皆目相省看真矩码礫示神禁私科程章符第筆節簿米粔粗系紧纝纹细绍经续维编罗置美翎考者而肉脚腳舞般良节英茸药荷著蒙蓄薈行表裁西要見见观规视角言註話語誰課調计订让记设评识词试话语读调象財貫贩赦足身载辑迅近还进迷适通速運過道遠邊邮郵配酬鈡錄长門開门问间陆雀雁集電需非音頁页顿风首香马高鰝黃黓ꕮ가고그나다라례림마문바사아이자젹지차참카타파페표하헌fifl︎️﹡!(),.:;?[]{}�𐆊𝐴𝑍𝑎𝑝𝑧𝚤𝚥𝛼𝛽🌅🌈🌊🌋🌍🌎🌏🌴🍌🍎🎉🏕🏝🏞🏡🏳🏿🐈🐪👍👦👩💘💛💥💨📖🔑🔗🖂🖃🖄🖅🖆🖥😀😃😊😋😱🚀🚗🛎🤓🥦🧠򍊕

Generated by a script
cd typst/typst
cat $(fd --type file | rg -v png) | python chars.py
from sys import stdin

a = set("\n".join(stdin.readlines()))
b = list(a)
b.sort()
print("".join(b))

Update in 2026-10

I'm able to subset Source Han Sans VF OTC while keeping the CFF2 table shared across the five language-specific fonts and retaining OpenType features and Unicode variation sequences.
Neither fonttools subset nor hb-subset supports that on CLI, so I wrote a script for subsetting (I'll open source it later).

Here's a 4.5-MiB subset.
SourceHanSans-VF.subset.otf.ttc.zip

I used Sans instead of Serif, because the Sans version has less stylistic details and thus has smaller file sizes. For reference, the Serif subset with the similar character coverage would be 6.4 MiB.

Outdated notes
$ hb-info SourceHanSans-VF.subset.otf.ttc --face-index 0 --show-face-count --show-family --show-unicode-count --show-glyph-count --show-technology
Face count: 5
Family: Subset-Source Han Sans VF
Has Postscript outlines
Has OpenType layout
Has variations
Unicode count: 6241
Glyph count: 9483

$ hb-info SourceHanSans-VF.subset.otf.ttc --face-index 1 --show-family --show-unicode-count --show-glyph-count
Family: Subset-Source Han Sans K VF
Unicode count: 6241
Glyph count: 9483

$ hb-info SourceHanSans-VF.subset.otf.ttc --face-index 2 --show-family --show-unicode-count --show-glyph-count
Family: Subset-Source Han Sans SC VF
Unicode count: 6242
Glyph count: 9483

$ hb-info SourceHanSans-VF.subset.otf.ttc --face-index 3 --show-family --show-unicode-count --show-glyph-count
Family: Subset-Source Han Sans TC VF
Unicode count: 6242
Glyph count: 9483

$ hb-info SourceHanSans-VF.subset.otf.ttc --face-index 4 --show-family --show-unicode-count --show-glyph-count
Family: Subset-Source Han Sans HC VF
Unicode count: 6242
Glyph count: 9483

Activity

  1. laurmaedje commented on Aug 3, 2026

    @laurmaedje
    Member

    Subsetting might be more complex then it seems to be, because we want font features to be preserved for future tests.

    Harfbuzz can subset while retaining features.

    Also, perhaps we should replace Noto Serif CJK with Source Han Serif, considering that: [...]

    Yeah, that's worth considering. If we subset to a small amount of glyphs, maybe we can have both.

  2. changed the title [-]Update Noto CJK[/-] [+]Update Noto CJK or add Source Han[/+] on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions