Font chooser


I was wondering if there is a way to launch a font selection dialog so a user can select a font that will be used for a display. Something that would work like system.gui.choosecolor does for color selection.


In parallel to the font chooser question, is there any way to change the mapping of the Java logical fonts (e.g., dialog, monospaced, etc.) from within the Vision module?

I’ll see what we can do for a font selector. You should be able to pretty easily do this yourself though. Heres a way to get a list of all the fonts installed on a system, turn them into a dataset, and populate a dropdown with that dataset.

[code]dropdown = event.source.parent.getComponent(“Dropdown”)

from java.awt import GraphicsEnvironment
env = GraphicsEnvironment.getLocalGraphicsEnvironment()
fonts = env.getAvailableFontFamilyNames()

headers = [‘Font Name’]
rows = []
for font in fonts:
rows.append([font]) = system.dataset.toDataSet(headers, rows)[/code]

From there you can simple create a new java.awt.Font. Let us know if you go this route and get stuck.

As far as re-mapping the logical fonts: sorry, no. I think this is done by the JVM when starting up and is inaccessible to us.