fix clipping of Mac OS X text drawing(!) when not kerning
svn: r9834
This commit is contained in:
parent
c19191d35e
commit
40d7afd81c
|
@ -142,6 +142,27 @@ static short cgf_txFont, cgf_txFace;
|
|||
4-bit pixel-aligned anti-aliasing (the old QuickDraw standard). */
|
||||
extern "C" void CGContextSetFontRenderingMode(CGContextRef cg, int v);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static RgnHandle GetCurrentClipRgn(CGrafPtr qdp)
|
||||
{
|
||||
RgnHandle clipRgn;
|
||||
|
||||
clipRgn = NewRgn();
|
||||
if (clipRgn) {
|
||||
RgnHandle visRgn;
|
||||
visRgn = NewRgn();
|
||||
if (visRgn) {
|
||||
GetPortClipRegion(qdp, clipRgn);
|
||||
GetPortVisibleRegion(qdp, visRgn);
|
||||
SectRgn(clipRgn, visRgn, clipRgn);
|
||||
DisposeRgn(visRgn);
|
||||
}
|
||||
}
|
||||
|
||||
return clipRgn;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void wxCanvasDC::DrawText(const char* text, double x, double y, Bool combine, Bool ucs4, int d, double angle)
|
||||
{
|
||||
|
@ -294,6 +315,14 @@ void wxCanvasDC::DrawText(const char* text, double x, double y, Bool combine, Bo
|
|||
qdp = cMacDC->macGrafPort();
|
||||
SyncCGContextOriginWithPort(cg, qdp);
|
||||
GetPortBounds(qdp, &portRect);
|
||||
{
|
||||
RgnHandle clipRgn;
|
||||
clipRgn = GetCurrentClipRgn(qdp);
|
||||
if (clipRgn) {
|
||||
ClipCGContextToRegion(cg, &portRect, clipRgn);
|
||||
DisposeRgn(clipRgn);
|
||||
}
|
||||
}
|
||||
CGContextTranslateCTM(cg,
|
||||
gdx + (x * user_scale_x) + device_origin_x,
|
||||
(portRect.bottom - portRect.top)
|
||||
|
@ -947,17 +976,7 @@ static double DrawMeasUnicodeText(const char *text, int d, int theStrlen, int uc
|
|||
|
||||
if (use_cgctx) {
|
||||
/* Make clipping regions match (including BeginUpdate effect) */
|
||||
clipRgn = NewRgn();
|
||||
if (clipRgn) {
|
||||
RgnHandle visRgn;
|
||||
visRgn = NewRgn();
|
||||
if (visRgn) {
|
||||
GetPortClipRegion(qdp, clipRgn);
|
||||
GetPortVisibleRegion(qdp, visRgn);
|
||||
SectRgn(clipRgn, visRgn, clipRgn);
|
||||
DisposeRgn(visRgn);
|
||||
}
|
||||
}
|
||||
clipRgn = GetCurrentClipRgn(qdp);
|
||||
} else
|
||||
clipRgn = NULL;
|
||||
} else
|
||||
|
|
Loading…
Reference in New Issue
Block a user