Text Styles
PBTextStyle
Opaque object handle: A collection of text attributes.
This object maintains an internal reference count. When the reference count reaches zero, the object will be automatically deallocated. To increment the reference count, call PBTextStyleRetain; to decrement the reference count, call PBTextStyleRelease. These functions are thread-safe.
See Also
PBNamedTextStyle
Enumeration/bitset of type uint8_t: Identifiers for builtin text styles.
Constants
PBNamedTextStyle_RESET
PBNamedTextStyle_RESET = 0
12pt text in the system sans-serif font. The color is PBNamedColor_WINDOW_TEXT, and the weight is 500.
PBNamedTextStyle_CONTROL_DEFAULT
PBNamedTextStyle_CONTROL_DEFAULT = 1
The default text style for user interface controls, such as buttons and menu items.
PBNamedTextStyle_CONTROL_SMALL
PBNamedTextStyle_CONTROL_SMALL = 5
The default text style for small user interface controls.
PBNamedTextStyle_CONTROL_SECONDARY
PBNamedTextStyle_CONTROL_SECONDARY = 50
PBNamedTextStyle_MONOSPACED
PBNamedTextStyle_MONOSPACED = 4
The default text style for monospaced text output, such as logs and code displays.
PBNamedTextStyle_HINT_LABEL
PBNamedTextStyle_HINT_LABEL = 7
A hint indicating how to use a control or what the user can do.
PBNamedTextStyle_TABLE_HEADING
PBNamedTextStyle_TABLE_HEADING = 6
The text style for column headers in a table view.
PBNamedTextStyle_ALERT_MESSAGE
PBNamedTextStyle_ALERT_MESSAGE = 2
The text style for the message of an alert.
PBNamedTextStyle_ALERT_MESSAGE_EM
PBNamedTextStyle_ALERT_MESSAGE_EM = 10
Emphasized text in the message of an alert.
PBNamedTextStyle_ALERT_DESCRIPTION
PBNamedTextStyle_ALERT_DESCRIPTION = 3
The text style for the extended description of an alert.
PBNamedTextStyle_ALERT_DESCRIPTION_EM
PBNamedTextStyle_ALERT_DESCRIPTION_EM = 31
Emphasized text in the extended description of an alert.
PBNamedTextStyle_DEF_PARAGRAPH
PBNamedTextStyle_DEF_PARAGRAPH = 11
The default style for PBTextRoleID_PARAGRAPH.
PBNamedTextStyle_DEF_BLOCK_QUOTE
PBNamedTextStyle_DEF_BLOCK_QUOTE = 12
The default style for PBTextRoleID_BLOCK_QUOTE.
PBNamedTextStyle_DEF_BLOCK_CODE
PBNamedTextStyle_DEF_BLOCK_CODE = 13
The default style for PBTextRoleID_BLOCK_CODE.
PBNamedTextStyle_DEF_STRONG
PBNamedTextStyle_DEF_STRONG = 14
The default style for PBTextRoleID_STRONG.
PBNamedTextStyle_DEF_EM
PBNamedTextStyle_DEF_EM = 15
The default style for PBTextRoleID_EM.
PBNamedTextStyle_DEF_STRONG_AND_EM
PBNamedTextStyle_DEF_STRONG_AND_EM = 16
The default style for PBTextRoleID_STRONG_AND_EM.
PBNamedTextStyle_DEF_HYPERLINK
PBNamedTextStyle_DEF_HYPERLINK = 17
The default style for PBTextRoleID_HYPERLINK.
PBNamedTextStyle_DEF_INLINE_CODE
PBNamedTextStyle_DEF_INLINE_CODE = 18
The default style for PBTextRoleID_INLINE_CODE.
PBNamedTextStyle_DEF_H1
PBNamedTextStyle_DEF_H1 = 19
The default style for PBTextRoleID_H1.
PBNamedTextStyle_DEF_H2
PBNamedTextStyle_DEF_H2 = 20
The default style for PBTextRoleID_H2.
PBNamedTextStyle_DEF_H3
PBNamedTextStyle_DEF_H3 = 21
The default style for PBTextRoleID_H3.
PBNamedTextStyle_DEF_H4
PBNamedTextStyle_DEF_H4 = 22
The default style for PBTextRoleID_H4.
PBNamedTextStyle_DEF_H5
PBNamedTextStyle_DEF_H5 = 23
The default style for PBTextRoleID_H5.
PBNamedTextStyle_DEF_H6
PBNamedTextStyle_DEF_H6 = 24
The default style for PBTextRoleID_H6.
PBNamedTextStyle_DEF_H7
PBNamedTextStyle_DEF_H7 = 25
The default style for PBTextRoleID_H7.
PBNamedTextStyle_DEF_H8
PBNamedTextStyle_DEF_H8 = 26
The default style for PBTextRoleID_H8.
PBNamedTextStyle_DEF_H9
PBNamedTextStyle_DEF_H9 = 27
The default style for PBTextRoleID_H9.
PBNamedTextStyle_DEF_HORIZONTAL_RULE
PBNamedTextStyle_DEF_HORIZONTAL_RULE = 28
The default style for PBTextRoleID_HORIZONTAL_RULE.
PBNamedTextStyle_DEF_LIST_ITEM
PBNamedTextStyle_DEF_LIST_ITEM = 29
The default style for PBTextRoleID_LIST_ITEM.
PBNamedTextStyle_DEF_ROOT_MARGIN
PBNamedTextStyle_DEF_ROOT_MARGIN = 30
The default style for PBTextRoleID_ROOT_MARGIN.
PBNamedTextStyle_BODY_PARAGRAPH
PBNamedTextStyle_BODY_PARAGRAPH = 32
PBNamedTextStyle_BODY_LIST_ITEM
PBNamedTextStyle_BODY_LIST_ITEM = 33
PBNamedTextStyle_BODY_BLOCK_QUOTE
PBNamedTextStyle_BODY_BLOCK_QUOTE = 34
PBNamedTextStyle_BODY_BLOCK_CODE
PBNamedTextStyle_BODY_BLOCK_CODE = 35
PBNamedTextStyle_BODY_STRONG
PBNamedTextStyle_BODY_STRONG = 36
PBNamedTextStyle_BODY_EM
PBNamedTextStyle_BODY_EM = 37
PBNamedTextStyle_BODY_STRONG_AND_EM
PBNamedTextStyle_BODY_STRONG_AND_EM = 38
PBNamedTextStyle_BODY_HYPERLINK
PBNamedTextStyle_BODY_HYPERLINK = 39
PBNamedTextStyle_BODY_INLINE_CODE
PBNamedTextStyle_BODY_INLINE_CODE = 40
PBNamedTextStyle_BODY_H1
PBNamedTextStyle_BODY_H1 = 41
PBNamedTextStyle_BODY_H2
PBNamedTextStyle_BODY_H2 = 42
PBNamedTextStyle_BODY_H3
PBNamedTextStyle_BODY_H3 = 43
PBNamedTextStyle_BODY_H4
PBNamedTextStyle_BODY_H4 = 44
PBNamedTextStyle_BODY_H5
PBNamedTextStyle_BODY_H5 = 45
PBNamedTextStyle_BODY_H6
PBNamedTextStyle_BODY_H6 = 46
PBNamedTextStyle_BODY_H7
PBNamedTextStyle_BODY_H7 = 47
PBNamedTextStyle_BODY_H8
PBNamedTextStyle_BODY_H8 = 48
PBNamedTextStyle_BODY_H9
PBNamedTextStyle_BODY_H9 = 49
PBNamedTextStyle_BODY_HORIZONTAL_RULE
PBNamedTextStyle_BODY_HORIZONTAL_RULE = 8
PBNamedTextStyle_BODY_ROOT_MARGIN
PBNamedTextStyle_BODY_ROOT_MARGIN = 9
PBNamedTextStyle_COUNT
PBNamedTextStyle_COUNT = 51
The number of builtin text styles. This value will change in newer versions of the API.
See Also
PBTextRoleID
Enumeration/bitset of type uint16_t: Identifier the role of a portion of text so that it can be mapped to a text style or accessibility information.
Constants
PBTextRoleID_INITIAL
PBTextRoleID_INITIAL = 0
By default this role is not mapped to anything. As such, its attribute state is taken from PBNamedTextStyle_RESET.
PBTextRoleID_PARAGRAPH
PBTextRoleID_PARAGRAPH = 1
PBTextRoleID_BLOCK_QUOTE
PBTextRoleID_BLOCK_QUOTE = 2
PBTextRoleID_BLOCK_CODE
PBTextRoleID_BLOCK_CODE = 3
PBTextRoleID_HORIZONTAL_RULE
PBTextRoleID_HORIZONTAL_RULE = 4
PBTextRoleID_LIST_ITEM
PBTextRoleID_LIST_ITEM = 5
PBTextRoleID_STRONG
PBTextRoleID_STRONG = 10
PBTextRoleID_EM
PBTextRoleID_EM = 11
PBTextRoleID_STRONG_AND_EM
PBTextRoleID_STRONG_AND_EM = 12
PBTextRoleID_HYPERLINK
PBTextRoleID_HYPERLINK = 13
PBTextRoleID_INLINE_CODE
PBTextRoleID_INLINE_CODE = 14
PBTextRoleID_H1
PBTextRoleID_H1 = 21
PBTextRoleID_H2
PBTextRoleID_H2 = 22
PBTextRoleID_H3
PBTextRoleID_H3 = 23
PBTextRoleID_H4
PBTextRoleID_H4 = 24
PBTextRoleID_H5
PBTextRoleID_H5 = 25
PBTextRoleID_H6
PBTextRoleID_H6 = 26
PBTextRoleID_H7
PBTextRoleID_H7 = 27
PBTextRoleID_H8
PBTextRoleID_H8 = 28
PBTextRoleID_H9
PBTextRoleID_H9 = 29
PBTextRoleID_ROOT_MARGIN
PBTextRoleID_ROOT_MARGIN = 30
PBTextRoleID_USER_START
PBTextRoleID_USER_START = 0x8000
The beginning of the range of role IDs that can be used by the application for any purpose.
PBTextRoleID_USER_END
PBTextRoleID_USER_END = 0xFFFF
The end of the range of application-defined role IDs.
See Also
PBTextRoleMapping
Structure:
Fields
sourceRoleID (PBTextRoleID):
targetStyle (referenced PBTextStyle):
PBTextAttributeValueDirection
Enumeration/bitset of type uint32_t: Text writing directions.
Constants
PBTextAttributeValueDirection_DEFAULT
PBTextAttributeValueDirection_DEFAULT = 0
The default writing direction.
PBTextAttributeValueAlignment
Enumeration/bitset of type uint32_t: Text paragraph alignments.
Constants
PBTextAttributeValueAlignment_START
PBTextAttributeValueAlignment_START = 0
Each line is positioned so that the left side of its first word meets the left side of the layout bounding box.
PBTextAttributeValueAlignment_END
PBTextAttributeValueAlignment_END = 1
Each line is positioned so that the right side of its last word meets the right side of the layout bounding box.
PBTextAttributeValueAlignment_CENTER
PBTextAttributeValueAlignment_CENTER = 2
Each line is centered in the bounding box.
PBTextAttributeValueAlignment_JUSTIFY
PBTextAttributeValueAlignment_JUSTIFY = 3
The words in each line of the paragraph are distributed evenly so that the first and last words of each line (except the last line in the paragraph) are respectively aligned.
See Also
PBTextAttributeValueNumerals
Enumeration/bitset of type uint32_t: Types of text numerals.
Constants
PBTextAttributeValueNumerals_LINING
PBTextAttributeValueNumerals_LINING = 0
Modern-style lining numerals, where all digits are above the baseline.
PBTextAttributeValueNumerals_TABULAR
PBTextAttributeValueNumerals_TABULAR = 1
Tabular numerals, where all digits have the same horizontal advancement.
PBTextAttributeValueNumerals_OLD_STYLE
PBTextAttributeValueNumerals_OLD_STYLE = 2
Old style numerals, where digits vary in their position relative to the baseline so as to fit in better alongside words.
See Also
PBTextAttributeValueDecorationStyle
Enumeration/bitset of type uint32_t: Styles for a text decoration (such as underline or strike-through).
Constants
PBTextAttributeValueDecorationStyle_OFF
PBTextAttributeValueDecorationStyle_OFF = 0
The text decoration is disabled.
PBTextAttributeValueDecorationStyle_SINGLE
PBTextAttributeValueDecorationStyle_SINGLE = 1
A single line.
PBTextAttributeValueDecorationStyle_DOUBLE
PBTextAttributeValueDecorationStyle_DOUBLE = 2
A double line, with a small gap between the lines.
PBTextAttributeValueDecorationStyle_DOTTED
PBTextAttributeValueDecorationStyle_DOTTED = 3
A single dotted line.
PBTextAttributeValueDecorationStyle_DASHED
PBTextAttributeValueDecorationStyle_DASHED = 4
A single dashed line.
PBTextAttributeValueDecorationStyle_DOT_DASH
PBTextAttributeValueDecorationStyle_DOT_DASH = 5
A single line made of alternating dots and dashes.
PBTextAttributeValueDecorationStyle_WAVY
PBTextAttributeValueDecorationStyle_WAVY = 6
A single line that slightly oscillates parallel to the baseline.
See Also
PBTextAttributeValueDecoration
Structure: Configuration for a text decoration (such as underline or strike-through).
Fields
style (PBTextAttributeValueDecorationStyle): The style pattern of the decoration.
color (PBColor): The color in which the decoration will be drawn.
See Also
PBTextAttributeValueBool
Enumeration/bitset of type uint32_t: Values for a text attribute that can be turned on or off.
Constants
PBTextAttributeValueBool_OFF
PBTextAttributeValueBool_OFF = 0
The attribute is turned off.
PBTextAttributeValueBool_ON
PBTextAttributeValueBool_ON = 1
The attribute is turned on.
PBTextAttributeValueBool_ON_NO_SYNTHESIS
PBTextAttributeValueBool_ON_NO_SYNTHESIS = 2
Some font features can be synthesized if the underlying font doesn't support it. Use this value to disable synthesis, and only enable the attribute if the font natively supports it.
PBTextAttributeValueFeature
Structure: A feature defined by the specific font.
Fields
tag (uint32_t
): The 4-character tag of the feature, defined in the font file.
value (uint32_t
): The value to assign to the feature.
See Also
PBTextAttribute
Tagged union: A single text attribute, modifying the layout or rendering of glyphs, words, lines or paragraphs.
Tags
PBTextAttribute_STYLE
PBTextAttribute_STYLE
with field style
(referenced PBTextStyle):
Restores the defaults and then applies the text style. (Paragraph-level attributes are kept.)
PBTextAttribute_NAMED_STYLE
PBTextAttribute_NAMED_STYLE
with field namedStyle
(PBNamedTextStyle):
Restores the defaults and then applies the builtin text style, looking it up using the given constant. (Paragraph-level attributes are kept.)
PBTextAttribute_ROLE_ID
PBTextAttribute_ROLE_ID
with field roleID
(PBTextRoleID):
Restores the defaults and then applies the text style, looking it up using the style for the given ID. This cannot be used with PBTextStyleCreate. (Paragraph-level attributes are kept.)
PBTextAttribute_VARIABLE_AXIS
PBTextAttribute_VARIABLE_AXIS
with field feature
(PBTextAttributeValueFeature):
Set the value of a variable axis. Overrides other attributes that control variable axes, such as PBTextAttribute_WEIGHT.
PBTextAttribute_OTYPE_FEATURE
PBTextAttribute_OTYPE_FEATURE
with field feature
(PBTextAttributeValueFeature):
Set the value of an otype feature.
PBTextAttribute_LIGATURES
PBTextAttribute_LIGATURES
with field b
(PBTextAttributeValueBool):
Force enable or disable ligatures.
PBTextAttribute_SUPERSCRIPT
PBTextAttribute_SUPERSCRIPT
with field b
(PBTextAttributeValueBool):
Enable or disable superscript text. This may be synthesised in future versions if the font does not natively support superscript text.
PBTextAttribute_SUBSCRIPT
PBTextAttribute_SUBSCRIPT
with field b
(PBTextAttributeValueBool):
Enable or disable subscript text. This may be synthesised in future versions if the font does not natively support subscript text.
PBTextAttribute_SMALL_CAPS
PBTextAttribute_SMALL_CAPS
with field b
(PBTextAttributeValueBool):
Enable or disable small capitals. This may be synthesised in future versions if the font does not natively support small capitals.
PBTextAttribute_NUMERALS
PBTextAttribute_NUMERALS
with field numerals
(PBTextAttributeValueNumerals):
Changes how digits are displayed.
PBTextAttribute_KERNING
PBTextAttribute_KERNING
with field b
(PBTextAttributeValueBool):
Force enable or disable kerning: font-supplied spacing between specific letter pairs to make the overall appearance more consistent.
PBTextAttribute_ITALICS
PBTextAttribute_ITALICS
with field b
(PBTextAttributeValueBool):
Enable or disable italics. This may be synthesised in future versions if the font does not natively support italics.
PBTextAttribute_HYPERLINK
PBTextAttribute_HYPERLINK
with field string
(referenced string):
Set to a non-empty string specifying the destination of the hyperlink. Typically, this attribute will be specified just after a PBTextAttribute_ROLE_ID attribute with PBTextRoleID_HYPERLINK.
PBTextAttribute_UNDERLINE
PBTextAttribute_UNDERLINE
with field decoration
(PBTextAttributeValueDecoration):
Reserved.
PBTextAttribute_STRIKE_THROUGH
PBTextAttribute_STRIKE_THROUGH
with field decoration
(PBTextAttributeValueDecoration):
Reserved.
PBTextAttribute_FONT_FAMILY
PBTextAttribute_FONT_FAMILY
with field string
(referenced string):
A list separated by newline characters of the names of typefaces to use, in decreasing order of priority. Use "sans", "serif" or "mono" as the last font in the list to insert the list of system fallbacks for that category.
PBTextAttribute_SIZE
PBTextAttribute_SIZE
with field f32
(float
):
The size of the text in dps.
PBTextAttribute_WEIGHT
PBTextAttribute_WEIGHT
with field f32
(float
):
The weight of the text. This should be in the range 1 to 999 inclusive. 400 represents regular text and 700 represents bold text.
PBTextAttribute_STRETCH
PBTextAttribute_STRETCH
with field f32
(float
):
Reserved.
PBTextAttribute_CHARACTER_SPACING
PBTextAttribute_CHARACTER_SPACING
with field f32
(float
):
The tracking of the text as a percentage of the font size per character.
PBTextAttribute_OUTLINE_THICKNESS
PBTextAttribute_OUTLINE_THICKNESS
with field f32
(float
):
Reserved.
PBTextAttribute_COLOR
PBTextAttribute_COLOR
with field color
(PBColor):
The color of the text.
PBTextAttribute_OUTLINE_COLOR
PBTextAttribute_OUTLINE_COLOR
with field color
(PBColor):
Reserved.
PBTextAttribute_SHADOW_COLOR
PBTextAttribute_SHADOW_COLOR
with field color
(PBColor):
Reserved.
PBTextAttribute_SHADOW_BLUR_RADIUS
PBTextAttribute_SHADOW_BLUR_RADIUS
with field f32
(float
):
Reserved.
PBTextAttribute_SHADOW_OFFSET_X
PBTextAttribute_SHADOW_OFFSET_X
with field f32
(float
):
Reserved.
PBTextAttribute_SHADOW_OFFSET_Y
PBTextAttribute_SHADOW_OFFSET_Y
with field f32
(float
):
Reserved.
PBTextAttribute_ALIGNMENT
PBTextAttribute_ALIGNMENT
with field alignment
(PBTextAttributeValueAlignment):
The alignment of the lines in the current paragraph. (This is not reset if the text style changes.)
PBTextAttribute_DIRECTION
PBTextAttribute_DIRECTION
with field direction
(PBTextAttributeValueDirection):
The direction in which text is laid out. (This is not reset if the text style changes.)
PBTextAttribute_LANGUAGE
PBTextAttribute_LANGUAGE
with field string
(referenced string):
Reserved.
PBTextAttribute_LINE_HEIGHT_MULTIPLIER
PBTextAttribute_LINE_HEIGHT_MULTIPLIER
with field f32
(float
):
Reserved.
PBTextAttribute_TAB_SIZE
PBTextAttribute_TAB_SIZE
with field f32
(float
):
Reserved.
See Also
PBTextBlockProperties
Structure: Block-level text properties.
Fields
layoutFlags (PBTextPlanLayoutFlags):
elementStyle (PBStyleID):
asHeadingOfLevel (uint8_t
):
spacingBeforeDp (float
):
spacingAfterDp (float
):
PBTextStyleOpenByName
Function: Open a standard text style by its naming constant.
Syntax (C/C++)
PBTextStylePtr PBTextStyleOpenByName(PBNamedTextStyle name);
Syntax (Python)
TextStyleOpenByName(name) -> (style)
Parameters and Return Values
[in] name (PBNamedTextStyle): The name of the text style to open.
[out] style (owned PBTextStyle): The opened text style. Call PBTextStyleRelease when finished.
Example (C/C++)
PBTextStyle *textStyle = PBTextStyleOpenByName(PBNamedTextStyle_MONOSPACED);
int32_t lineHeight = PBTextStyleGetLineHeight(textStyle, window);
PBTextStyleRelease(textStyle);
See Also
PBTextStyleCreate
Function: Create a text style containing the specified array of attributes.
Syntax (C/C++)
PBTextStylePtr _Nullable PBTextStyleCreate(
const PBTextAttribute *_Nullable attributes, size_t attributesCount);
Syntax (Python)
TextStyleCreate(attributes) -> (textStyle)
Parameters and Return Values
[in] attributes (referenced array of PBTextAttribute): The array of text attributes the text style will have.
[out] textStyle (nullable owned PBTextStyle): The created text style, or null if the system is low on memory.
Discussion
Attributes of type PBTextAttribute_ROLE_ID cannot be stored in a text style.
Example (C/C++)
PBTextAttribute attributes[] = {
{ .type = PBTextAttribute_SIZE, .f32 = 20.0f },
{ .type = PBTextAttribute_WEIGHT, .f32 = 700.0f },
};
PBTextStyle *style = PBTextStyleCreate(&attributes[0],
sizeof(attributes) / sizeof(attributes[0]));
if (!style) { return; }
// ...
PBTextStyleRelease(style);
See Also
PBTextStyleCreateWithBlockProperties
Function: Create a text style with an array of attributes and some block-level properties.
Syntax (C/C++)
PBTextStylePtr _Nullable PBTextStyleCreateWithBlockProperties(
const PBTextAttribute *_Nullable attributes, size_t attributesCount,
PBTextBlockProperties blockProperties);
Syntax (Python)
TextStyleCreateWithBlockProperties(attributes, blockProperties) -> (textStyle)
Parameters and Return Values
[in] attributes (referenced array of PBTextAttribute): The array of text attributes the text style will have.
[in] blockProperties (PBTextBlockProperties): Properties applied at the block level.
[out] textStyle (nullable owned PBTextStyle): The created text style, or null if the system is low on memory.
See Also
PBTextStyleGetLineHeight
Function: Get the line height of a text style.
Syntax (C/C++)
int32_t PBTextStyleGetLineHeight(PBTextStyleRef textStyle,
PBWindowRef _Nullable windowForScaling);
Syntax (Python)
TextStyleGetLineHeight(textStyle, windowForScaling) -> (lineHeight)
Parameters and Return Values
[in] textStyle (referenced PBTextStyle): The text style.
[in] windowForScaling (nullable referenced PBWindow): If non-null, this is used to determine the scale factor of the text. Otherwise, a scale factor of 100% is assumed. You should set this to the window into which the text will be drawn.
[out] lineHeight (int32_t
): The height of a line, in pixels.
Discussion
The line height will only be correct if all the text in the line uses the style and the text style is not mixed with other attributes that affect the line height.
The line height is clamped to a minimum of 1 pixel.
Example (C/C++)
PBTextStyle *textStyle = PBTextStyleOpenByName(PBNamedTextStyle_MONOSPACED);
int32_t lineHeight = PBTextStyleGetLineHeight(textStyle, window);
PBTextStyleRelease(textStyle);
See Also
PBTextStyleGetMonospacedGlyphWidth
Function: Get the horizontal distance between two adjacent glyphs for a monospaced text style.
Syntax (C/C++)
int32_t PBTextStyleGetMonospacedGlyphWidth(PBTextStyleRef textStyle,
PBWindowRef _Nullable windowForScaling);
Syntax (Python)
TextStyleGetMonospacedGlyphWidth(textStyle, windowForScaling) -> (glyphWidthPx)
Parameters and Return Values
[in] textStyle (referenced PBTextStyle): The text style.
[in] windowForScaling (nullable referenced PBWindow): If non-null, this is used to determine the scale factor of the text. Otherwise, a scale factor of 100% is assumed. You should set this to the window into which the text will be drawn.
[out] glyphWidthPx (int32_t
): The distance between two adjacent glyphs in pixels.
Discussion
The result is valid for monospaced fonts only.
The result will only be correct if the text style is used by itself and isn't mixed with other attributes.
In a East Asian font, this gives the "halfwidth" value.
Example (C/C++)
PBTextStyle *textStyle = PBTextStyleOpenByName(PBNamedTextStyle_MONOSPACED);
int32_t glyphWidth = PBTextStyleGetMonospacedGlyphWidth(textStyle, window);
PBTextStyleRelease(textStyle);
See Also
PBTextStyleGetBlockProperties
Function: Get the block-level properties stored in the text style.
Syntax (C/C++)
PBTextBlockProperties PBTextStyleGetBlockProperties(PBTextStyleRef textStyle);
Syntax (Python)
TextStyleGetBlockProperties(textStyle) -> (properties)
Parameters and Return Values
[in] textStyle (referenced PBTextStyle): The text style.
[out] properties (PBTextBlockProperties): The stored properties.