Skip to content

Work with graphical font metrics and strings. Intended for use with, but doesn't require, Scenic

License

Notifications You must be signed in to change notification settings

ScenicFramework/font_metrics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FontMetrics

Overview

This library calculates text measurements using pre-generated font metrics data for specific fonts and sizes.

For example, this library helps determine the width and height of text strings when rendered in specific fonts and sizes.

This library was initially intended for use with the Scenic framework, but is also usable independently.

Installation

Add font_metrics to your dependencies in mix.exs to install FontMetrics:

def deps do
  [
    {:font_metrics, "~> 0.5"},
  ]
end

Generating Metrics

Generate font metrics data using the truetype_metrics package from hex. You can also find metrics data for Roboto and RobotoMono in the Scenic project.

0.5 Update

Version 0.5 introduces major changes, including word boundary wrapping and corrects width calculation issues.

It removes serialization in favor of returning the struct directly. This library should not dictate how to serialize its data. We recommend using something like :erlang.term_to_binary/2 for serialization. Scenic no longer requires this functionality, which highlighted the need for this change.

About

Work with graphical font metrics and strings. Intended for use with, but doesn't require, Scenic

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elixir 100.0%