Skip to content

๐Ÿ—š Print font information and metrics

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

tomcur/font-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

26 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

font-info ๐Ÿ—š

Print font information and metrics

MIT/Apache 2.0 Crates.io Build status

This is a cross-platform program that can parse font files and prints out information such as metrics and font style. It can find fonts installed or your system or you can point it to a specific font file.

Supported font formats:

  • OpenType
  • TrueType

Supported platforms:

  • Unix-like (Fontconfig)
  • Windows (DirectWrite; untested)
  • MacOS (Core Text; untested)

Usage

See $ font-info --help for CLI usage documentation. For example, to find all fonts in the "Liberation Sans" font family on your system and print out their metrics, run:

$ font-info --family-name "Liberation Sans"
-[ FONT 1 ]-------------------------------------------------
              Source: /path/to/share/fonts/truetype/LiberationSans-Bold.ttf
Font index in source: 0
              Weight: 700
               Style: normal
             Stretch: 1.00
         Glyph count: 2620
        Units per em: 2048
     Average advance: 1248
              Ascent: 1854
             Descent: 434
         Line height: 2288
             Leading: 67
      Capital height: 1409
          "x" height: 1082
    Stroke thickness: 215
    Underline offset: -2
    Strikeout offset: 530
-[ FONT 2 ]-------------------------------------------------
... etc

By default font-info produces human-readable output. To output as machine-readable JSON, run:

$ font-info --family-name "Liberation Sans" --format json

You can print fonts' features and supported writing systems using the --print-features and --print-writing-systems flags.

Installation

Install using Cargo:

$ cargo install font-info
$ font-info --family-name "Liberation Sans"

Run using Nix flakes:

# Run ls
$ nix run github:tomcur/font-info -- --family-name "Liberation Sans"

Dependencies

fontconfig

On Unix-like systems this program depends on fontconfig (and pkg-config for finding fontconfig during build). For example, for Debian or Ubuntu:

$ sudo apt install pkg-config libfontconfig-dev

About

๐Ÿ—š Print font information and metrics

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published