| 4D v13WR Get font | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D Write v13
 WR Get font 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WR Get font ( area ; sameFont ) -> Function result | ||||||||
| Parameter | Type | Description | ||||||
| area | Longint |   | 4D Write area | |||||
| sameFont | Longint |   | 1 if the font is the same for the entire selection, otherwise 0 | |||||
| Function result | String |   | 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.
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
	Product:  4D
	Theme:  WR Text Manipulation
	Number:  
        89463
        
        
        
	
	Created:  4D Write 6.5
WR Get stylesheet font
WR Get text property
WR SET FONT