getutline - Linux


Overview

getutline extracts Unicode character outlines from font files. It is particularly useful for generating glyph bitmaps and for computing the width and height of text strings.

Syntax

getutline [options] font-file character-string

Options/Flags

  • -d Display outline details (full list of points)
  • -h Display outline using hexadecimal format
  • -i Invert outline (useful for computing inside widths, etc.)
  • -m Display min size bbox only
  • -p Display path of outline (as defined in font)
  • -s Display outline points scaled by size value
  • -t Display outline type bits (for TrueType fonts)
  • -w Display width and height of rendered text

Examples

Get outline details for character "A" in font "font.ttf"

getutline font.ttf A

Display path and size of "Hello World" in font "font.ttf"

getutline -pm font.ttf "Hello World"

Extract outline of all characters in font "font.ttf"

findfont -c font.ttf | getutline font.ttf

Generate bitmap for character "A" in font "font.ttf"

convert -size 24x24 xc:white -fill black -draw @getutline:font.ttf:A a.png

Common Issues

  • Characters not displayed correctly: Ensure that the font file contains valid Unicode character outlines and that the character string is valid UTF-8.
  • Outline points too small or large: Adjust the -s option to scale the outline appropriately.

Integration

  • ImageMagick: Use getutline to generate glyph bitmaps for text rendering.
  • Ghostscript: Use getutline to extract font outlines for PDF generation.
  • Bash: Create scripts to automate outline extraction and bitmap generation for various fonts and character strings.

Related Commands

  • findfont
  • convert (ImageMagick)
  • gsedit (Ghostscript)