And fixed errors. Woo, it works!!!!!
This commit is contained in:
parent
907d7c5830
commit
7f270942a7
|
@ -131,7 +131,9 @@ void uiAttributedStringInsertAtUnattributed(uiAttributedString *s, const char *s
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
at16 = s->u8tou16[at];
|
at16 = 0;
|
||||||
|
if (s->u8tou16 != NULL)
|
||||||
|
at16 = s->u8tou16[at];
|
||||||
|
|
||||||
// do this first to reclaim memory
|
// do this first to reclaim memory
|
||||||
invalidateGraphemes(s);
|
invalidateGraphemes(s);
|
||||||
|
|
|
@ -231,7 +231,8 @@ void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
|
||||||
CGContextSetTextMatrix(c->c, CGAffineTransformIdentity);
|
CGContextSetTextMatrix(c->c, CGAffineTransformIdentity);
|
||||||
|
|
||||||
// wait, that's not enough; we need to offset y values to account for our new flipping
|
// 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
|
// CTFrameDraw() draws in the path we specified when creating the frame
|
||||||
// this means that in our usage, CTFrameDraw() will draw at (0,0)
|
// this means that in our usage, CTFrameDraw() will draw at (0,0)
|
||||||
|
|
|
@ -34,7 +34,7 @@ uiDrawFontDescriptor defaultFont = {
|
||||||
};
|
};
|
||||||
uiAttributedString *attrstr;
|
uiAttributedString *attrstr;
|
||||||
|
|
||||||
#define margins 5
|
#define margins 10
|
||||||
|
|
||||||
static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p)
|
static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p)
|
||||||
{
|
{
|
||||||
|
@ -113,8 +113,7 @@ int main(void)
|
||||||
|
|
||||||
attrstr = uiNewAttributedString(text);
|
attrstr = uiNewAttributedString(text);
|
||||||
|
|
||||||
mainwin = uiNewWindow("libui Histogram Example", 640, 480, 1);
|
mainwin = uiNewWindow("libui Text-Drawing Example", 640, 480, 1);
|
||||||
uiWindowSetMargined(mainwin, 1);
|
|
||||||
uiWindowOnClosing(mainwin, onClosing, NULL);
|
uiWindowOnClosing(mainwin, onClosing, NULL);
|
||||||
|
|
||||||
area = uiNewArea(&handler);
|
area = uiNewArea(&handler);
|
||||||
|
|
Loading…
Reference in New Issue