FontAttr
The font attributes of a text fragment.
Property | Type | Required |
---|---|---|
class | string | Required |
length | integer | Optional |
borders | Array<Border> | Optional |
fills | Array<Fill> | Optional |
fillUseType | integer | Optional |
name | string | Optional |
subFamilyName | string | Optional |
postScript | string | Optional |
fontVariations | Array<FontVariation> | Optional |
size | number | Optional |
letterSpacingValue | number | Optional |
letterSpacingUnit | integer | Optional |
lineSpacingValue | number | Optional |
lineSpacingUnit | integer | Optional |
underline | integer | Optional |
linethrough | boolean | Optional |
textCase | integer | Optional |
fontVariantCaps | integer | Optional |
baselineShift | number | Optional |
fontVariantPosition | integer | Optional |
horizontalScale | number | Optional |
verticalScale | number | Optional |
rotate | number | Optional |
textParagraph | TextParagraph | Optional |
hyperlink | string | Optional |
length​
OptionalDescription
The number of characters(UTF-8) that these attributes apply to.
If this property is missing, it means these attributes apply to all remaining characters in the text.
Note:
If a UTF-8 character is 4
bytes, its length counts as 2
.
If a UTF-8 character is 1 ~ 3
bytes, its length counts as 1
.
Type
integer
borders​
OptionalDescription
A list of the character's border styles.
Priority: The borders
of the text fragment > the borders
in defaultFontAttr
of the text > the borders
in the text object's style
.
Type
Array<Border>
fills​
OptionalDescription
A list of the character's fill effects. The priority of fills
is listed in fillUseType
.
Type
Array<Fill>
fillUseType​
OptionalDescription
The priority of fills
.
Type
integer
Value
enum: the value of this property must be equal to one of the following values:
Value | Explanation |
---|---|
0 | The fills of the text fragment > the fills in defaultFontAttr of the text > the fills in the text object's style . (Default value) |
1 | The corresponding property of the object takes precedence over fills . When style.fills and fills each have only one valid solid color object, the opacity of the two solid color objects is combined into the style.fills solid color object. |
name​
OptionalDescription
Common name of the font.
The font name may contain subfamily, in which case the subFamilyName
will not appear.
If this property does not exist or is empty, the application can fall back to using its default font name.
Type
string
letterSpacingValue​
OptionalDescription
Text character spacing value (can be negative).
Must be used together with letterSpacingUnit
.
Default value is 0
.
Type
number
letterSpacingUnit​
OptionalDescription
The unit of letterSpacingValue
value.
Type
integer
Value
enum: the value of this property must be equal to one of the following values:
Value | Explanation |
---|---|
0 | pixel (default value) |
1 | percent. Final pixel value equals to size * letterSpacingValue / 100 . |
lineSpacingValue​
OptionalDescription
The spacing value of the text lines.
Must be used together with lineSpacingUnit
.
Default value is 0
.
Type
number
lineSpacingUnit​
OptionalDescription
The unit of lineSpacingValue
value.
Type
integer
Value
enum: the value of this property must be equal to one of the following values:
Value | Explanation |
---|---|
0 | pixel (default value) |
1 | auto. Use default font metrics height. |
2 | raw. Final pixel value equals to size * lineSpacingValue . |
underline​
OptionalDescription
The underline type of the text.
Type
integer
Value
enum: the value of this property must be equal to one of the following values:
Value | Explanation |
---|---|
0 | none (default value) |
1 | single line |
2 | double line |
linethrough​
OptionalDescription
Whether the text has a line through.
Default value is false
.
Type
boolean
textCase​
OptionalDescription
The type of text case.
Note:
textCase
and fontVariantCaps
are mutually exclusive. If either item is nonzero, you can ignore the value of the other, as they will not be nonzero at the same time.
Type
integer
Value
enum: the value of this property must be equal to one of the following values:
Value | Explanation |
---|---|
0 | do nothing (default value) |
1 | uppercase |
2 | lowercase |
3 | title case |
fontVariantCaps​
OptionalDescription
The type of small caps.
Note:
textCase
and fontVariantCaps
are mutually exclusive. If either item is nonzero, you can ignore the value of the other, as they will not be nonzero at the same time.
Type
integer
Value
enum: the value of this property must be equal to one of the following values:
Value | Explanation |
---|---|
0 | do nothing (default value) |
1 | small caps |
2 | force small caps, including uppercase characters |
baselineShift​
OptionalDescription
Vertical offset of the text baseline.
Default value is 0
.
Type
number
fontVariantPosition​
OptionalDescription
The position of the text characters.
Type
integer
Value
enum: the value of this property must be equal to one of the following values:
Value | Explanation |
---|---|
0 | normal (default value) |
1 | superscript |
2 | subscript |
horizontalScale​
OptionalDescription
Scale the text characters horizontally.
Default value is 1
.
Value examples:
0.5: 50%
1: not scale
1.75: 175%
2: 200%
Type
number
verticalScale​
OptionalDescription
Scale the text characters vertically.
Default value is 1
.
Refer to horizontalScale
for value examples.
Type
number
rotate​
OptionalDescription
Rotation angle of the text characters.
Default value is 0
.
Type
number
Value
maximum: the value of this number must smaller than or equal to: 180
minimum: the value of this number must greater than or equal to: -180
textParagraph​
OptionalDescription
The properties of the text paragraph, which are consistent across the same text paragraph.
Type