VP Object to font
VP Object to font ( fontObj : Object ) : Text
| Parameter | Type | Description | |
|---|---|---|---|
| fontObj | Object | -> | Font object |
| Result | Text | <- | Font shorthand |
Description
The VP Object to font command returns a font shorthand string from fontObj.
In fontObj, pass an object containing the font properties. The following properties are supported:
| Property | Type | Description | Possible values | Mandatory |
|---|---|---|---|---|
| family | text | Specifies the font. | any standard or generic font family. Ex. "Arial", "Helvetica", "serif", "arial,sans-serif" | Yes |
| size | text | Defines the size of the font.The line-height can be added to the font-size: font-size/line-height: Ex: "15pt/20pt" | a number with one of the following units: vk font size largevk font size largervk font size x largevk font size xx largevk font size smallvk font size smallervk font size x smallvk font size xx small | Yes |
| style | text | The style of the font. | vk font style italicvk font style oblique | No |
| variant | text | Specifies font in small capital letters. | vk font variant small caps | No |
| weight | text | Defines the thickness of the font. | vk font weight 100vk font weight 200vk font weight 300vk font weight 400vk font weight 500vk font weight 600vk font weight 700vk font weight 800vk font weight 900vk font weight boldvk font weight boldervk font weight lighter | No |
This object can be created with the VP Font to object command.
The returned shorthand string can be assigned to the "font" property of a cell with the VP SET CELL STYLE, for example.
Example
$cellStyle:=VP Get cell style($range)
$font:=VP Font to object($cellStyle.font)
$font.style:=vk font style oblique
$font.variant:=vk font variant small caps
$font.weight:=vk font weight bolder
$cellStyle.font:=VP Object to font($font)
//$cellStyle.font contains "bolder oblique small-caps 16pt arial"
See also
4D View Pro Style Objects and Style Sheets
VP Font to object
VP SET CELL STYLE
VP SET DEFAULT STYLE