PV Add font
version 6.8
PV Add font (area; name) Longint
Parameter | Type | Description | |
area | Longint | 4D View area | |
name | String | Font name |
Function result Longint Font ID
Description
The PV Add font command adds a font to the area by its name and returns its ID.
If name already exists, the PV Add font command returns its ID (the number can also be obtained using the PV GET FONT LIST command).
For more information on how fonts associated with a 4D View area work, refer to the section PV Style, Introduction.
Example
This method also works with toggle: it removes a font from the 4D View area or associates it if it has already been removed.
C_STRING(255;$FontName) `Name of font to add/remove from Area
ARRAY LONGINT($FontNumArray;0) `Font numbers array
ARRAY STRING(255;$FontNameArray;0) `Font names array
C_INTEGER($Position) `Position of the font in the number and name arrays
$FontName:="Arial"
PV GET FONT LIST (Area;$FontNumArray;$FontNameArray) `List of available fonts
$Position:=Find in array($FontNameArray;$FontName)
If ($Position=-1) `$FontName font is unavailable for the area?
$Position:=Size of array($FontNameArray)+1 `We will add it
INSERT IN ARRAY($FontNameArray;$Position) `Resize...
INSERT IN ARRAY($FontNumArray;$Position) `...arrays
$FontNameArray{$Position}:=$FontName `Assign name of new font
$FontNumArray{$Position}:=PV Add font (Area;$FontName) `Assign font number
Else `$FontName font is already present in the area
PV REMOVE FONT (Area;$FontNumArray{$Position}) `Remove it
End if
See Also