|
NSUNI/NSLAR Library a250670
|
Classes | |
| struct | nnl::text::BitmapFont |
| Represents a bitmap font consisting of glyph atlases and advance widths. More... | |
| struct | nnl::text::BitmapFontParams |
| Parameters for generating a bitmap font. More... | |
Functions | |
| BitmapFont | nnl::text::GenerateBitmapFont (Text &text, const std::filesystem::path &ttf_font_path, const BitmapFontParams ¶ms={}) |
| Generates a bitmap font from a TrueType font file. | |
| std::string | nnl::text::GenerateFNT (const Text &text, const std::vector< u8 > &advance_width, const std::vector< STexture > &bitmaps, int columns=-1) |
| Generates a BMFont .fnt file. | |
| struct nnl::text::BitmapFont |
Represents a bitmap font consisting of glyph atlases and advance widths.
Public Attributes | |
| std::vector< STexture > | bitmaps |
| Glyph atlases. | |
| std::vector< u8 > | advance_width |
| std::vector<u8> nnl::text::BitmapFont::advance_width |
Advance width for every character glyph. Each entry corresponds to a character defined in the Text struct.
| std::vector<STexture> nnl::text::BitmapFont::bitmaps |
Glyph atlases.
| struct nnl::text::BitmapFontParams |
Parameters for generating a bitmap font.
Public Attributes | |
| unsigned int | size = 128 |
| unsigned int | columns = 8 |
| Number of glyphs in a row of the bitmap. | |
| float | opacity_factor = 1.5f |
| A multiplier that makes glyphs brighter or dimmer. | |
| float | scale_factor = 1.0f |
| A multiplier that forcibly scales glyphs. | |
| int | spacing_offset = 0 |
| An additional offset for character spacing. | |
| bool | simulate_kerning = false |
| bool | filter_nearest = false |
| Flag to use the nearest/linear neighbor filtering. | |
| unsigned int | alpha_levels = 256 |
| Number of shades to use. | |
| unsigned int nnl::text::BitmapFontParams::alpha_levels = 256 |
Number of shades to use.
| unsigned int nnl::text::BitmapFontParams::columns = 8 |
Number of glyphs in a row of the bitmap.
| bool nnl::text::BitmapFontParams::filter_nearest = false |
Flag to use the nearest/linear neighbor filtering.
| float nnl::text::BitmapFontParams::opacity_factor = 1.5f |
A multiplier that makes glyphs brighter or dimmer.
| float nnl::text::BitmapFontParams::scale_factor = 1.0f |
A multiplier that forcibly scales glyphs.
| bool nnl::text::BitmapFontParams::simulate_kerning = false |
Simulates kerning between characters (by using more characters)
| unsigned int nnl::text::BitmapFontParams::size = 128 |
The width and height of the bitmap.
| int nnl::text::BitmapFontParams::spacing_offset = 0 |
An additional offset for character spacing.
| BitmapFont nnl::text::GenerateBitmapFont | ( | Text & | text, |
| const std::filesystem::path & | ttf_font_path, | ||
| const BitmapFontParams & | params = {} ) |
Generates a bitmap font from a TrueType font file.
This function creates a BitmapFont object based on the provided text and TrueType font, using the specified parameters for customization.
| text | The Text object containing the character data for the font (The object may be changed if simulate_kerning is true) |
| ttf_font_path | The path to the TrueType font file. |
| params | An object containing customization options. |
| std::string nnl::text::GenerateFNT | ( | const Text & | text, |
| const std::vector< u8 > & | advance_width, | ||
| const std::vector< STexture > & | bitmaps, | ||
| int | columns = -1 ) |
Generates a BMFont .fnt file.
This function creates a BMFont .fnt file using the provided data. The generated .fnt file can be utilized in Godot.
| text | The Text object containing the character data to be included in the .fnt file. |
| advance_width | Advance width for each character. |
| bitmaps | Character glyph bitmaps. |
| columns | An optional parameter specifying the number of columns in the bitmap. If not provided, it's calculated automatically. |