Gfx: Make bottom overhanging characters visible with D2D

This commit is contained in:
Birunthan Mohanathas 2013-08-10 17:01:48 +03:00
parent b8333dc66d
commit 027feabf86

View File

@ -332,12 +332,16 @@ void CanvasD2D::DrawTextW(const WCHAR* str, UINT strLen, const TextFormat& forma
return rect.X; return rect.X;
} (); } ();
DWRITE_OVERHANG_METRICS overhangMetrics;
formatD2D.m_TextLayout->GetOverhangMetrics(&overhangMetrics);
D2D1::Matrix3x2F transformMatrix; D2D1::Matrix3x2F transformMatrix;
m_Target->GetTransform(&transformMatrix); m_Target->GetTransform(&transformMatrix);
const bool identityTransform = transformMatrix.IsIdentity(); const bool identityTransform = transformMatrix.IsIdentity();
// TODO: Determine if we can avoid clipping. // TODO: Determine if we can avoid clipping.
D2D1_RECT_F clipRect = ToRectF(rect); D2D1_RECT_F clipRect = ToRectF(rect);
clipRect.bottom += ceil(overhangMetrics.bottom);
if (identityTransform) if (identityTransform)
{ {
m_Target->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_ALIASED); m_Target->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_ALIASED);