42 releases (13 breaking)

new 0.14.0 Mar 24, 2025
0.12.0 Jan 14, 2025
0.11.3 Dec 26, 2024
0.11.2 Nov 17, 2024
0.1.0 Sep 28, 2020

#14 in Graphics APIs

Download history 6777/week @ 2024-12-07 7722/week @ 2024-12-14 5626/week @ 2024-12-21 5308/week @ 2024-12-28 7133/week @ 2025-01-04 9680/week @ 2025-01-11 7706/week @ 2025-01-18 6654/week @ 2025-01-25 9548/week @ 2025-02-01 11882/week @ 2025-02-08 7997/week @ 2025-02-15 8011/week @ 2025-02-22 8493/week @ 2025-03-01 9297/week @ 2025-03-08 10791/week @ 2025-03-15 7421/week @ 2025-03-22

37,218 downloads per month
Used in 34 crates (16 directly)

MIT/Apache

395KB
9K SLoC

Crates.io API dependency status rust: 1.70 Discord

femtovg

GPU Antialiased 2D vector drawing library written in Rust.


Ported from https://github.com/memononen/nanovg

Most of the implementation is the same as the original C code with some bug fixes, some features added and several parts have been made more Rust-y. Rendering is done via one OpenGl (ES) 3.0+ backend.

Screenshots

Demo

demo Run with cargo run --example demo

Breakout

breakout Run with cargo run --example breakout

SVG

svg Run with cargo run --example svg

Text

text Run with cargo run --example text

Features

  • Anti-aliasing
  • Bézier paths filling and stroking
  • Solid color and image pattern fills and strokes
  • Gradients - box, linear and radial
  • Stroke width and miterlimit
  • Stroke caps: butt, round and square
  • Stroke joins: miter, round and bevel
  • Fill rules - EvenOdd/NonZero
  • Rectangle scissoring
  • Composition modes (SourceOver, SourceIn, SourceOut, Atop, etc..)
  • Global alpha
  • Text filling and stroking
  • Text shaping
  • Text alignment: (left center right), (top, middle, alphabetic, bottom)
  • Nearest font matching
  • Path hit testing
  • OpenGl ES2 backend
  • WGPU backend
  • Color fonts

Not supported

  • Stroke dashing
  • Path scissoring
  • Custom shaders
  • 3D transforms

Ecosystem

FemtoVG is used by these projects:

License

Licensed under either of

Fonts used in examples:

Dependencies

~7–39MB
~613K SLoC