From 5ef04f26756c8294e9e233ef7945b0915a9f7015 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 10 Mar 2018 22:16:43 -0500 Subject: [PATCH] And fixed the other issue: didn't fully set uiDrawTextLayoutParams. Oops =P It works! Also did proper memory management before uiUninit()... but it's crashing for other reasons now (using strdup() instead of uiAlloc()). And Skia doesn't map correctly... --- examples/drawtext/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/drawtext/main.c b/examples/drawtext/main.c index 13c7c659..fb9ee778 100644 --- a/examples/drawtext/main.c +++ b/examples/drawtext/main.c @@ -62,11 +62,12 @@ static void makeAttributedString(void) static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p) { uiDrawTextLayout *textLayout; - uiFontDescriptor fontdesc; + uiFontDescriptor defaultFont; uiDrawTextLayoutParams params; params.String = attrstr; - uiFontButtonFont(fontButton, &fontdesc); + uiFontButtonFont(fontButton, &defaultFont); + params.DefaultFont = &defaultFont; params.Width = p->AreaWidth - (2 * margins); params.Align = uiDrawTextAlignLeft; textLayout = uiDrawNewTextLayout(¶ms); @@ -153,6 +154,7 @@ int main(void) uiControlShow(uiControl(mainwin)); uiMain(); + uiFreeAttributedString(attrstr); uiUninit(); return 0; }