diff --git a/Common/Gfx/TextFormatD2D.cpp b/Common/Gfx/TextFormatD2D.cpp index 306a89ad..ca44fb80 100644 --- a/Common/Gfx/TextFormatD2D.cpp +++ b/Common/Gfx/TextFormatD2D.cpp @@ -54,6 +54,10 @@ void TextFormatD2D::CreateLayout( m_LastString.assign(str, strLen); } + // The width and height of a DirectWrite layout must be non-negative. + maxW = max(0.0f, maxW); + maxH = max(0.0f, maxH); + if (m_Trimming) { // GDI+ compatibility: If we trimming (i.e. clipping), GDI+ draws text lines even if they