1. anatoly techtonik
  2. fontquery


fontquery /

Filename Size Date modified Message
270 B
1.2 KB
16.7 KB
Query operating system fonts with pure Python on Windows.

Usually, you ship all the fonts needed for your game or app
with graphics, because fonts are important. But sometimes you
just need a fallback.

NOTES (Windows): In Windows fonts are referenced by name, which
is embedded into file. There is no official way to get filename
of the font through Windows API (manual loading or whatever).

### API

This module exposes two functions:

have_font(name, refresh=False)

  Checks if specified system font is preset. The list of system
  fonts is cached. To purge cache, use refresh parameter.

  >>> import fontquery
  >>> fontquery.have_font('Arial')


  Returns names of all system installed fonts.


  0.6 - return sorted list of names without duplicates
  0.5 - filter out vertical fonts (which names start with @)
  0.4 - fix monospace font detection, patch by Claudio Canepa
  0.3 - suport querying monospace fonts
  0.2 - wrap font info into FontEntry objects
  0.1 - initial release

Public domain work by anatoly techtonik <techtonik@gmail.com>
Use MIT License if public domain doesn't make sense for you.