31 if (reference_glyph_context)
34 int32_t total_number_width;
36 if (!reference_glyph_context || !texture_descriptor)
37 total_number_width = 1;
42 total_number_width = reference_width_minus_one + 1;
45 int32_t hundreds_digit;
49 hundreds_digit = number / 0x64;
53 if (reference_glyph_context)
56 int32_t hundreds_measure_width;
58 if (!reference_glyph_context || !hundreds_measure_descriptor)
59 hundreds_measure_width = 1;
64 hundreds_measure_width = hundreds_measure_width_minus_one + 1;
67 total_number_width = total_number_width + hundreds_measure_width + 2;
74 tens_digit = (int64_t)number % 0x64 / 0xa;
78 if (reference_glyph_context)
81 if (!reference_glyph_context || !tens_measure_descriptor)
82 total_number_width += 3;
87 total_number_width = total_number_width + tens_measure_width_minus_one + 1 + 2;
91 int32_t packed_xy = packed_center_xy - (total_number_width >> 1);
102 if (hundreds_glyph_context)
105 int32_t hundreds_draw_width;
107 if (!hundreds_glyph_context || !hundreds_draw_descriptor)
108 hundreds_draw_width = 1;
113 hundreds_draw_width = hundreds_draw_width_minus_one + 1;
116 packed_xy = packed_xy + hundreds_draw_width + 2;
128 if (tens_glyph_context)
131 int32_t tens_draw_width;
133 if (!tens_glyph_context || !tens_draw_descriptor)
139 tens_draw_width = tens_draw_width_minus_one + 1;
142 packed_xy = packed_xy + tens_draw_width + 2;
179 bool use_gradient = font == NULL;
187 const uint8_t *bytes = (
const uint8_t *)text;
192 for (
const uint8_t *ch = bytes; *ch; ++ch)
195 width += (fixed_spacing ? advance :
glyph_width(material)) + 1;
202 uint32_t top = 0, bottom = 0;
208 for (
const uint8_t *ch = bytes; *ch; ++ch)
216 else if (fixed_spacing)
221 packed_xy += (fixed_spacing ? advance :
glyph_width(material)) + 1;
struct Material_RuntimeDescriptor * textureDescriptor
struct Material_SectionHeader * material_section
struct Material_TableEntry * material_table_entry
struct Material_FrameSet * frame_set
struct Material_RuntimeDescriptor * texture_descriptor
static void render_text(uint32_t packed_xy, const char *text, uint32_t flags, struct Material_RefEntry *font, bool fixed_spacing, uint32_t advance)
void UI_RenderText(uint32_t packed_xy, const char *text, uint32_t text_flags, void *font_context)
void UI_RenderCenteredNumber(uint32_t packed_center_xy, int32_t number)
void UI_RenderFixedAdvanceText(uint32_t packed_xy, const char *text, uint32_t text_flags, void *font_context, uint32_t glyph_advance)
static uint32_t glyph_width(const struct Material_TableEntry *material)
int32_t UI_ComputeStringWidth(char const *text)