stdlib/fontView source ↗
font
19 items · generated by scribe fromstdlib/font.fd· synced 2026-11-15
Contents
- Font (struct)
- Glyph (struct)
- font_load (function)
- font_free (function)
- font_get_glyph (function)
- font_kern (function)
- font_text_width (function)
- font_text_height (function)
- font_render_text (function)
- font_render_text_colored (function)
- BITMAP_FONT_WIDTH: (const)
- font_bitmap_char (function)
- font_bitmap_text (function)
Font
pub struct Font {Fields:
| Name | Type |
|---|---|
info | i64 |
data | Vec<i64> |
scale | f64 |
ascent | f64 |
descent | f64 |
line_gap | f64 |
line_height | f64 |
Defined at line 25
Glyph
pub struct Glyph {Fields:
| Name | Type |
|---|---|
codepoint | i64 |
width | i64 |
height | i64 |
xoff | i64 |
yoff | i64 |
advance | f64 |
bitmap | Vec<i64> |
Defined at line 41
font_load
Load a TrueType font from a file path at the given pixel size. Returns a Font with info=0 on failure.
pub fn font_load(path: str, pixel_size: f64) -> Font {Parameters:
path:strpixel_size:f64
Returns: Font
Defined at line 88
font_free
Free a font’s resources.
pub fn font_free(font: & mut Font) -> void {Parameters:
font:& mut Font
Returns: void
Defined at line 111
font_get_glyph
Get a single glyph bitmap for a codepoint. Returns a Glyph with width=0 if the codepoint is not in the font.
pub fn font_get_glyph(font: & Font, codepoint: i64) -> Glyph {Parameters:
font:& Fontcodepoint:i64
Returns: Glyph
Defined at line 123
font_kern
Get the kerning advance between two codepoints (in pixels).
pub fn font_kern(font: & Font, ch1: i64, ch2: i64) -> f64 {Parameters:
font:& Fontch1:i64ch2:i64
Returns: f64
Defined at line 153
font_text_width
Measure the width of a text string in pixels.
pub fn font_text_width(font: & Font, text: str) -> i64 {Parameters:
font:& Fonttext:str
Returns: i64
Defined at line 163
font_text_height
Measure the height of a text string (line height * number of lines).
pub fn font_text_height(font: & Font, text: str) -> i64 {Parameters:
font:& Fonttext:str
Returns: i64
Defined at line 172
font_render_text
Render a text string to an Image (RGBA pixels, transparent background). The image width is the text width, height is the line height.
pub fn font_render_text(font: & Font, text: str) -> Image {Parameters:
font:& Fonttext:str
Returns: Image
Defined at line 189
font_render_text_colored
Render text with a specific color (r, g, b, a).
pub fn font_render_text_colored(font: & Font, text: str, r: i64, g: i64, b: i64, a: i64) -> Image {Parameters:
font:& Fonttext:strr:i64g:i64b:i64a:i64
Returns: Image
Defined at line 255
BITMAP_FONT_WIDTH:
pub const BITMAP_FONT_WIDTH: i64 = 8; pub const BITMAP_FONT_HEIGHT: i64 = 8;Defined at line 286
font_bitmap_char
Render a single character using the built-in 8x8 bitmap font. Returns an 8x8 RGBA Image.
pub fn font_bitmap_char(ch: i64) -> Image {Parameters:
ch:i64
Returns: Image
Defined at line 289
font_bitmap_text
Render text using the built-in 8x8 bitmap font (no FFI needed).
pub fn font_bitmap_text(text: str) -> Image {Parameters:
text:str
Returns: Image
Defined at line 320
Generated by scribe, the Fides documentation generator