Skip to content

class HbFont

Data type for holding fonts.

Lua wrapper for hb_font_t type.

Reference:

😱 Types incomplete or incorrect? 🙏 Please contribute!


methods


HbFont.new


function HbFont.new(face: HbFace {
    new_from_blob = function,
    new = function,
    collect_unicodes = function,
    get_glyph_count = function,
    get_name = function,
    get_table = function,
    get_table_tags = function,
    get_upem = function,
    ot_color_has_palettes = function,
    ot_color_palette_get_count = function,
    ot_color_palette_get_colors = function,
    ot_color_has_layers = function,
    ...(+8)
})
@param face - Face object.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set up some defaults for scale and shaping functions. Initializes a new hb_font_t from a Face object. Sets the default scale to the face’s upem value, and sets the font shaping functions by calling hb_ot_font_set_funcs on it.

Wraps hb_font_create.

Reference:

HbFont.get_scale


function HbFont.get_scale()
 ->  integer
 ->  integer

@return - x-scale of the font.

@return - y-scale of the font.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Fetch the horizontal and vertical scale of a font.

Wraps hb_font_get_scale.

Reference:

HbFont.set_scale


function HbFont.set_scale(
  x_scale: integer,
  y_scale: integer
)
@param x_scale - desired x-scale of font.

@param y_scale - desired y-scale of font.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Sets the horizontal and vertical scale of a font.

The font scale is a number related to, but not the same as, font size. Typically the client establishes a scale factor to be used between the two. For example, 64, or 256, which would be the fractional-precision part of the font scale.

Wraps hb_font_set_scale.

Reference:

HbFont.get_h_extents


function HbFont.get_h_extents(glyph: integer) ->  FontExtens?
@param glyph - index inside the font.

@return - font extents table for horizontal direction, contains the following or nil if HarfBuzz fails to load font extents:

😱 Types incomplete or incorrect? 🙏 Please contribute!

Fetch the extents for a specified font, for horizontal text segments.

Wraps hb_font_get_h_extents.

Reference:

HbFont.get_v_extents


function HbFont.get_v_extents(glyph: integer) ->  FontExtens?
@param glyph - index inside the font.

@return - font extents table for vertical direction, similar to Font:get_h_extents, or nil if HarfBuzz fails to load font extents:

😱 Types incomplete or incorrect? 🙏 Please contribute!

Wraps hb_font_get_v_extents.

Reference:

HbFont.get_glyph_extents


function HbFont.get_glyph_extents(glyph: integer) ->  GlyphExtens?
@param glyph - index inside the font.

@return - extents table contains the following or nil if HarfBuzz fails to load glyph extents

😱 Types incomplete or incorrect? 🙏 Please contribute!

Wraps hb_font_get_glyph_extents.

Reference:

HbFont.get_glyph_name


function HbFont.get_glyph_name(glyph: integer) ->  string
@param glyph - index inside the font.

@return - name of the glyph or nil.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Wraps hb_font_get_glyph_name.

Reference:

HbFont.get_glyph_from_name


function HbFont.get_glyph_from_name(name: string) ->  integer
@param name - name of the glyph.

@return - glyph index inside the font or nil.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Wraps hb_font_get_glyph_from_name.

Reference:

HbFont.get_glyph_h_advance


function HbFont.get_glyph_h_advance(glyph: integer) ->  integer
@param glyph - glyph index inside the font.

@return - advance glyph advance of the glyph in horizontal direction.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Wraps hb_font_get_glyph_h_advance.

Reference:

HbFont.get_glyph_v_advance


function HbFont.get_glyph_v_advance(glyph: integer) ->  integer
@param glyph - glyph index inside the font.

@return - advance glyph advance of the glyph in vertical direction.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Wraps hb_font_get_glyph_v_advance.

Reference:

HbFont.get_nominal_glyph


function HbFont.get_nominal_glyph(codepoint: integer) ->  integer?

@return - glyph index or nil if codepoint is not supported by the font.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Wraps hb_font_get_nominal_glyph.

Reference:

HbFont.ot_color_glyph_get_png


function HbFont.ot_color_glyph_get_png()

Wraps hb_ot_color_glyph_get_png.

Reference:

😱 Types incomplete or incorrect? 🙏 Please contribute!