Determining whether a glyph is available in Tkinter
tjreedy at udel.edu
Mon Dec 16 20:41:00 CET 2013
On 12/16/2013 12:32 PM, wmcbrine at gmail.com wrote:
> I have a Tkinter app that can optionally label some buttons with
> certain Unicode glyphs that aren't always available (depending on the
> OS, etc.).
It depends on the font in use. The best scenario would be to always use
the same unicode font. Idle, built on tkinter, has a configuration
dialog that gets a list of available fonts and sets the one the user
selects. I use Lucida Sans Unicode. It is not very pretty, but it seems
to cover much the BMP. AFAIK, it should be available on all Windows from
XP on. I do not know what comes with *nix and mac, but from reading
there seem to be TrueType fonts that you could install with your
software: FreeSerif (etc), GNU Unifont, (both GPL), BitstreamCyber (free
for non-commercial use). The font table linked above is followed by
table indicating something about coverage. Unifont is the champ.
> When they aren't available, Tkinter renders them as
> "\uNNNN". What I'd like to do is check whether the glyphs are
> available, and fall back to my own alternate text for the button if
> not. Can I do this?
Don't know. See the 'Utility software' section of the page above.
> I'd also like to do the same in pygtk.
Terry Jan Reedy
More information about the Python-list