Return the pixel width of the given strings for the given font
C Makefile
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
.gitignore
LICENSE
Makefile
README.asciidoc
Sourcedeps
txtw.c
txtw.h

README.asciidoc

txtw(1)

Name

txtw - Compute text widths

Synopsis

txtw [-h|-v|-f FONT|-s SIZE|-F ALT_FONT|-S ALT_SIZE] STRING …​

Description

Returns the width in pixels of the given strings for the the given font.

Options

-h

Print the synopsis to standard output and exit.

-v

Print the version information to standard output and exit.

-f FONT

Set the main font.

-s SIZE

Set the size of the main font.

-F ALT_FONT

Set the alternate font.

-S ALT_SIZE

Set the size of the alternate font.

String Syntax

By default the main font is used to compute the width.

The alternate font is used for the parts of the string enclosed between \( and \).

Example

txtw -f 'DejaVu Sans' -s 11 -F SimpleIcons -S 16 'One \(U\) Two \(D\) Three'

Author

Bastien Dejean <nihilhill at gmail.com>