WR Get font

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

version 6.5


WR Get font (area; sameFont) String

ParameterTypeDescription
areaLongint4D Write area
sameFontLongint1 if the font is the same for the entire selection,
otherwise 0
Function resultStringName of the font of the last character of the selection

Description

The WR Get font command returns the font name of the font applied to the last character of the selection in the 4D Write area referenced by area.

If sameFont = 1, the same font is applied to the whole selection.

If sameFont = 0, other fonts are used in the selection.

Example

You want to retrieve the font of the current selection and apply it to the entire document:

   vFont:=WR Get font(Area;vUniform)
   If (vUniform=0)  `If there are several fonts in the current selection
      CONFIRM("There are several fonts in the selection, the font used for the last "+"character is 
                           "+vFont+". OK to apply this font to the entire document?")
   Else 
      CONFIRM("The font of the selection is "+vFont+". OK to apply this font to the entire document?)
   End if
   If (OK=1)
      WR EXECUTE COMMAND(Area;wr cmd selec all)   `Selecting the entire document
      WR SET FONT(Area;vFont)   `Applying the new font
          `Moving the insertion point to the beginning of the document
      WR SET SELECTION(Area;0;0)
      WR SCROLL TO SELECTION(Area)  `Displaying the current text selection
   End if 

See also

WR Get stylesheet font, WR Get text property, WR SET FONT.


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