vcl: Create listfonts utility

Desktop / LibreOffice - Chris Sherlock [] - 8 January 2022 11:58 UTC

The listfonts utility gets the details of all available fonts on the system. It prints out the information, or stores it in a text file, if a file name is passed to it as an argument.

An example invocation to store the information in a file named fonts.txt is:

./bin/run listfonts fonts.txt

To get the correct font metrics, you actually have to get the font metric from the system, and then set it as the current font of OutputDevice, then get the font metric (which corrects a variety of things like the orientation, line, height, slant, etc. - including converting from logical coords to device coords).

The information is reported for each font family. On the top is the family name, and then comes other details. Here is a report for an example font:

FreeSans Family type: swiss Style name: Regular Weight: normal Italic: none Pitch: variable Width type: normal Alignment: top Charset: UCS2 (aka Unicode) Symbol font? no Ascent: 13 Descent: 3 Internal leading: 0 External leading: 2 Line height: 16 Slant: 0 Bullet offset: 0 Fullstop centered? yes Orientation: 0 degrees Quality: 18477

There is a -v (or --verbose) option that output font features.

Change-Id: Icfc4da96459bea47c4233a5509496566c04d460c Reviewed-on:

dabeab27dae5 vcl: Create listfonts utility | 5 +-
include/tools/fontenum.hxx | 374 ++++++++++++++++++++++++++++++
vcl/ | 36 +++
vcl/ | 1 +
vcl/workben/listfonts.cxx | 541 ++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 955 insertions(+), 2 deletions(-)


  • Share