Avoid excessive text clipping on Windows
Use a better rounding strategy so that when the bounding box involves part of a pixel we include the full pixel, so floor for -ve values and ceil for +ve ones. Without this I see lots of cut text on Windows. Change-Id: I258f63eb37911574cd3f6f08da22349756c0775c
This commit is contained in:
@@ -3611,10 +3611,10 @@ std::vector<Rectangle> D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid
|
|||||||
bottom = INT32(m.advanceHeight) - m.verticalOriginY - m.bottomSideBearing;
|
bottom = INT32(m.advanceHeight) - m.verticalOriginY - m.bottomSideBearing;
|
||||||
|
|
||||||
// Scale to screen space.
|
// Scale to screen space.
|
||||||
pOut->Left() = std::lround(left * mlfEmHeight / aFontMetrics.designUnitsPerEm);
|
pOut->Left() = std::floor(left * mlfEmHeight / aFontMetrics.designUnitsPerEm);
|
||||||
pOut->Top() = std::lround(top * mlfEmHeight / aFontMetrics.designUnitsPerEm);
|
pOut->Top() = std::floor(top * mlfEmHeight / aFontMetrics.designUnitsPerEm);
|
||||||
pOut->Right() = std::lround(right * mlfEmHeight / aFontMetrics.designUnitsPerEm);
|
pOut->Right() = std::ceil(right * mlfEmHeight / aFontMetrics.designUnitsPerEm);
|
||||||
pOut->Bottom() = std::lround(bottom * mlfEmHeight / aFontMetrics.designUnitsPerEm);
|
pOut->Bottom() = std::ceil(bottom * mlfEmHeight / aFontMetrics.designUnitsPerEm);
|
||||||
|
|
||||||
++pOut;
|
++pOut;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user