vcl: vertical writing in WinFontInstance::ImplGetGlyphBoundRect.
Identity matrix isn't enough for vertical writing. For those glyphs that is vertical, they have to be rotated 90 degrees. Change-Id: Ia5f1f8ac9cea89aec2c98b88058ec79f733fc238 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115148 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
This commit is contained in:
+19
-3
@@ -1254,7 +1254,7 @@ void WinSalGraphics::ClearDevFontCache()
|
||||
ImplReleaseTempFonts(*GetSalData(), false);
|
||||
}
|
||||
|
||||
bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool) const
|
||||
bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bIsVertical) const
|
||||
{
|
||||
assert(m_pGraphics);
|
||||
HDC hDC = m_pGraphics->getHDC();
|
||||
@@ -1269,8 +1269,24 @@ bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& r
|
||||
|
||||
// use unity matrix
|
||||
MAT2 aMat;
|
||||
aMat.eM11 = aMat.eM22 = FixedFromDouble( 1.0 );
|
||||
aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 );
|
||||
const FontSelectPattern& rFSD = GetFontSelectPattern();
|
||||
|
||||
// Use identity matrix for fonts requested in horizontal
|
||||
// writing (LTR or RTL), or rotated glyphs in vertical writing.
|
||||
if (!rFSD.mbVertical || !bIsVertical)
|
||||
{
|
||||
aMat.eM11 = aMat.eM22 = FixedFromDouble(1.0);
|
||||
aMat.eM12 = aMat.eM21 = FixedFromDouble(0.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
constexpr double nCos = 0.0;
|
||||
constexpr double nSin = 1.0;
|
||||
aMat.eM11 = FixedFromDouble(nCos);
|
||||
aMat.eM12 = FixedFromDouble(nSin);
|
||||
aMat.eM21 = FixedFromDouble(-nSin);
|
||||
aMat.eM22 = FixedFromDouble(nCos);
|
||||
}
|
||||
|
||||
UINT nGGOFlags = GGO_METRICS;
|
||||
nGGOFlags |= GGO_GLYPH_INDEX;
|
||||
|
||||
Reference in New Issue
Block a user