hb-ot-math: HarfBuzz Manual

## hb-ot-math hb-ot-math |

## Functions

hb_bool_t | hb_ot_math_has_data ()
hb_position_t | hb_ot_math_get_constant ()
hb_position_t | hb_ot_math_get_glyph_italics_correction ()
hb_position_t | hb_ot_math_get_glyph_top_accent_attachment ()
hb_position_t | hb_ot_math_get_glyph_kerning ()
hb_bool_t | hb_ot_math_is_glyph_extended_shape ()
unsigned int | hb_ot_math_get_glyph_variants ()
hb_position_t | hb_ot_math_get_min_connector_overlap ()
unsigned int | hb_ot_math_get_glyph_assembly ()

## Types and Values

#define | HB_OT_TAG_MATH
#define | HB_OT_MATH_SCRIPT
enum | hb_ot_math_constant_t
enum | hb_ot_math_kern_t
| hb_ot_math_glyph_variant_t
enum | hb_ot_math_glyph_part_flags_t
| hb_ot_math_glyph_part_t

## Object Hierarchy

        GEnum
        ├── hb_ot_math_constant_t
        ╰── hb_ot_math_kern_t
        GFlags
        ╰── hb_ot_math_glyph_part_flags_t

## Description

## Functions

### hb_ot_math_has_data ()

    hb_bool_t
    hb_ot_math_has_data (hb_face_t *face);

This function allows to verify the presence of an OpenType MATH table on the face.

#### Parameters

face | hb_face_t to test |

#### Returns

true if face has a MATH table, false otherwise

Since: 1.3.3

### hb_ot_math_get_constant ()

    hb_position_t
    hb_ot_math_get_constant (hb_font_t *font,
                             hb_ot_math_constant_t constant);

This function returns the requested math constants as a hb_position_t. If the request constant is HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN, HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN or HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN then the return value is actually an integer between 0 and 100 representing that percentage.

#### Parameters

font | hb_font_t from which to retrieve the value |
constant | hb_ot_math_constant_t the constant to retrieve |

#### Returns

the requested constant or 0

Since: 1.3.3

### hb_ot_math_get_glyph_italics_correction ()

    hb_position_t
    hb_ot_math_get_glyph_italics_correction
                                   (hb_font_t *font,
                                    hb_codepoint_t glyph);

#### Parameters

font | hb_font_t from which to retrieve the value |
glyph | glyph index from which to retrieve the value |

#### Returns

the italics correction of the glyph or 0

Since: 1.3.3

### hb_ot_math_get_glyph_top_accent_attachment ()

    hb_position_t
    hb_ot_math_get_glyph_top_accent_attachment
                                   (hb_font_t *font,
                                    hb_codepoint_t glyph);

#### Parameters

font | hb_font_t from which to retrieve the value |
glyph | glyph index from which to retrieve the value |

#### Returns

the top accent attachment of the glyph or 0

Since: 1.3.3

### hb_ot_math_get_glyph_kerning ()

    hb_position_t
    hb_ot_math_get_glyph_kerning (hb_font_t *font,
                                  hb_codepoint_t glyph,
                                  hb_ot_math_kern_t kern,
                                  hb_position_t correction_height);

This function tries to retrieve the MathKern table for the specified font, glyph and hb_ot_math_kern_t. Then it browses the list of heights from the MathKern table to find one value that is greater or equal to specified correction_height. If one is found the corresponding value from the list of kerns is returned and otherwise the last kern value is returned.

#### Parameters

font | hb_font_t from which to retrieve the value |
glyph | glyph index from which to retrieve the value |
kern | the hb_ot_math_kern_t from which to retrieve the value |
correction_height | the correction height to use to determine the kerning. |

#### Returns

requested kerning or 0

Since: 1.3.3

### hb_ot_math_is_glyph_extended_shape ()

    hb_bool_t
    hb_ot_math_is_glyph_extended_shape (hb_face_t *face,
                                        hb_codepoint_t glyph);

#### Parameters

face | a hb_face_t to test |
glyph | a glyph index to test |

#### Returns

true if the glyph is an extended shape, false otherwise

Since: 1.3.3

### hb_ot_math_get_glyph_variants ()

    unsigned int
    hb_ot_math_get_glyph_variants (hb_font_t *font,
                                   hb_codepoint_t glyph,
                                   hb_direction_t direction,
                                   unsigned int start_offset,
                                   unsigned int *variants_count,
                                   hb_ot_math_glyph_variant_t *variants);

This function tries to retrieve the MathGlyphConstruction for the specified font, glyph and direction. Note that only the value of HB_DIRECTION_IS_HORIZONTAL is considered. It provides the corresponding list of size variants as an array of hb_ot_math_glyph_variant_t structs.

#### Parameters

font | hb_font_t from which to retrieve the values |
glyph | index of the glyph to stretch |
direction | direction of the stretching |
start_offset | offset of the first variant to retrieve |
variants_count | maximum number of variants to retrieve after start_offset (IN) and actual number of variants retrieved (OUT) |
variants | array of size at least `variants_count` to store the result |

#### Returns

the total number of size variants available or 0

Since: 1.3.3

### hb_ot_math_get_min_connector_overlap ()

    hb_position_t
    hb_ot_math_get_min_connector_overlap (hb_font_t *font,
                                          hb_direction_t direction);

This function tries to retrieve the MathVariants table for the specified font and returns the minimum overlap of connecting glyphs to draw a glyph assembly in the specified direction. Note that only the value of HB_DIRECTION_IS_HORIZONTAL is considered.

#### Parameters

font | hb_font_t from which to retrieve the value |
direction | direction of the stretching |

#### Returns

requested min connector overlap or 0

Since: 1.3.3

### hb_ot_math_get_glyph_assembly ()

    unsigned int
    hb_ot_math_get_glyph_assembly (hb_font_t *font,
                                   hb_codepoint_t glyph,
                                   hb_direction_t direction,
                                   unsigned int start_offset,
                                   unsigned int *parts_count,
                                   hb_ot_math_glyph_part_t *parts,
                                   hb_position_t *italics_correction);

This function tries to retrieve the GlyphAssembly for the specified font, glyph and direction. Note that only the value of HB_DIRECTION_IS_HORIZONTAL is considered. It provides the information necessary to draw the glyph assembly as an array of hb_ot_math_glyph_part_t.

#### Parameters

font | hb_font_t from which to retrieve the values |
glyph | index of the glyph to stretch |
direction | direction of the stretching |
start_offset | offset of the first glyph part to retrieve |
parts_count | maximum number of glyph parts to retrieve after start_offset (IN) and actual number of parts retrieved (OUT) |
parts | array of size at least `parts_count` to store the result |
italics_correction | italic correction of the glyph assembly |

#### Returns

the total number of parts in the glyph assembly

Since: 1.3.3

## Types and Values

### HB_OT_TAG_MATH

    #define             HB_OT_TAG_MATH

### HB_OT_MATH_SCRIPT

    #define             HB_OT_MATH_SCRIPT

### enum hb_ot_math_constant_t

#### Members

HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN |  |
HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN |  |
HB_OT_MATH_CONSTANT_DELIMITED_SUB_FORMULA_MIN_HEIGHT |  |
HB_OT_MATH_CONSTANT_DISPLAY_OPERATOR_MIN_HEIGHT |  |
HB_OT_MATH_CONSTANT_MATH_LEADING |  |
HB_OT_MATH_CONSTANT_AXIS_HEIGHT |  |
HB_OT_MATH_CONSTANT_ACCENT_BASE_HEIGHT |  |
HB_OT_MATH_CONSTANT_FLATTENED_ACCENT_BASE_HEIGHT |  |
HB_OT_MATH_CONSTANT_SUBSCRIPT_SHIFT_DOWN |  |
HB_OT_MATH_CONSTANT_SUBSCRIPT_TOP_MAX |  |
HB_OT_MATH_CONSTANT_SUBSCRIPT_BASELINE_DROP_MIN |  |
HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP |  |
HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP_CRAMPED |  |
HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MIN |  |
HB_OT_MATH_CONSTANT_SUPERSCRIPT_BASELINE_DROP_MAX |  |
HB_OT_MATH_CONSTANT_SUB_SUPERSCRIPT_GAP_MIN |  |
HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MAX_WITH_SUBSCRIPT |  |
HB_OT_MATH_CONSTANT_SPACE_AFTER_SCRIPT |  |
HB_OT_MATH_CONSTANT_UPPER_LIMIT_GAP_MIN |  |
HB_OT_MATH_CONSTANT_UPPER_LIMIT_BASELINE_RISE_MIN |  |
HB_OT_MATH_CONSTANT_LOWER_LIMIT_GAP_MIN |  |
HB_OT_MATH_CONSTANT_LOWER_LIMIT_BASELINE_DROP_MIN |  |
HB_OT_MATH_CONSTANT_STACK_TOP_SHIFT_UP |  |
HB_OT_MATH_CONSTANT_STACK_TOP_DISPLAY_STYLE_SHIFT_UP |  |
HB_OT_MATH_CONSTANT_STACK_BOTTOM_SHIFT_DOWN |  |
HB_OT_MATH_CONSTANT_STACK_BOTTOM_DISPLAY_STYLE_SHIFT_DOWN |  |
HB_OT_MATH_CONSTANT_STACK_GAP_MIN |  |
HB_OT_MATH_CONSTANT_STACK_DISPLAY_STYLE_GAP_MIN |  |
HB_OT_MATH_CONSTANT_STRETCH_STACK_TOP_SHIFT_UP |  |
HB_OT_MATH_CONSTANT_STRETCH_STACK_BOTTOM_SHIFT_DOWN |  |
HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_ABOVE_MIN |  |
HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_BELOW_MIN |  |
HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_SHIFT_UP |  |
HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_DISPLAY_STYLE_SHIFT_UP |  |
HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_SHIFT_DOWN |  |
HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_DISPLAY_STYLE_SHIFT_DOWN |  |
HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_GAP_MIN |  |
HB_OT_MATH_CONSTANT_FRACTION_NUM_DISPLAY_STYLE_GAP_MIN |  |
HB_OT_MATH_CONSTANT_FRACTION_RULE_THICKNESS |  |
HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_GAP_MIN |  |
HB_OT_MATH_CONSTANT_FRACTION_DENOM_DISPLAY_STYLE_GAP_MIN |  |
HB_OT_MATH_CONSTANT_SKEWED_FRACTION_HORIZONTAL_GAP |  |
HB_OT_MATH_CONSTANT_SKEWED_FRACTION_VERTICAL_GAP |  |
HB_OT_MATH_CONSTANT_OVERBAR_VERTICAL_GAP |  |
HB_OT_MATH_CONSTANT_OVERBAR_RULE_THICKNESS |  |
HB_OT_MATH_CONSTANT_OVERBAR_EXTRA_ASCENDER |  |
HB_OT_MATH_CONSTANT_UNDERBAR_VERTICAL_GAP |  |
HB_OT_MATH_CONSTANT_UNDERBAR_RULE_THICKNESS |  |
HB_OT_MATH_CONSTANT_UNDERBAR_EXTRA_DESCENDER |  |
HB_OT_MATH_CONSTANT_RADICAL_VERTICAL_GAP |  |
HB_OT_MATH_CONSTANT_RADICAL_DISPLAY_STYLE_VERTICAL_GAP |  |
HB_OT_MATH_CONSTANT_RADICAL_RULE_THICKNESS |  |
HB_OT_MATH_CONSTANT_RADICAL_EXTRA_ASCENDER |  |
HB_OT_MATH_CONSTANT_RADICAL_KERN_BEFORE_DEGREE |  |
HB_OT_MATH_CONSTANT_RADICAL_KERN_AFTER_DEGREE |  |
HB_OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT |  |

Since: 1.3.3

### enum hb_ot_math_kern_t

#### Members

HB_OT_MATH_KERN_TOP_RIGHT |  |
HB_OT_MATH_KERN_TOP_LEFT |  |
HB_OT_MATH_KERN_BOTTOM_RIGHT |  |
HB_OT_MATH_KERN_BOTTOM_LEFT |  |

Since: 1.3.3

### hb_ot_math_glyph_variant_t

    typedef struct {
      hb_codepoint_t glyph;
      hb_position_t advance;
    } hb_ot_math_glyph_variant_t;

Since: 1.3.3

### enum hb_ot_math_glyph_part_flags_t

#### Members

HB_MATH_GLYPH_PART_FLAG_EXTENDER |  |

Since: 1.3.3

### hb_ot_math_glyph_part_t

    typedef struct {
      hb_codepoint_t glyph;
      hb_position_t start_connector_length;
      hb_position_t end_connector_length;
      hb_position_t full_advance;
      hb_ot_math_glyph_part_flags_t flags;
    } hb_ot_math_glyph_part_t;

Since: 1.3.3