4D v16.3

FONT LIST

Home

 
4D v16.3
FONT LIST

FONT LIST 


 

FONT LIST ( fonts {; listType | *} ) 
Parameter Type   Description
fonts  Text array in Array of font names
listType | *  Longint, Operator in Font type list to return or * to return font names under OS X

The FONT LIST command populates the fonts text array with the names of scalable fonts available on your system.

The listType parameter lets you designate the type of font list you want to get. To do so, you can pass one of the following constants in the listType parameter, available in the "Font Type List" theme:

Constant Type Value Comment
Favorite fonts Longint 1 fonts contains the list of favorite fonts.
- Under Windows: list of active font family names.
- Under OS X: list of font family names found in the control panel, entitled "Favorites" in English, "Favoris" in French, "Favoriten" in German, and so on . This collection may be blank if the user has not added any favorite fonts.
Recent fonts Longint 2 fonts contains the list of recent fonts (the ones used during the 4D session). This list is used in particular by multi-style text areas.
System fonts Longint 0 fonts contains the list of all the system fonts. Default option when listType is omitted.

Under OS X, when you pass the optional * parameter, the command populates the fonts array with the names of the fonts themselves, and not with the names of the font families. The default operation simplifies programmed management of rich text areas, which use font families. If you pass the * parameter, font names, for example, "Arial bold", "Arial italic", "Arial narrow italic," are returned instead of families, such as "Arial", "Arial black" or "Arial narrow".
Under Windows, the * parameter has no effect. The command still returns the font families.

Note: Under OS X, if you use the result of this command with ST SET ATTRIBUTES in a multi-style text area, you must not pass the * parameter (only font families are supported as Attribute font name). This limitation does not apply to 4D Write Pro areas, which accept either font or font family names. 

This command returns only scalable fonts. Using non-scalable fonts (i.e. bitmap fonts) to design interfaces is not recommended since they are based on an outdated technology and suffer from limitations regarding size variations. They are not supported in cutting-edge features of 4D such as 4D Write Pro areas .

Under OS X, this principle has been in effect since OS X 10.4 (QuickDraw bitmap fonts are obsolete beginning with this version).

Under Windows, this principle is applied beginning with 4D v15 R4. In order to help developers select only modern fonts for their interfaces, only "trueType" or "openType" scalable fonts are listed. For example, "ASI_Mono", "MS Sans Serif" and "System" fonts are no longer available. In addition, GDI names are also ignored; only DirectWrite font family names are supported. For example, "Arial Black" or "Segoe UI Black" font families are not in the list; only "Arial" and "Segoe" are returned.

Compatibility notes for Windows:

  • Bitmap fonts can still be used in your 4D forms (except in 4D Write Pro areas). They are just removed from the list returned by this command. However, to ensure compatibility with future versions of 4D and Windows, we recommend using only DirectWrite font families.
  • Since bitmap fonts are filtered from the fonts parameter on Windows, the resulting list is different in 4D v15 R4 applications and higher, compared to previous releases. Please make sure to adapt your code if you were using this command to select a non-scalable font.

In a form, you want a drop-down list that displays a list of the fonts available on your system. The method of the drop-down list is as follows:

 Case of
    :(Form event=On Load)
       ARRAY TEXT(asFont;0)
       FONT LIST(asFont)
  ` ...
 
 End case

You want to get a list of recent fonts:

 FONT LIST($arrFonts;Recent fonts)



See also 

_o_Font name
_o_Font number
FONT STYLE LIST
Font Type List
OBJECT SET FONT
SET RECENT FONTS
ST SET ATTRIBUTES

 
PROPERTIES 

Product: 4D
Theme: System Environment
Number: 460

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v6
Modified: 4D v12.1
Modified: 4D v14
Modified: 4D v15 R4

 
TAGS 

police

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)