diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-03-17 11:53:26 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-03-18 10:48:35 +0100 |
commit | 11847cc5fd22c9b98fd9c2cf1389eee6e404a4fb (patch) | |
tree | 1ba38790388aead46a64a2371862604821e9f4b9 /vcl/skia/gdiimpl.cxx | |
parent | 271e8c99a2a1e28b7eb9fdc5fe16f8be1e8ee763 (diff) |
fix glyph rotation for Skia text rendering on Windows
The makes the chart descriptions in tdf#114209 and e.g. Japanese
from the document from tdf#126169 be rotated correctly,
Change-Id: I09a739fea7629000f3f49e417531bc47ba99c68f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90610
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/skia/gdiimpl.cxx')
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 3bf0724de354..8ce3bf838872 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1265,7 +1265,7 @@ static double toCos(int degree10th) { return SkScalarCos(toRadian(degree10th)); static double toSin(int degree10th) { return SkScalarSin(toRadian(degree10th)); } void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Color textColor, - const SkFont& font) + const SkFont& font, GlyphOrientation glyphOrientation) { std::vector<SkGlyphID> glyphIds; std::vector<SkRSXform> glyphForms; @@ -1274,13 +1274,16 @@ void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Colo Point aPos; const GlyphItem* pGlyph; int nStart = 0; - double orientationAngle = layout.GetOrientation(); // 10th of degree while (layout.GetNextGlyph(&pGlyph, aPos, nStart)) { glyphIds.push_back(pGlyph->glyphId()); - double angle = orientationAngle; - if (pGlyph->IsVertical()) - angle += 900; // 90 degree + int angle = 0; // 10th of degree + if (glyphOrientation == GlyphOrientation::Apply) + { + angle = layout.GetOrientation(); + if (pGlyph->IsVertical()) + angle += 900; // 90 degree + } SkRSXform form = SkRSXform::Make(toCos(angle), toSin(angle), aPos.X(), aPos.Y()); glyphForms.emplace_back(std::move(form)); } |