I just ran into a text allignment prob on mac.
Multi line text was not center alligned correctly for each line. Allignment was based on the widest text line and used for all other lines of an ITextControl. This is not the behaviour one would expect (and ugly as well). Win builds allign correctly.
I made a change at swell-gdi.mm which corrects that. Maybe it's useful for someone else as well.
Code:
int DrawText(HDC ctx, const char *buf, int buflen, RECT *r, int align)
[...]
if (lines)
{
int n=CFArrayGetCount(lines);
int x;
for(x=0;x<n;x++)
{
CTLineRef l = (CTLineRef)CFArrayGetValueAtIndex(lines,x);
if (l)
{
CGFloat asc=0,desc=0,lead=0;
float lw=CTLineGetTypographicBounds(l,&asc,&desc,&lead);
///////////////////////////////////////////////////////////////
xo = r->left + (r->right-r->left)/2 - lw/2; // add this line
///////////////////////////////////////////////////////////////
if (bgc)
{
CGContextSetFillColorWithColor(ct->ctx, bgc);
CGContextFillRect(ct->ctx, CGRectMake(xo,yo,lw,asc+desc+lead));
}
CGContextSetTextPosition(ct->ctx, xo, yo + asc);
CTLineDraw(l,ct->ctx);
yo += floor(asc+desc+lead+0.5);
}
}
}