#font

pixglyph

Font-rendering with subpixel positioning

2 unstable releases

0.2.0 Sep 13, 2023
0.1.0 Mar 27, 2023

#58 in Rendering

Download history 818/week @ 2023-06-05 528/week @ 2023-06-12 637/week @ 2023-06-19 1236/week @ 2023-06-26 831/week @ 2023-07-03 455/week @ 2023-07-10 440/week @ 2023-07-17 459/week @ 2023-07-24 618/week @ 2023-07-31 822/week @ 2023-08-07 968/week @ 2023-08-14 1136/week @ 2023-08-21 605/week @ 2023-08-28 687/week @ 2023-09-04 1421/week @ 2023-09-11 924/week @ 2023-09-18

3,961 downloads per month
Used in typst-ts-raster-exporter

Apache-2.0

23KB
285 lines

pixglyph

Crates.io Documentation

OpenType glyph rendering.

[dependencies]
pixglyph = "0.1"

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

~660KB
~16K SLoC