Skip to content

Instantly share code, notes, and snippets.

@7sDream
Last active May 11, 2024 11:23
Show Gist options
  • Save 7sDream/0bb194be42b8cb1f1926ca12151c8d76 to your computer and use it in GitHub Desktop.
Save 7sDream/0bb194be42b8cb1f1926ca12151c8d76 to your computer and use it in GitHub Desktop.
Pure rust font render library feature comparison

Pure rust font rendering related library comparison

Update time: 2024-05-11

Dev related

read-fonts skrifa ttf-parser rustybuzz ab_glyph glyph_brush fontdue allsorts swash cosmic-text
API Level L M L/M L H H H H M/H H
Minimal Deps × × ×
No Std × × × ×
WASM × × ×
Tests × ×
Good Document × ×

Steps

read-fonts skrifa ttf-parser rustybuzz ab_glyph glyph_brush fontdue allsorts swash cosmic-text
Loading read-fonts ttf-parser ttf-parser ttf-parser ttf-parser read-fonts swash
Shaping × × × × × × rustybuzz
or swash
Layout × × × × × glyph_brush_layout × ×
Rasterize × × × × ab_glyph_rasterizer ab_glyph × zeno swash

Note: that layout step is very depends on the info the shaping step gives. Layout API of one package may even do not accept shaping info if does not support shaping internally, so you can't glue two crates easily between those two step like other steps.

Loading

read-fonts skrifa ttf-parser allsorts swash
Zero allocation
OpenType
TrueType
WOFF × × × ×
WOFF2 × × × ×
Variable ×

Note1: fontdue uses ttf-parser for parsing font, but then builds a more convenient format from tables, which make allocations.

Note2: fontdue uses ttf-parser for parsing font, but do not provide an API to set variable axis, see fd#121.

Note3: cosmic-text uses swash for parsing font, but do not provide an API to set variable axis, see ct#4.

Shaping

TODO: Complicated scripts? LTR, RTL?

Layout

TODO: Auto word break? Wierd screen shape?

Rasterize

  • ×: means do not support a glyph data table.
  • R: means only give raw image data, you need process it according to it's format.
  • C: means only give curves, you need rasterize it.
  • M: means render to bitmap array automatically, you can directly render it.

Outline

read-fonts skrifa ttf-parser ab_glyph fontdue allsorts swash
glyf R C C M M C M
CFF R C C M M C M
CFF2 R C C M M × ×

Bitmap

read-fonts skrifa ttf-parser ab_glyph fontdue allsorts swash
EBDT/EBLC R R M M × M M
CBDT/CBLC R R M M × M M

Image

read-fonts skrifa ttf-parser ab_glyph fontdue allsorts swash
sbix PNG R R R R × R M
sbix JPEG R R × × × R ×
sbix TiFF R R × × × R ×
SVG × × R × × R ×

Color glyph

read-fonts skrifa ttf-parser ab_glyph fontdue allsorts swash
COLR/CPAL v0 R C C × × × M
COLR/CPAL v1 R C C × × × ×

Hinting

read-fonts skrifa ttf-parser ab_glyph fontdue allsorts swash
TrueType Hinting × × × ×

Render

glyph_brush cosmic-text
Cache glyph_brush_draw_cache
Output Type Texture and draw coords colored rectangles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment