4D v13

WR Get font

Home

 
4D Write v13
WR Get font

WR Get font 


 

WR Get font ( area ; sameFont ) -> Function result 
Parameter Type   Description
area  Longint in 4D Write area
sameFont  Longint in 1 if the font is the same for the entire selection, otherwise 0
Function result  String in Name of the font of the last character of the selection

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 select 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

 
PROPERTIES 

Product: 4D
Theme: WR Text Manipulation
Number: 89463

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D Write 6.5

 
SEE ALSO 

WR Get stylesheet font
WR Get text property
WR SET FONT