And fixed errors. Woo, it works!!!!!

This commit is contained in:
Pietro Gagliardi 2017-01-17 13:54:23 -05:00
parent 907d7c5830
commit 7f270942a7
3 changed files with 7 additions and 5 deletions

View File

@ -131,7 +131,9 @@ void uiAttributedStringInsertAtUnattributed(uiAttributedString *s, const char *s
// TODO
}
at16 = s->u8tou16[at];
at16 = 0;
if (s->u8tou16 != NULL)
at16 = s->u8tou16[at];
// do this first to reclaim memory
invalidateGraphemes(s);

View File

@ -231,7 +231,8 @@ void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
CGContextSetTextMatrix(c->c, CGAffineTransformIdentity);
// wait, that's not enough; we need to offset y values to account for our new flipping
y = c->height - y;
// TODO explain this calculation
y = c->height - tl->size.height - y;
// CTFrameDraw() draws in the path we specified when creating the frame
// this means that in our usage, CTFrameDraw() will draw at (0,0)

View File

@ -34,7 +34,7 @@ uiDrawFontDescriptor defaultFont = {
};
uiAttributedString *attrstr;
#define margins 5
#define margins 10
static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p)
{
@ -113,8 +113,7 @@ int main(void)
attrstr = uiNewAttributedString(text);
mainwin = uiNewWindow("libui Histogram Example", 640, 480, 1);
uiWindowSetMargined(mainwin, 1);
mainwin = uiNewWindow("libui Text-Drawing Example", 640, 480, 1);
uiWindowOnClosing(mainwin, onClosing, NULL);
area = uiNewArea(&handler);