Project

glyphic

0.0
The project is in a healthy, maintained state
BDF text rendering and layout on Tessel RGBA8 images.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0.1.0, < 1
 Project Readme

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