mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-10 21:19:55 +02:00
System/Utilities/TrueType: Change pointer type to I32* for @stbtt_RenderText()
This commit is contained in:
@@ -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 RSI rsi = b_w;
|
||||
|
||||
8
src/truetype/truetype.c
vendored
8
src/truetype/truetype.c
vendored
@@ -1,7 +1,7 @@
|
||||
#define STB_TRUETYPE_IMPLEMENTATION
|
||||
#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
|
||||
/* 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);
|
||||
descent = roundf(descent * scale);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < strlen(word); ++i) {
|
||||
int i = 0;
|
||||
while (word[i]) {
|
||||
/* how wide is this character */
|
||||
int ax;
|
||||
int lsb;
|
||||
@@ -44,6 +44,8 @@ unsigned char* stbtt_RenderText(stbtt_fontinfo* info, int b_w, int b_h, int l_h,
|
||||
int kern;
|
||||
kern = stbtt_GetCodepointKernAdvance(info, word[i], word[i + 1]);
|
||||
x += roundf(kern * scale);
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
|
||||
Reference in New Issue
Block a user