Alchemy
Loading...
Searching...
No Matches

glyphs.c File Reference

Characters rendered into tiles, string widths and number formatting. More...

Go to the source code of this file.

Macros

#define FONT_GLYPH(n)
 The main font's glyph n, counted from the space character.

Functions

s32 UiText_RenderGlyphPair (s32 code, u32 *out)
 Draws a character, and a second one when the code carries it in bits 8 to 15, into a 16x16-pixel cell of four 4bpp tiles at out: in the text colour over a shadow, or with an outline when UiRenderWork.outline is 1.
s32 UiText_GetWideStringWidth (u16 *text)
 Returns the width in pixels of a zero-terminated string of 16-bit character codes: 4 for a space, the font width for other codes up to 0xff (in German, Spanish, French and Italian a flat 10) and 10 for a kanji.
void UiText_RenderWideStringAtOffset (u16 *text, struct UiWindow *window, s32 x, s32 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.
UNUSED void UiText_RenderGlyphTileAtWorkOffset (u16 *buffer, const struct UiWindow *work, s32 offsetX, s32 offsetY)
 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 work block's copy and VRAM.
void UiText_RenderWideStringInWindow (s16 *text, struct UiWindow *window, s32 x, s32 y)
 Draws a zero-terminated string of 16-bit character codes into a window's tilemap at tile (x, y) of its interior, one tile per character, skipping control codes; a NULL text draws the decoded text in UiRenderWork.entries.
u8 * UiText_FormatNumber (u8 *buffer, s32 input, s32 width)
 Writes value as decimal text into buffer (14 bytes) and returns where the text starts.

Detailed Description

Characters rendered into tiles, string widths and number formatting.

Part of window.c, the window object, compiled only through it.

Definition in file glyphs.c.

Macro Definition Documentation

◆ FONT_GLYPH

#define FONT_GLYPH ( n)
Value:
((const struct FontGlyph *)((n) * sizeof(struct FontGlyph) + \
(const u8 *)gUiText_Glyphs))
const struct FontGlyph gUiText_Glyphs[]
A character of the text font: its width and its rows of pixels.
Definition glyph.h:28
unsigned char u8
Definition types.h:11

The main font's glyph n, counted from the space character.

Definition at line 210 of file glyphs.c.

Referenced by UiText_GetWideStringWidth().

Function Documentation

◆ UiText_RenderGlyphPair()

s32 UiText_RenderGlyphPair ( s32 code,
u32 * out )

Draws a character, and a second one when the code carries it in bits 8 to 15, into a 16x16-pixel cell of four 4bpp tiles at out: in the text colour over a shadow, or with an outline when UiRenderWork.outline is 1.

Returns the width of the text drawn in pixels. The caller supplies 32 words for four tiles.

Definition at line 17 of file glyphs.c.

Referenced by UiText_DrawGlyph(), and UiText_RenderGlyphPair().

◆ UiText_GetWideStringWidth()

s32 UiText_GetWideStringWidth ( u16 * text)

Returns the width in pixels of a zero-terminated string of 16-bit character codes: 4 for a space, the font width for other codes up to 0xff (in German, Spanish, French and Italian a flat 10) and 10 for a kanji.

The kana marks take no width.

Definition at line 218 of file glyphs.c.

Referenced by BattleTarget_RunSelection(), and UiText_GetWideStringWidth().

◆ UiText_RenderWideStringAtOffset()

void UiText_RenderWideStringAtOffset ( u16 * text,
struct UiWindow * window,
s32 x,
s32 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.

A NULL text draws the decoded text in UiRenderWork.entries.

Definition at line 258 of file glyphs.c.

Referenced by Battle_CollectPartyCommands(), Battle_SelectAbility(), BattleMenu_RunActionSelection(), BattleTarget_RunSelection(), ItemList_SelectEntry(), SummonMenu_SelectSummon(), Ui_RunOwnerStatusScreen(), UiText_DrawResource(), UiText_DrawString(), UiText_RenderWideStringAtOffset(), and UiText_ShowLocalizedMessageAndWait().

◆ UiText_RenderGlyphTileAtWorkOffset()

UNUSED void UiText_RenderGlyphTileAtWorkOffset ( u16 * buffer,
const struct UiWindow * work,
s32 offsetX,
s32 offsetY )

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 work block's copy and VRAM.

A NULL buffer draws the decoded text in UiRenderWork.entries. Nothing calls it.

Definition at line 375 of file glyphs.c.

Referenced by UiText_RenderGlyphTileAtWorkOffset().

◆ UiText_RenderWideStringInWindow()

void UiText_RenderWideStringInWindow ( s16 * text,
struct UiWindow * window,
s32 x,
s32 y )

Draws a zero-terminated string of 16-bit character codes into a window's tilemap at tile (x, y) of its interior, one tile per character, skipping control codes; a NULL text draws the decoded text in UiRenderWork.entries.

Control operands are skipped, not rendered as glyphs; the input is read only.

Definition at line 409 of file glyphs.c.

Referenced by DjinnMenu_ShowChangePreview(), UiText_DrawStringInWindow(), and UiText_RenderWideStringInWindow().

◆ UiText_FormatNumber()

u8 * UiText_FormatNumber ( u8 * buffer,
s32 input,
s32 width )

Writes value as decimal text into buffer (14 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 12) and unsigned.

Definition at line 470 of file glyphs.c.

Referenced by Text_FormatPlayTime(), UiText_BuildRenderEntries(), UiText_DrawNumber(), UiText_DrawNumberAtOffset(), UiText_DrawNumberInWindow(), UiText_DrawPrefixedNumberAtOffset(), and UiText_FormatNumber().