#font-rendering #font #text-rendering

pixglyph

Font-rendering with subpixel positioning

5 releases (breaking)

0.5.0 Aug 27, 2024
0.4.0 Jun 1, 2024
0.3.0 Dec 18, 2023
0.2.0 Sep 13, 2023
0.1.0 Mar 27, 2023

#36 in Rendering

Download history 1035/week @ 2024-05-22 789/week @ 2024-05-29 942/week @ 2024-06-05 791/week @ 2024-06-12 756/week @ 2024-06-19 611/week @ 2024-06-26 996/week @ 2024-07-03 697/week @ 2024-07-10 884/week @ 2024-07-17 701/week @ 2024-07-24 837/week @ 2024-07-31 651/week @ 2024-08-07 765/week @ 2024-08-14 922/week @ 2024-08-21 1039/week @ 2024-08-28 749/week @ 2024-09-04

3,546 downloads per month
Used in 6 crates (2 directly)

Apache-2.0

23KB
285 lines

pixglyph

Crates.io Documentation

OpenType glyph rendering.

[dependencies]
pixglyph = "0.5"

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

~750KB
~18K SLoC