mirror of
https://github.com/nicbarker/clay.git
synced 2026-02-06 12:48:49 +00:00
[Core] Convert measureText pointer to value string slice (#214)
This commit is contained in:
parent
e8025cc254
commit
326325ffaf
6 changed files with 24 additions and 21 deletions
|
|
@ -13,13 +13,13 @@ typedef struct
|
|||
} SDL2_Font;
|
||||
|
||||
|
||||
static Clay_Dimensions SDL2_MeasureText(Clay_String *text, Clay_TextElementConfig *config, uintptr_t userData)
|
||||
static Clay_Dimensions SDL2_MeasureText(Clay_StringSlice text, Clay_TextElementConfig *config, uintptr_t userData)
|
||||
{
|
||||
SDL2_Font *fonts = (SDL2_Font*)userData;
|
||||
|
||||
TTF_Font *font = fonts[config->fontId].font;
|
||||
char *chars = (char *)calloc(text->length + 1, 1);
|
||||
memcpy(chars, text->chars, text->length);
|
||||
char *chars = (char *)calloc(text.length + 1, 1);
|
||||
memcpy(chars, text.chars, text.length);
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
if (TTF_SizeUTF8(font, chars, &width, &height) < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue