PV Add font

4D - Documentation   Français   English   German   4D View 2004, Command Theme List   4D View 2004, Command Alphabetical List   4D View 2004, Constant Theme List   Back   Previous   Next

version 6.8


PV Add font (area; name) Longint

ParameterTypeDescription
areaLongint4D View area
nameStringFont name
Function resultLongintFont 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 ELEMENT($FontNameArray;$Position)  `Resize...
      INSERT ELEMENT($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

PV GET FONT LIST, PV REMOVE FONT.


4D - Documentation   Français   English   German   4D View 2004, Command Theme List   4D View 2004, Command Alphabetical List   4D View 2004, Constant Theme List   Back   Previous   Next