7 releases (breaking)

0.6.0 Nov 13, 2024
0.5.1 Oct 2, 2024
0.5.0 Aug 27, 2024
0.4.0 Jun 1, 2024
0.1.0 Mar 27, 2023

#33 in Rendering

Download history 1352/week @ 2024-10-28 1239/week @ 2024-11-04 1464/week @ 2024-11-11 1179/week @ 2024-11-18 1689/week @ 2024-11-25 1666/week @ 2024-12-02 1526/week @ 2024-12-09 1479/week @ 2024-12-16 912/week @ 2024-12-23 875/week @ 2024-12-30 1433/week @ 2025-01-06 1161/week @ 2025-01-13 1089/week @ 2025-01-20 1088/week @ 2025-01-27 1576/week @ 2025-02-03 1432/week @ 2025-02-10

5,311 downloads per month
Used in 13 crates (2 directly)

Apache-2.0

24KB
287 lines

pixglyph

Crates.io Documentation

OpenType glyph rendering.

[dependencies]
pixglyph = "0.6"

Features

  • Render glyph outlines into coverage bitmaps.
  • Place glyphs at subpixel offsets and scale them to subpixel sizes. This is important if you plan to render more than a single glyph since inter-glyph spacing will look off if every glyph origin must be pixel-aligned.
  • No font data structure you have to store somewhere. Just owned glyphs which you can load individually from a font, cache if you care about performance, and then render at any size.
  • No unsafe code.

License

This crate is licensed under the terms of the Apache 2.0 license.


lib.rs:

OpenType glyph rendering.

  • Render glyph outlines into coverage bitmaps.
  • Place glyphs at subpixel offsets and scale them to subpixel sizes. This is important if you plan to render more than a single glyph since inter-glyph spacing will look off if every glyph origin must be pixel-aligned.
  • No font data structure you have to store somewhere. Just owned glyphs which you can load individually from a font, cache if you care about performance, and then render at any size.
  • No unsafe code.

Note on text: This library does not provide any capabilities to map text/characters to glyph ids. Instead, you should use a proper shaping library (like rustybuzz) to do this step. This will take care of proper glyph positioning, ligatures and more.

Note on emojis: This library only supports normal outlines. How to best render bitmap, SVG and colored glyphs depends very much on your rendering environment.

Dependencies

~765KB
~18K SLoC