Module: graphics.font.bitmap
Source: ./graphics/font/bitmap.reef
Overview
graphics/font/bitmap.reef - Bitmap font implementation Part of reef-stdlib graphics module
Bitmap fonts use a grid of pixels to represent each glyph. This module includes built-in 8x8 and 8x16 fonts based on classic PC/VGA fonts, suitable for console and terminal applications.
Types
BitmapFont
Fields:
| Name | Type |
|---|---|
family_name |
string |
style |
font.FontStyle |
glyph_data |
[int] |
glyph_width |
int |
glyph_height |
int |
bytes_per_glyph |
int |
first_char |
int |
char_count |
int |
Functions
fn get_bit(val: int, bit_pos: int): int
Get the value of bit at position (0-7) from an int (treating it as a byte) Returns 1 if bit is set, 0 otherwise
fn bit_mask(bit_pos: int): int
Power of 2 for bit position
fn create_bitmap_font(glyph_data: [int], glyph_width: int, glyph_height: int, first_char: int, char_count: int): BitmapFont
fn bitmap_font_family(f: BitmapFont): string
fn bitmap_font_style(f: BitmapFont): font.FontStyle
fn bitmap_font_metrics(f: BitmapFont): font.FontMetrics
fn bitmap_font_glyph_width(f: BitmapFont): int
fn bitmap_font_glyph_height(f: BitmapFont): int
fn bitmap_font_has_glyph(f: BitmapFont, codepoint: int): bool
fn bitmap_font_glyph_index(f: BitmapFont, codepoint: int): int
fn bitmap_font_glyph_advance(f: BitmapFont, glyph_index: int, size: float): float
fn bitmap_font_glyph_bounds(f: BitmapFont, glyph_index: int, size: float): core.Rect
fn bitmap_font_glyph_data(f: BitmapFont, glyph_index: int): [int]
fn bitmap_font_render_glyph(f: BitmapFont, glyph_index: int, size: float): image.Image
fn builtin_font_8x8(): BitmapFont
Classic 8x8 pixel font (CP437 style) Characters 0-127 (ASCII), 8 bytes per character
fn builtin_font_8x16(): BitmapFont
Classic 8x16 pixel font (VGA style) Characters 0-127 (ASCII), 16 bytes per character
Generated by reefc doc