Repository navigation
Description
Description
I've just tried compiling a document on NixOS, but found tofu, which is weird. Apparently 〜 is rendered like that, which means it doesn't see CJK fonts, but the font is fully embedded, so it must render.
But Okular and MuPDF show tofu.
I thought that using "Thin" variant instead of "Regular" by default is weird, but soon I discovered that all CJK font packages from nixpkgs only have .otf.ttc files, which is different from .otf files I used before (while all other fonts have .ttf, which is why all of them work with Typst as usual).
And indeed, as soon as I downloaded the official OTF files and compiled the document again, I was greeted with actual glyphs. So, I've never seen such files before and since all programs do render CJK glyphs, then it must be Typst that can't properly work with such format. It has nothing to do with NixOS in particular.
#set document(date: none)
#set text(font: "Noto Sans CJK JP")
テキストSystem fonts
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Bold
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=DemiLight
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Medium
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=DemiLight
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Light
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Light
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Regular
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Thin,Regular
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Black
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Black
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Regular
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Thin,Regular
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Bold
NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=MediumWith paths:
/nix/store/0wya6d4cn2yp1yfa4afq198cdh9bfpxf-noto-fonts-cjk-sans-2.004/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Bold
/nix/store/ffnicq45xczjbpxhqs1prdld9l72wj2c-home-manager-path/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=DemiLight
/nix/store/ffnicq45xczjbpxhqs1prdld9l72wj2c-home-manager-path/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Medium
/nix/store/0wya6d4cn2yp1yfa4afq198cdh9bfpxf-noto-fonts-cjk-sans-2.004/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=DemiLight
/nix/store/ffnicq45xczjbpxhqs1prdld9l72wj2c-home-manager-path/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Light
/nix/store/0wya6d4cn2yp1yfa4afq198cdh9bfpxf-noto-fonts-cjk-sans-2.004/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Light
/nix/store/0wya6d4cn2yp1yfa4afq198cdh9bfpxf-noto-fonts-cjk-sans-2.004/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Regular
/nix/store/0wya6d4cn2yp1yfa4afq198cdh9bfpxf-noto-fonts-cjk-sans-2.004/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Thin,Regular
/nix/store/ffnicq45xczjbpxhqs1prdld9l72wj2c-home-manager-path/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Black
/nix/store/ffnicq45xczjbpxhqs1prdld9l72wj2c-home-manager-path/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP
/nix/store/0wya6d4cn2yp1yfa4afq198cdh9bfpxf-noto-fonts-cjk-sans-2.004/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP
/nix/store/0wya6d4cn2yp1yfa4afq198cdh9bfpxf-noto-fonts-cjk-sans-2.004/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Black
/nix/store/ffnicq45xczjbpxhqs1prdld9l72wj2c-home-manager-path/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Regular
/nix/store/ffnicq45xczjbpxhqs1prdld9l72wj2c-home-manager-path/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Thin,Regular
/nix/store/ffnicq45xczjbpxhqs1prdld9l72wj2c-home-manager-path/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Bold
/nix/store/0wya6d4cn2yp1yfa4afq198cdh9bfpxf-noto-fonts-cjk-sans-2.004/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc: Noto Sans CJK JP:style=Medium
Trying to set default fonts and adding some extra didn't help:
fonts.packages = with pkgs; [
nerd-fonts.fira-code
fira
fira-code
liberation_ttf
libertinus
noto-fonts
noto-fonts-extra
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-color-emoji
];
fonts.fontconfig = {
enable = true;
defaultFonts.emoji = ["Noto Color Emoji"];
defaultFonts.monospace = ["FiraCode Nerd Font" "Noto Mono CJK JP"];
defaultFonts.sansSerif = ["Liberation Sans" "Noto Sans CJK JP"];
defaultFonts.serif = ["Libertinus Serif" "Noto Serif CJK JP"];
};In the end, I still have to maintain a custom fonts directory just for Typst to be usable.
Reproduction URL
No response
Operating system
Linux
Typst version
- I am using the latest version of Typst
Activity
Andrew15-5 commentedon Feb 25, 2025
Actually, I think it's a duplicate of #185, since I've tried using
VFfiles locally and it still produces tofus. When I used a much bigger per-variant OTF font files, then it embeds things just fine.#5304 would've made this obvious.
Andrew15-5 commentedon Feb 25, 2025
I would've said that maybe the
noto-fonts-cjk-sanspackage should have a.staticoption, but since VF is actually much smaller, it makes sense that they use what they use.