getFontDescriptors Font FontDescriptor getContainerWindow Andrew Pitonyak How can I list the fonts available to a document?

The available fonts are known by the container window. The getFontDescriptors() method returns an array of awt FontDescriptor structures that contain a lot of information about the font. The font descriptor can be passed to the getFont() method, which returns an object that supports the awt XFont interface. The XFont interface provides methods to determine font metrics, and the width of an individual character or an entire string of characters.

Taken from Andrew's Macro Document at http://www.pitonyak.org

Sub ListFonts Dim oWindow 'The container window supports the awt XDevice interface. Dim oDescript 'Array of awt FontDescriptor structures Dim s$ 'Temporary string variable to hold all of the string names. Dim i% 'General index variable oWindow = ThisComponent.getCurrentController().getFrame().getContainerWindow() oDescript = oWindow.getFontDescriptors() s = "" For i = LBound(oDescript) to UBound(oDescript) s = s & oDescript(i).Name & ", " Next MsgBox s End Sub
Initial version