Skip to content

Repository files navigation

Glyphic

Bitmap and outline font rendering for Ruby graphics.

Gem Version Downloads Ruby Version License

Features · Installation · Quick Start


Glyphic loads BDF bitmap fonts and TrueType outlines, measures UTF-8 text, and draws it onto Tessel RGBA8 images.

Features

  • BDF bitmap font loading.
  • TrueType (.ttf) outline loading and rasterization.
  • UTF-8 text measurement, wrapping, and text boxes.
  • Fallback chains for missing glyphs.
  • Direct rendering into Tessel images.
  • A built-in font for examples and tools.

Installation

Add Glyphic to your Gemfile:

gem "glyphic"

Then run:

bundle install

Or install the released gem:

gem install glyphic

Requirements

  • Ruby 3.1 or newer.
  • Tessel is installed automatically as a runtime dependency.

Quick Start

require "glyphic"
require "tessel"

font = Glyphic.default
image = Tessel::Image.new(240, 40, fill: "#101827")
font.draw(image, 4, 4, "Hello, rbgfx", color: "#ffffff")
image.write("hello.png")

Load an external font with Glyphic.load(path). BDF and TrueType fonts are supported; CFF/OpenType outlines are currently unsupported.

Development

bundle install
bundle exec rake verify

Contributing

Bug reports and pull requests are welcome at rbgfx/glyphic.

License

MIT

About

Load BDF and TrueType fonts, measure UTF-8 text, and render it onto Tessel images.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages