Crates.io | font-info |
lib.rs | font-info |
version | 0.1.0 |
source | src |
created_at | 2024-07-26 13:09:40.319595 |
updated_at | 2024-07-26 13:09:40.319595 |
description | Print font information and metrics |
homepage | |
repository | https://github.com/tomcur/font-info |
max_upload_size | |
id | 1316102 |
size | 51,920 |
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:
Supported platforms:
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.
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"
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