Skip to content

Also select font via unprettified family name #2098

Open

Description

@laurmaedje

Description

Typst prettifies some font names, but ideally the true name should also work, that is, in the example below both line 2 and 3 should render in New CM.

Hello \
#text(font: "NewComputerModern10")[Hello] \
#text(font: "New Computer Modern")[Hello]

Moreover, conceivably a font could be selectable via full name or perhaps also PostScript name:

_Hello_ \
#text(font: "Linux Libertine Italic")[Hello]

Use Case

More compatibility.

Activity

  1. added
    feature request
    text
    on Sep 9, 2023
  2. Leedehai commented on Dec 12, 2023

    @Leedehai
    Contributor

    I can take a look at this. I kinda familiarized myself with the fonts while investigating #2917. If the maintainers are willing, let's open a Forge thread?

  3. laurmaedje commented on Dec 13, 2023

    @laurmaedje
    MemberAuthor

    I'll open one.

  4. tornaria commented on Dec 15, 2023

    @tornaria

    Maybe related: there seems to be no way to select font by size. For example,

    #set text(font: "Latin Modern Sans", size: 17pt)
    
    Hello, world!
    

    uses an 8pt font:

    $ pdffonts LM17.pdf 
    name                                 type              encoding         emb sub uni object ID
    ------------------------------------ ----------------- ---------------- --- --- --- ---------
    AKPPLH+LMSans8-Regular-Identity-H    CID Type 0C       Identity-H       yes yes yes      4  0
    

    but I do have a "Latin Modern Sans" in 17pt installed:

    $ fc-scan --format="%{file} / %{family} / %{style}\n" /usr/share/fonts/latinmodern/lmsans[0-9]*.otf
    /usr/share/fonts/latinmodern/lmsans10-bold.otf / Latin Modern Sans,LM Sans 10 / 10 Bold,Bold
    /usr/share/fonts/latinmodern/lmsans10-boldoblique.otf / Latin Modern Sans,LM Sans 10 / 10 Bold Oblique,Bold Italic
    /usr/share/fonts/latinmodern/lmsans10-oblique.otf / Latin Modern Sans,LM Sans 10 / 10 Oblique,Italic
    /usr/share/fonts/latinmodern/lmsans10-regular.otf / Latin Modern Sans,LM Sans 10 / 10 Regular,Regular
    /usr/share/fonts/latinmodern/lmsans12-oblique.otf / Latin Modern Sans,LM Sans 12 / 12 Oblique,Italic
    /usr/share/fonts/latinmodern/lmsans12-regular.otf / Latin Modern Sans,LM Sans 12 / 12 Regular,Regular
    /usr/share/fonts/latinmodern/lmsans17-oblique.otf / Latin Modern Sans,LM Sans 17 / 17 Oblique,Italic
    /usr/share/fonts/latinmodern/lmsans17-regular.otf / Latin Modern Sans,LM Sans 17 / 17 Regular,Regular
    /usr/share/fonts/latinmodern/lmsans8-oblique.otf / Latin Modern Sans,LM Sans 8 / 8 Oblique,Italic
    /usr/share/fonts/latinmodern/lmsans8-regular.otf / Latin Modern Sans,LM Sans 8 / 8 Regular,Regular
    /usr/share/fonts/latinmodern/lmsans9-oblique.otf / Latin Modern Sans,LM Sans 9 / 9 Oblique,Italic
    /usr/share/fonts/latinmodern/lmsans9-regular.otf / Latin Modern Sans,LM Sans 9 / 9 Regular,Regular
    
    
    

    In fact, it seems typst finds all of these fonts:

    $ typst fonts --variants
    [...]
    Latin Modern Sans
    - Style: Normal, Weight: 700, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 600, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 700, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 600, Stretch: FontStretch(1000)
    [...]
    

    But it will only use the 8pt font lmsans8-regular.otf. If I move away this file, it will then choose the 17pt one lmsans17-regular.otf.

    Note that the 17pt font is not the same as the 8pt scaled to 17pt (which is what typst produces).

  5. inferiorhumanorgans commented on Aug 10, 2024

    @inferiorhumanorgans
    Contributor

    With Roboto and Roboto Condensed installed there's no way to select a specific variant.

    https://fonts.google.com/specimen/Roboto

    https://fonts.google.com/specimen/Roboto+Condensed

    $ typst fonts --variants
    …
    Roboto
    - Style: Normal, Weight: 500, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 300, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 500, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 250, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 700, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 300, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 900, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 700, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 250, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 900, Stretch: FontStretch(1000)
    

    Note that Roboto Condensed is a variable font so even though it's only showing up at weight=400, it's valid for any weight.

    Being able to select a weight by name is also be a nice to have and that would be captured by the PostScript name. Fonts like e.g. Bell Centennial have non-standard names (Address, Name & Number, Sub-Caption, Bold Listing) for their weights and it would be nice to not have to manually map them to numeric values. Others like FF Meta have two variants at the same weight with different names.

  6. TechnicJelle commented on Nov 10, 2024

    @TechnicJelle

    I just installed Typst for the first time today, as well, to try and re-make my resume in it.
    But my preferred font is Roboto, so I have also run into this issue now.
    I do not know what to do to properly fix it.

    My old resume, in LibreOffice:
    image

    What Typst makes of it:
    image

    The normal body text is fine, but any bold or heading text is condensed against my wishes.

    My "code" is super simple for now, as I have not got further than this:

    #set page(
    	paper: "a4",
    	margin: (x: 0.5cm, y: 0.7cm),
    )
    #set text(
    	font: "Roboto",
    	size: 11pt,
    )
    
    // *snip*
    
    == Education
    
    === Bachelor of Creative Media and Game Technologies Sept 2021 - Present
    At *Saxion University of Applied Sciences*

    I would love a fix for this issue. In my opinion font: "Roboto" should use the Roboto font, and not Roboto Condensed.

  7. terefang commented on Nov 24, 2024

    @terefang

    you might want also to look at my ticket #5455

  8. TechnicJelle commented on Nov 25, 2024

    @TechnicJelle

    Currently, I worked around this issue by ignoring the system fonts, and supplying my own specific font files.
    Like this:

    typst compile resume.typ --font-path ./Fonts/ --ignore-system-fonts
    My specific file structure
    .
    ├── compile.sh
    ├── Fonts
    │   ├── fontawesome-free-6.6.0-desktop
    │   │   ├── Font Awesome 6 Brands-Regular-400.otf
    │   │   ├── Font Awesome 6 Free-Regular-400.otf
    │   │   └── LICENSE.txt
    │   ├── JetBrainsMono-2.304
    │   │   ├── AUTHORS.txt
    │   │   ├── JetBrainsMono-Regular.ttf
    │   │   └── OFL.txt
    │   ├── Noto Color Emoji
    │   │   ├── NotoColorEmoji-Regular.ttf
    │   │   └── OFL.txt
    │   ├── Roboto
    │   │   ├── LICENSE.txt
    │   │   ├── Roboto-BlackItalic.ttf
    │   │   ├── Roboto-Black.ttf
    │   │   ├── Roboto-BoldItalic.ttf
    │   │   ├── Roboto-Bold.ttf
    │   │   ├── Roboto-Italic.ttf
    │   │   ├── Roboto-LightItalic.ttf
    │   │   ├── Roboto-Light.ttf
    │   │   ├── Roboto-MediumItalic.ttf
    │   │   ├── Roboto-Medium.ttf
    │   │   ├── Roboto-Regular.ttf
    │   │   ├── Roboto-ThinItalic.ttf
    │   │   └── Roboto-Thin.ttf
    │   └── simple-icons-font-9.19.0
    │       ├── DISCLAIMER.md
    │       ├── LICENSE.md
    │       ├── SimpleIcons.otf
    │       └── SimpleIcons.otf.7z
    ├── resume.pdf
    └── resume.typ
    

    Yes, there is font duplication now, but the additional advantage of this (aside from it working) is that other devices can compile it as well, without having to have those fonts installed.

  9. terefang commented on Nov 25, 2024

    @terefang

    Note that Roboto Condensed is a variable font so even though it's only showing up at weight=400, it's valid for any weight.

    if i remember correctly, variable font files are not valid for pdf embedding.

  10. inferiorhumanorgans commented on Nov 25, 2024

    @inferiorhumanorgans
    Contributor

    Roboto should be available in a non variable version and I would use that instead as variable fonts have limited support for now. Roboto vs Roboto Condensed comes down to ttf-parser not looking in every last location where a font can specify its stretch.

    As of ttf-parser 0.25.0 the STAT table is parsed and can be checked. This should allow typst to get condensed versions of Roboto identified properly as condensed. This allows typst to check for correct information but has not (yet) been included in ttf-parser's is_bold and is_italic functions. See also #576. Unfortunately, I believe there are some breaking changes going from ttf-parser 0.24 to 0.25.

    Related, I've not had the bandwidth recently to finish up the PANOSE support (harfbuzz/ttf-parser#172), so some older fonts are still out of luck if their OS/2 table only has correct information in the PANOSE field.

    Short term the more more correct end-user fix is to use the static version of Roboto and add an exception to typst here for your local builds:

    https://github.com/typst/typst/blob/main/crates/typst-library/src/text/font/exceptions.rs

  11. terefang commented on Nov 27, 2024

    @terefang

    As of ttf-parser 0.25.0 the STAT table is also checked and this should get condensed versions of Roboto identified properly as condensed.

    let me add a reality check here – i recently bought a commercial grade font-bundle from a german manufacturer targetted at the SMB/KMU market.

    1 - non of the files contains a STAT table.

    2 - using (version 0.12.0) typst fonts --ignore-system-fonts --font-path ./ --variants i get

    Limerick Antique
    - Style: Italic, Weight: 800, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 900, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 250, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 500, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 300, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 700, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 700, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 250, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 300, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 800, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 900, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 500, Stretch: FontStretch(1000)
    Limerick Cd Antique
    - Style: Normal, Weight: 900, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 250, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 800, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 900, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 700, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 500, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 500, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 250, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 300, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 800, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 300, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 700, Stretch: FontStretch(1000)
    

    for

    Limerick-Antique-BoldItalic.ttf
    Limerick-Antique-Bold.ttf
    Limerick-Antique-HeavyItalic.ttf
    Limerick-Antique-Heavy.ttf
    Limerick-Antique-Italic.ttf
    Limerick-Antique-LightItalic.ttf
    Limerick-Antique-Light.ttf
    Limerick-Antique-MediumItalic.ttf
    Limerick-Antique-Medium.ttf
    Limerick-Antique-Regular.ttf
    Limerick-Antique-XboldItalic.ttf
    Limerick-Antique-Xbold.ttf
    Limerick-Antique-XlightItalic.ttf
    Limerick-Antique-Xlight.ttf
    Limerick-Cd-Antique-BoldItalic.ttf
    Limerick-Cd-Antique-Bold.ttf
    Limerick-Cd-Antique-HeavyItalic.ttf
    Limerick-Cd-Antique-Heavy.ttf
    Limerick-Cd-Antique-Italic.ttf
    Limerick-Cd-Antique-LightItalic.ttf
    Limerick-Cd-Antique-Light.ttf
    Limerick-Cd-Antique-MediumItalic.ttf
    Limerick-Cd-Antique-Medium.ttf
    Limerick-Cd-Antique-Regular.ttf
    Limerick-Cd-Antique-XboldItalic.ttf
    Limerick-Cd-Antique-Xbold.ttf
    Limerick-Cd-Antique-XlightItalic.ttf
    Limerick-Cd-Antique-Xlight.ttf
    

    3 - i also took a "Pro" version font family to the test:

    Bodoni Antiqua Pro
    - Style: Italic, Weight: 700, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 600, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 300, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 600, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 700, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 600, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 700, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 600, Stretch: FontStretch(1000)
    - Style: Italic, Weight: 300, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 700, Stretch: FontStretch(1000)
    Bodoni Antiqua Pro Caps
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 300, Stretch: FontStretch(1000)
    Bodoni Antiqua Pro Compress
    - Style: Normal, Weight: 400, Stretch: FontStretch(1000)
    - Style: Normal, Weight: 700, Stretch: FontStretch(1000)
    

    for

    Bodoni-Antiqua-Pro-BoldItalic.ttf
    Bodoni-Antiqua-Pro-Bold.ttf
    Bodoni-Antiqua-Pro-Caps-Light.ttf
    Bodoni-Antiqua-Pro-Caps-Regular.ttf
    Bodoni-Antiqua-Pro-Cd-BoldItalic.ttf
    Bodoni-Antiqua-Pro-Cd-Bold.ttf
    Bodoni-Antiqua-Pro-Cd-DemiItalic.ttf
    Bodoni-Antiqua-Pro-Cd-Demi.ttf
    Bodoni-Antiqua-Pro-Cd-Italic.ttf
    Bodoni-Antiqua-Pro-Cd-Regular.ttf
    Bodoni-Antiqua-Pro-Compress-Bold.ttf
    Bodoni-Antiqua-Pro-Compress-Regular.ttf
    Bodoni-Antiqua-Pro-DemiItalic.ttf
    Bodoni-Antiqua-Pro-Demi.ttf
    Bodoni-Antiqua-Pro-Italic.ttf
    Bodoni-Antiqua-Pro-LightItalic.ttf
    Bodoni-Antiqua-Pro-Light.ttf
    Bodoni-Antiqua-Pro-Regular.ttf
    

    i am willing to work with the manufacturer to fix their fonts – what should i tell them exactly ?

  12. inferiorhumanorgans commented on Nov 27, 2024

    @inferiorhumanorgans
    Contributor

    @terefang Whoever sold you those fonts should fix them. typst is getting the weight and/or slant wrong because ttf-parser is being fed incorrect information and not (as of 0.24) checking the additional places where correct information may (or may not) exist. typst currently uses ttf-parser 0.24.

    As of 0.25 ttf-parser provides primitives to mitigate some of this, however looking at harfbuzz/ttf-parser#166, the changes to check STAT for weight and slant in the higher level functions didn't get included.

    For diagnostic information start here:

    #576 (comment)

  13. inferiorhumanorgans commented on Nov 27, 2024

    @inferiorhumanorgans
    Contributor

    That said I think a mechanism to select a font by its Postscript name would be a big win.

  14. terefang commented on Nov 27, 2024

    @terefang

    let me add:

    $ fc-scan --format="%{file} | %{family} | %{style} | %{width} | %{postscriptname}\n" *.ttf|sort
    Bodoni-Antiqua-Pro-BoldItalic.ttf | Bodoni Antiqua Pro | Bold Italic | 100 | BodoniAntiquaPro-BoldItalic
    Bodoni-Antiqua-Pro-Bold.ttf | Bodoni Antiqua Pro | Bold | 100 | BodoniAntiquaPro-Bold
    Bodoni-Antiqua-Pro-Caps-Light.ttf | Bodoni Antiqua Pro Caps,Bodoni Antiqua Pro Caps Light | Light,Regular | 100 | BodoniAntiquaProCaps-Light
    Bodoni-Antiqua-Pro-Caps-Regular.ttf | Bodoni Antiqua Pro Caps | Regular | 100 | BodoniAntiquaProCaps
    Bodoni-Antiqua-Pro-Cd-BoldItalic.ttf | Bodoni Antiqua Pro Cd | Bold Italic | 100 | BodoniAntiquaProCd-BoldItalic
    Bodoni-Antiqua-Pro-Cd-Bold.ttf | Bodoni Antiqua Pro Cd | Bold | 100 | BodoniAntiquaProCd-Bold
    Bodoni-Antiqua-Pro-Cd-DemiItalic.ttf | Bodoni Antiqua Pro Cd,Bodoni Antiqua Pro Cd Demi | Demi Italic,Italic | 100 | BodoniAntiquaProCd-DemiItalic
    Bodoni-Antiqua-Pro-Cd-Demi.ttf | Bodoni Antiqua Pro Cd,Bodoni Antiqua Pro Cd Demi | Demi,Regular | 100 | BodoniAntiquaProCd-Demi
    Bodoni-Antiqua-Pro-Cd-Italic.ttf | Bodoni Antiqua Pro Cd | Italic | 100 | BodoniAntiquaProCd-Italic
    Bodoni-Antiqua-Pro-Cd-Regular.ttf | Bodoni Antiqua Pro Cd | Regular | 100 | BodoniAntiquaProCd
    Bodoni-Antiqua-Pro-Compress-Bold.ttf | Bodoni Antiqua Pro Compress | Bold | 100 | BodoniAntiquaProCompress-Bold
    Bodoni-Antiqua-Pro-Compress-Regular.ttf | Bodoni Antiqua Pro Compress | Regular | 100 | BodoniAntiquaProCompress
    Bodoni-Antiqua-Pro-DemiItalic.ttf | Bodoni Antiqua Pro,Bodoni Antiqua Pro Demi | Demi Italic,Italic | 100 | BodoniAntiquaPro-DemiItalic
    Bodoni-Antiqua-Pro-Demi.ttf | Bodoni Antiqua Pro,Bodoni Antiqua Pro Demi | Demi,Regular | 100 | BodoniAntiquaPro-Demi
    Bodoni-Antiqua-Pro-Italic.ttf | Bodoni Antiqua Pro | Italic | 100 | BodoniAntiquaPro-Italic
    Bodoni-Antiqua-Pro-LightItalic.ttf | Bodoni Antiqua Pro,Bodoni Antiqua Pro Light | Light Italic,Italic | 100 | BodoniAntiquaPro-LightItalic
    Bodoni-Antiqua-Pro-Light.ttf | Bodoni Antiqua Pro,Bodoni Antiqua Pro Light | Light,Regular | 100 | BodoniAntiquaPro-Light
    Bodoni-Antiqua-Pro-Regular.ttf | Bodoni Antiqua Pro | Regular | 100 | BodoniAntiquaPro
    
  15. inferiorhumanorgans commented on Nov 27, 2024

    @inferiorhumanorgans
    Contributor

    Right, see my comment above for information on how to get more detailed information from your fonts.

  16. terefang commented on Nov 27, 2024

    @terefang

    yeah ... but what about if the fonts cannot be fixed because of complex licensing issues ?

    then it would make sense to have something in place like i proposed in #5455

  17. terefang commented on Nov 27, 2024

    @terefang

    Right, see my comment above for information on how to get more detailed information from your fonts.

    do you suggest that i need to install a complete rust dev environment just to get the debugging utility ?

    which has build errors btw

  18. terefang commented on Nov 27, 2024

    @terefang

    maybe a more common tool could be used like ttfdump ?

    $ ttfdump Bodoni-Antiqua-Pro-Cd-Regular.ttf -t 'OS/2'
    .....
    'OS/2' Table - OS/2 and Windows Metrics
    ---------------------------------------
    	 'OS/2' version:	 3
    	 xAvgCharWidth:		 432
    	 usWeightClass:		 400 	 'Normal'
    	 usWidthClass:		 5 	 'Medium'
    	 fsType:		 4
    	 ySubscriptXSize:	 700
    	 ySubscriptYSize:	 650
    	 ySubscriptXOffset:	 0
    	 ySubscriptYOffset:	 140
    	 ySuperscriptXSize:	 700
    	 ySuperscriptYSize:	 650
    	 ySuperscriptXOffset:	 0
    	 ySuperscriptYOffset:	 477
    	 yStrikeoutSize:	 50
    	 yStrikeoutPosition	 250
    	 sFamilyClass:	 0 	 subclass = 0
    	 PANOSE:
    		 Family Kind:	 2 	 'Text and Display'
    		 Serif Style:	 0 	 'Any'
    		 Weight:	 5 	 'Book'
    		 Proportion:	 6 	 'Condensed'
    		 Contrast:	 8 	 'High'
    		 Stroke:	 0 	 'Any'
    		 Arm Style:	 0 	 'Any'
    		 Lettreform:	 2 	 'Normal/Contact'
    		 Midline:	 0 	 'Any'
    		 X-height:	 3 	 'Constant/Standard'
    	 Unicode Range 1( Bits 0 - 31 ): 	 0xa000006f
    	 Unicode Range 2( Bits 32 - 63 ): 	 0x500078bb
    	 Unicode Range 3( Bits 64 - 95 ): 	 0x00000000
    	 Unicode Range 4( Bits 96 - 128 ): 	 0x00000000
    	 achVendID:		 'smak'
    	 fsSelection:		 0x0040 	 'Regular '
    	 usFirstCharIndex:	 0x0020
     	 usLastCharIndex:	 0xfb04
    	 sTypoAscender:		 667
    	 sTypoDescender:	 -200
    	 sTypoLineGap:		 44
    	 usWinAscent:		 859
    	 usWinDescent:		 267
    	 CodePage Range 1( Bits 0 - 31 ):	 0x20000093
    	 CodePage Range 2( Bits 32- 63 ):	 0x4d000000
    	 sxHeight:		 427
    	 sCapHeight:		 667
    	 usDefaultChar:		 0x0000
    	 usBreakChar:		 0x0020
    	 usMaxContext:		 5
    

    looks like the usWidthClass is wrong.

  19. terefang commented on Jan 24, 2025

    @terefang

    any thoughts on this ? also referencing #5455

  20. added
    change request
    and removed
    feature request
    on Feb 24, 2025
  21. terefang commented on Feb 26, 2025

    @terefang

    thx @laurmaedje , your reassignment to "change request" gives me hope that this will be handled soon, or isnt it ?

  22. laurmaedje commented on Feb 26, 2025

    @laurmaedje
    MemberAuthor

    @terefang It was just triaging and making use of the new label. It has no implications on priorities. I understand that you consider this important and it's true that font handling is quite broken, but there a lot of things to do and pinging me regularly will not make it go any faster.

  23. terefang commented on Mar 2, 2025

    @terefang

    let me just clarify:

    although typst is somewhat "the new kid on the block", i consider it already an alternative if not the successor to latex and other pdf generating tools.

    so many cheers to all the developers making this possible.

    why is font handling so important to me ? because it is the only blocker that prohibits me from switching over to typst with all its glory and features.

    i have written pdf generation libs in both Perl and Java in the past along with work in the LaTeX, HTML and CSS domains, so know my way around fonts both in format specs bit-by-bit wise and actual handling.

    i would like to contribute code to make your life easier, but unfortunately learning rust from scratch isnt something that i can fit into my time-table.

    so far i am only able to contribute ideas and suggestions, if that bandwidth is too high i will tone down the frequency.

    sorry if i have bothered you too much.

  24. terefang commented on May 27, 2025

    @terefang
  25. alerque commented on May 28, 2025

    @alerque
    Contributor

    @terefang Just fix the font. It isn't very hard to modify the family name tables to something that works for your use case or just copy the different variants into your own face instances. Of course Typst should handle this more gracefully, but you aren't dependent on it getting fixed to move your project on.

  26. terefang commented on May 28, 2025

    @terefang

    @terefang Just fix the font. It isn't very hard to modify the family name tables to something that works for your use case or just copy the different variants into your own face instances. Of course Typst should handle this more gracefully, but you aren't dependent on it getting fixed to move your project on.

    unfortunately in my case these are commercial fonts --- i dont have a license to modify that font, only use it as is.

    do you see the dilemma ? even if i would technically be able to fix the fonts --- i cannot use them because i would be breaking the license agreement (and the law) and be wide open to litigation.

  27. YDX-2147483647 commented on Oct 25, 2026

    @YDX-2147483647
    Contributor

    Some counterexamples of the style suffixes assumed by Typst:

    • Noto Sans Old Italic becomes Noto Sans Old.

      Old Italic (U+10300..U+1032F) is an ancient writing systems used in the Italian Peninsula. The alphabet starts with 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌈.

      It is not the italic version of Noto Sans Old. The latter does not exist.

    • Source Han Sans CN becomes Source Han Sans.

      The suffix means that the font only covers the glyphs for characters used in the particular region — China in this case (region-specific SubsetOTF for China / Simplified Chinese). Adobe also publishes Source Sans Sans TW/HK/JP/KR.

      It is not the condensed version of Source Han Sans. The latter is another font with full character coverage that sets Japanese glyphs as the defaults (language-specific OTF for Japan / Japanese).

    • SimSun-ExtB becomes SimSun (the exception added in Fix SimSun-ExtB being incorrectly merged with SimSun #8042).

      The suffix means the Unicode block CJK Unified Ideographs Extension B. There is also SimSun-ExtG. There are too many Han/CJK characters, so SimSun split them into three files:

      • simsun.ttc (SimSun, NSimSun) covers CJK Unified Ideographs, CJK Compatibility Ideographs, Ideographic Description Characters, and CJK Unified Ideographs Extension A;
      • simsunb.ttf (SimSun-ExtB) covers CJK Unified Ideographs Extension B to F;
      • SimsunExtG.ttf (SimSun-ExtG) covers CJK Unified Ideographs Extension G to I.

      SimSun-ExtB is not the extra bold version of SimSun.

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

    change requesttext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions