class HbFont
Data type for holding fonts.
Lua wrapper for hb_font_t
type.
Reference:
- Corresponding C source code: luaharfbuzz.h#L14
- HarfBuzz online documentation: hb_font_t
😱 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)
})
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:
- Corresponding C source code: font.c#L3-L20
- HarfBuzz online documentation: hb_font_create
HbFont.get_scale
@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:
- Corresponding C source code: font.c#L31-L40
- HarfBuzz online documentation: hb_font_get_scale
HbFont.set_scale
@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:
- Corresponding C source code: font.c#L22-L29
- HarfBuzz online documentation: hb_font_set_scale
HbFont.get_h_extents
@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:
- Corresponding C source code: font.c#L42-L62
- HarfBuzz online documentation: hb_font_get_h_extents
HbFont.get_v_extents
@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:
- Corresponding C source code: font.c#L64-L84
- HarfBuzz online documentation: hb_font_get_v_extents
HbFont.get_glyph_extents
@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:
- Corresponding C source code: font.c#L86-L110
- HarfBuzz online documentation: hb_font_get_glyph_extents
HbFont.get_glyph_name
@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:
- Corresponding C source code: font.c#L112-L125
- HarfBuzz online documentation: hb_font_get_glyph_name
HbFont.get_glyph_from_name
@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:
- Corresponding C source code: font.c#L127-L138
- HarfBuzz online documentation: hb_font_get_glyph_from_name
HbFont.get_glyph_h_advance
@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:
- Corresponding C source code: font.c#L140-L146
- HarfBuzz online documentation: hb_font_get_glyph_h_advance
HbFont.get_glyph_v_advance
@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:
- Corresponding C source code: font.c#L148-L154
- HarfBuzz online documentation: hb_font_get_glyph_v_advance
HbFont.get_nominal_glyph
@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:
- Corresponding C source code: font.c#L156-L167
- HarfBuzz online documentation: hb_font_get_nominal_glyph
HbFont.ot_color_glyph_get_png
Wraps hb_ot_color_glyph_get_png
.
Reference:
- Corresponding C source code: font.c#L188-L204
😱 Types incomplete or incorrect? 🙏 Please contribute!