fontToMapping()

The function returns a mapping for a specified font string.

Synopsis

mapping fontToMapping(string font);

Parameters

Parameters Meaning
font A font string, e.g.

"Arial,-1,17,5,75,0,0,0,0,0,Bold"

See also the example at the end of this chapter.

Return value

A mapping with key/value pairs for the specified font.

Description

The function returns a mapping for a specified font string. The returned mapping contains the following key/value pairs of the font:

Table 1. Key/Value Pairs for a font string mapping
Key Value
"family"

(string)

"pointSize"

(float)

"pixelSize"

(int)

"weight"

(int)

"italic"

(bool)

"underline"

(bool)

"strikeOut"

(bool)

"fixedPitch"

(bool)

For documentation details of the above attributes, see https://doc.qt.io/qt-5/qfont.html.

Example

The function returns a mapping for the specified font string "Courier New,-1,17,5,50,1,1,0,0,0,Italic"

 main(mapping event)
{
  mapping m = fontToMapping("Courier New,-1,17,5,50,1,1,0,0,0,Italic");
  DebugN("Font string mapping:", m);
}    

The mapping for the font string "Courier New,-1,17,5,50,1,1,0,0,0,Italic":

WCCOAui1:["Font string mapping:"][mapping 8 items
WCCOAui1: "family" : "Courier New"
WCCOAui1: "strikeOut" : FALSE
WCCOAui1: "fixedPitch" : FALSE
WCCOAui1: "pointSize" : -1
WCCOAui1: "pixelSize" : 17
WCCOAui1: "weight" : 50
WCCOAui1: "italic" : TRUE
WCCOAui1: "underline" : TRUE
WCCOAui1:] 

Assignment

Mapping functions

Availability

UI