Lysa  0.0
Lysa 3D Engine
Font Class Referenceabstract

Detailed Description

A font resource loaded from a TTF/OTF file. Glyphs are packed into an SDF/MSDF atlas.

Lua full name: lysa.Font

Public Member Functions

Font create (uri: string)static
 Loads a font from the given virtual path and returns a new Font instance. More...
 
Font clone ()
 Returns a deep copy of this font, sharing the atlas but with independent rendering parameters. More...
 
float2 get_size (text: string, scale: number)
 Returns the rendered width and height in pixels for the given UTF-8 string at the given scale. More...
 
number get_width (char: string, scale: number)
 Returns the advance width in pixels for the first character of the given string at the given scale. More...
 
GlyphInfo get_glyph_info (index: integer)
 Returns atlas and metrics information for the glyph at the given index. More...
 

Properties

integer font_size
 Atlas font size in pixels used when rasterising glyphs. (read-only)
 
number line_height
 Line height as a multiplier of font_size. (read-only)
 
number ascender
 Distance from the baseline to the top of the tallest glyph, in pixels. (read-only)
 
number descender
 Distance from the baseline to the bottom of the lowest glyph, in pixels (negative). (read-only)
 
Image atlas
 Underlying GPU image containing the glyph atlas. (read-only)
 
float2 px_range
 SDF/MSDF pixel range (x = lower, y = upper).
 
float4 outline_color
 RGBA color of the glyph outline.
 
number outline_threshold
 Distance field threshold for the outline boundary.
 
number outline_bias
 Bias offset applied to the outline distance.
 
number outline_width_absolute
 Absolute outline width in pixels.
 
number outline_width_relative
 Relative outline width as a fraction of the font size.
 
number outline_blur
 Blur factor applied to the outline edge; higher values = softer edge.
 
number rounded_outline
 Corner rounding factor for the outline (0 = square corners, 1 = fully rounded).
 
number rounded_interior
 Corner rounding factor applied to the interior of glyphs.
 

Member Function Documentation

Font create ( string  uri)
static

Loads a font from the given virtual path and returns a new Font instance.

Parameters
uristring
Returns
Font
Font clone ( )

Returns a deep copy of this font, sharing the atlas but with independent rendering parameters.

Returns
Font
float2 get_size ( string  text,
number  scale)

Returns the rendered width and height in pixels for the given UTF-8 string at the given scale.

Parameters
textstring
scalenumber
Returns
float2
number get_width ( string  char,
number  scale)

Returns the advance width in pixels for the first character of the given string at the given scale.

Parameters
charstring
scalenumber
Returns
number
GlyphInfo get_glyph_info ( integer  index)

Returns atlas and metrics information for the glyph at the given index.

Parameters
indexinteger
Returns
GlyphInfo

Property Documentation

integer font_size

Atlas font size in pixels used when rasterising glyphs. (read-only)

number line_height

Line height as a multiplier of font_size. (read-only)

number ascender

Distance from the baseline to the top of the tallest glyph, in pixels. (read-only)

number descender

Distance from the baseline to the bottom of the lowest glyph, in pixels (negative). (read-only)

Image atlas

Underlying GPU image containing the glyph atlas. (read-only)

float2 px_range

SDF/MSDF pixel range (x = lower, y = upper).

float4 outline_color

RGBA color of the glyph outline.

number outline_threshold

Distance field threshold for the outline boundary.

number outline_bias

Bias offset applied to the outline distance.

number outline_width_absolute

Absolute outline width in pixels.

number outline_width_relative

Relative outline width as a fraction of the font size.

number outline_blur

Blur factor applied to the outline edge; higher values = softer edge.

number rounded_outline

Corner rounding factor for the outline (0 = square corners, 1 = fully rounded).

number rounded_interior

Corner rounding factor applied to the interior of glyphs.