ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax /  / Advanced types
  • Font characteristics
  • Font management properties
  • Functions that use Font variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
A Font variable creates a font programmatically. The characteristics of the font can be set using different WLanguage properties.
A Font variable can be used:
  • in drawings,
  • in charts,
  • in print jobs,
  • in the controls of a window (Font property),
  • in the controls of a page (Font property),
  • in the controls of a report (Font property).
Remarks:
  • For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Declare the Font variables
MyFont is Font
MyFont1, MyFont2 are Fonts
// Variable initialized with the font created by FontCreate
MyFont = FontCreate("Arial", 12, iBold)
// Modify the characteristics of the font
MyFont.Name = "Arial"
MyFont.Size = 12
MyFont.Bold = True
// Use a font on a window control
EDT_LastName.Font = MyFont
 
// Retrieve the font of a control
MyFont1 = EDT_FirstName.Font
Remarks

Font characteristics

By default, a Font variable has the following characteristics:
  • "Arial",
  • size 12,
  • black,
  • no attributes.
To programmatically set the characteristics of a Font variable, use:
  • The FontCreate function.
  • The Font management properties (see below)
  • FontSelect, which opens the standard Windows font selection dialog box.

Font management properties

The following properties can be used to handle a Font variable:
Property nameEffect
BoldChecks whether a Font variable is bold and changes the bold attribute of a Font variable.
CharacterSpacingGets and sets the spacing between characters of a Font variable.
CharsetReturns and changes the character set used by a Font variable.
AndroidAndroid Widget Not available.
ColorChecks and changes the color of a Font variable.
ItalicChecks whether a Font variable is italicized and changes the italic attribute of a Font variable.
LineSpacingGets and sets the line spacing for a Font variable.
NameReturns and changes the name of a Font variable.
OrientationReturns and changes the angle (in degrees) of a Font variable.
AndroidAndroid Widget Not available.
SizeReturns and changes the size (in picas) of a Font variable.
SizeUnitGets and sets the size unit used for a Font variable.
StrikeOutChecks whether a Font variable is struck through and strikes through a Font variable.
UnderlineChecks whether a Font variable is underlined and underlines a Font variable.
These properties can be directly used on the Font variable. Example:
MyFont is Font
MyFont.Bold = True
MyFont.Color = LightRed
Universal Windows 10 App Only the following properties can be used with the Font type: Orientation, StrikeOut, Color, Bold, Italic, Name, Underline, Size.

Functions that use Font variables

The following functions can be used to handle a Font variable:
dFontDeclares the font that will be used by dText:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
FontCreateCreates a font definition.
FontSelectOpens the standard window for font selection and selects the specified font.
grLabelFontModifies the font used for the category labels of a chart.
grLegendFontModifies the font used for the chart legend.
grTitleFontModifies the font used for the chart title.
iFontSelects the default font.
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/24/2023

Send a report | Local help