System/Utilities/TrueType: Change pointer type to I32* for @stbtt_RenderText()

This commit is contained in:
Alec Murphy 2025-04-12 18:04:40 -04:00
parent b01e1171a3
commit bef1c78c5d
2 changed files with 6 additions and 4 deletions

View file

@ -35,7 +35,7 @@ I32 @stbtt_InitFont(stbtt_fontinfo* info, U8* data, I32 offset)
} }
} }
U8* @stbtt_RenderText(stbtt_fontinfo* info, I32 b_w, I32 b_h, I32 l_h, U8* word) U8* @stbtt_RenderText(stbtt_fontinfo* info, I32 b_w, I32 b_h, I32 l_h, I32* word)
{ {
U64 reg RDI rdi = info; U64 reg RDI rdi = info;
U64 reg RSI rsi = b_w; U64 reg RSI rsi = b_w;

View file

@ -1,7 +1,7 @@
#define STB_TRUETYPE_IMPLEMENTATION #define STB_TRUETYPE_IMPLEMENTATION
#include "stb_truetype.h" #include "stb_truetype.h"
unsigned char* stbtt_RenderText(stbtt_fontinfo* info, int b_w, int b_h, int l_h, char* word) unsigned char* stbtt_RenderText(stbtt_fontinfo* info, int b_w, int b_h, int l_h, int* word)
{ {
// https://github.com/justinmeiners/stb-truetype-example // https://github.com/justinmeiners/stb-truetype-example
/* create a bitmap for the phrase */ /* create a bitmap for the phrase */
@ -18,8 +18,8 @@ unsigned char* stbtt_RenderText(stbtt_fontinfo* info, int b_w, int b_h, int l_h,
ascent = roundf(ascent * scale); ascent = roundf(ascent * scale);
descent = roundf(descent * scale); descent = roundf(descent * scale);
int i; int i = 0;
for (i = 0; i < strlen(word); ++i) { while (word[i]) {
/* how wide is this character */ /* how wide is this character */
int ax; int ax;
int lsb; int lsb;
@ -44,6 +44,8 @@ unsigned char* stbtt_RenderText(stbtt_fontinfo* info, int b_w, int b_h, int l_h,
int kern; int kern;
kern = stbtt_GetCodepointKernAdvance(info, word[i], word[i + 1]); kern = stbtt_GetCodepointKernAdvance(info, word[i], word[i + 1]);
x += roundf(kern * scale); x += roundf(kern * scale);
++i;
} }
return bitmap; return bitmap;