src/window/window_glyphs.c
Characters drawn into a glyph sprite's tiles, strings measured and drawn into windows, and numbers written as text. More…
Included by window.c.
Macros
| Name | Description | |
|---|---|---|
#define | GLYPH_BUFFER_WIDTH 16 | The glyph's pixels, 16 to a line as its tiles are read: 16 lines for the Japanese font, 24 for the other languages' taller one. |
#define | GLYPH_PIXEL (x, y) ((y) * GLYPH_BUFFER_WIDTH + (x)) | |
#define | GLYPH_PAIR_SECOND (code) (((code) << 8) >> 16) | The second character of a pair, in bits 8 to 23 of its code. |
#define | GLYPH_PIXELS_SIZE | The glyph buffer's size: 16 lines of pixels for the Japanese font, 24 for the others. |
#define | FONT_GLYPH (n) | Glyph n in the font. |
#define | NUMBER_DIGITS 12 | The digits mnStringFormatNumber writes, in buffer[1] to [12]. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | mnTextDrawGlyphPair (Sint32 code, Uint32 *out) | Draws a character, and a second one when the code carries it in bits 8 to 23, into a 16x16-pixel cell of four 4bpp tiles at out: in the text colour over a shadow, or with an outline when WIN_STATE.outline is TEXT_STYLE_OUTLINED. |
Sint32 | mnTextGetWideStringWidth (Uint16 *text) | Measures a string of 16-bit character codes in pixels: a space takes four, a character up to TEXT_LAST_FONT_CODE its glyph's width (TEXT_MARK_VOICED and TEXT_MARK_SEMIVOICED nothing) and a code above it KANJI_WIDTH. |
void | mnTextDrawWideStringAtOffset (Uint16 *text, WINDOW *window, Sint32 x, Sint32 y) | Draws a zero-terminated string of 16-bit character codes into a text canvas window at pixel (x, y), running its colour, outline, line spacing and new line codes; other control codes are skipped with their arguments. |
void | mnTextDrawWideStringAsTiles (Uint16 *buf, const WINDOW *window, Sint32 offsetX, Sint32 offsetY) | Unused: draws a string of 16-bit character codes straight into the UI tilemap, as tiles, inside a window at tile (offsetX, offsetY) of its interior, writing both the window state's copy and VRAM. |
void | mnTextDrawWideStringInWindow (Sint16 *text, WINDOW *window, Sint32 x, Sint32 y) | Draws a string of wide (16-bit) codes into the window, one glyph per cell, skipping the control codes and their arguments; TEXT_NEWLINE starts a new line. |
Uint8 * | mnStringFormatNumber (Uint8 *buf, Sint32 input, Sint32 width) | Writes input as decimal text into buf (NUMBER_DIGITS + 2 bytes) and returns where the text starts. |
Description
Characters drawn into a glyph sprite's tiles, strings measured and drawn into
windows, and numbers written as text. Part of window.c.
Macros in detail
GLYPH_BUFFER_WIDTH
#define GLYPH_BUFFER_WIDTH 16
The glyph's pixels, 16 to a line as its tiles are read: 16 lines for the Japanese font, 24 for the other languages' taller one.
Referenced by mnTextDrawGlyphPair().
Definition at line 6 of file window_glyphs.c.
GLYPH_PIXEL
#define GLYPH_PIXEL(x, y) ((y) * GLYPH_BUFFER_WIDTH + (x))
Referenced by mnTextDrawGlyphPair().
Definition at line 7 of file window_glyphs.c.
GLYPH_PAIR_SECOND
#define GLYPH_PAIR_SECOND(code) (((code) << 8) >> 16)
The second character of a pair, in bits 8 to 23 of its code.
Definition at line 10 of file window_glyphs.c.
GLYPH_PIXELS_SIZE
#define GLYPH_PIXELS_SIZE
The glyph buffer's size: 16 lines of pixels for the Japanese font, 24 for the others.
Referenced by mnTextDrawGlyphPair().
Definition at line 14 of file window_glyphs.c.
FONT_GLYPH
#define FONT_GLYPH(n)
Glyph n in the font.
Definition at line 204 of file window_glyphs.c.
NUMBER_DIGITS
#define NUMBER_DIGITS 12
The digits mnStringFormatNumber writes, in buffer[1] to [12].
Referenced by mnStringFormatNumber().
Definition at line 499 of file window_glyphs.c.
Functions in detail
mnTextDrawGlyphPair
Sint32 mnTextDrawGlyphPair(Sint32 code, Uint32 *out)
Draws a character, and a second one when the code carries it in bits 8 to 23,
into a 16x16-pixel cell of four 4bpp tiles at out: in the text colour over
a shadow, or with an outline when WIN_STATE.outline is TEXT_STYLE_OUTLINED.
Returns the width drawn, in pixels.
References FontGlyphs, FontKanjiGlyphs, FontMarkGlyphCodes and Sint32.
Referenced by mnGlyphDraw(), mnGlyphDrawAsSprite() and mnGlyphDrawToTiles().
Definition at line 21 of file window_glyphs.c.
mnTextGetWideStringWidth
Sint32 mnTextGetWideStringWidth(Uint16 *text)
Measures a string of 16-bit character codes in pixels: a space takes four, a
character up to TEXT_LAST_FONT_CODE its glyph's width (TEXT_MARK_VOICED and
TEXT_MARK_SEMIVOICED nothing) and a code above it KANJI_WIDTH. German,
Spanish, French and Italian (WIDE_STRING_FIXED_WIDTH) count ten pixels for
every character up to TEXT_LAST_FONT_CODE but the space, and nothing for
those above.
References Sint32.
Referenced by mnBattleTargetRunSelection().
Definition at line 213 of file window_glyphs.c.
mnTextDrawWideStringAtOffset
void mnTextDrawWideStringAtOffset(Uint16 *text, WINDOW *window, Sint32 x, Sint32 y)
Draws a zero-terminated string of 16-bit character codes into a text canvas window at pixel (x, y), running its colour, outline, line spacing and new line codes; other control codes are skipped with their arguments.
References mnGlyphDraw(), mnTextResetStyle() and Sint32.
Referenced by mnBattleCollectPartyCommands(), mnBattleDjinnMenuRun(), mnBattleItemMenuRun(), mnBattlePsynergyMenuRun(), mnBattleRefuseFlee(), mnBattleStatusScreenRun(), mnBattleSummonMenuRun(), mnBattleTargetRunSelection(), mnTextDrawMessage() and mnTextDrawString().
Definition at line 258 of file window_glyphs.c.
mnTextDrawWideStringAsTiles
void mnTextDrawWideStringAsTiles(Uint16 *buf, const WINDOW *window, Sint32 offsetX, Sint32 offsetY)
Unused: draws a string of 16-bit character codes straight into the UI
tilemap, as tiles, inside a window at tile (offsetX, offsetY) of its
interior, writing both the window state's copy and VRAM. A NULL buffer draws
the decoded text in WIN_STATE.textBuf.
References mnTextDrawStringAsTiles() and Sint32.
Definition at line 394 of file window_glyphs.c.
mnTextDrawWideStringInWindow
void mnTextDrawWideStringInWindow(Sint16 *text, WINDOW *window, Sint32 x, Sint32 y)
Draws a string of wide (16-bit) codes into the window, one glyph per cell,
skipping the control codes and their arguments; TEXT_NEWLINE starts a new
line. With no text, the decoded text in WIN_STATE.textBuf is drawn.
References mnWindowPutGlyph() and Sint32.
Referenced by mnBattleDjinnMenuShowChangePreview() and mnTextDrawStringInWindow().
Definition at line 428 of file window_glyphs.c.
mnStringFormatNumber
Uint8 *mnStringFormatNumber(Uint8 *buf, Sint32 input, Sint32 width)
Writes input as decimal text into buf (NUMBER_DIGITS + 2 bytes) and
returns where the text starts. With width 0 the number has no padding and a
minus sign when negative; otherwise it is right-aligned in width characters
(up to NUMBER_DIGITS) and unsigned.
References Sint32, syMathUnsignedMultiplyHigh() and syMathUnsignedMultiplyHighAdd().
Referenced by mnMessageDecode(), mnStringFormatPlayTime(), mnStringFormatStopwatch(), mnTextDrawNumber(), mnTextDrawNumberAtOffset(), mnTextDrawNumberInWindow() and mnTextDrawPrefixedNumberAtOffset().
Definition at line 505 of file window_glyphs.c.