diff options
-rw-r--r-- | vcl/inc/skia/gdiimpl.hxx | 10 | ||||
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 13 | ||||
-rw-r--r-- | vcl/skia/win/gdiimpl.cxx | 3 | ||||
-rw-r--r-- | vcl/skia/x11/textrender.cxx | 3 |
4 files changed, 20 insertions, 9 deletions
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index a7de1cfc4872..630b7a138844 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -203,14 +203,20 @@ public: void drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& aBitmap, SkBlendMode eBlendMode = SkBlendMode::kSrcOver); - void drawGenericLayout(const GenericSalLayout& layout, Color textColor, const SkFont& font); + enum class GlyphOrientation + { + Apply, + Ignore + }; + void drawGenericLayout(const GenericSalLayout& layout, Color textColor, const SkFont& font, + GlyphOrientation glyphOrientation); protected: // To be called before any drawing. void preDraw(); // To be called after any drawing. void postDraw(); - // The canvas to drawn to. Will be diverted to a temporary for Xor mode. + // The canvas to draw to. Will be diverted to a temporary for Xor mode. SkCanvas* getDrawCanvas() { return mXorMode ? getXorCanvas() : mSurface->getCanvas(); } virtual void createSurface(); 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)); } diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index b7014ed33b48..0708c8ea633f 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -155,7 +155,8 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout) SkiaSalGraphicsImpl* impl = static_cast<SkiaSalGraphicsImpl*>(mWinParent.GetImpl()); COLORREF color = ::GetTextColor(mWinParent.getHDC()); Color salColor(GetRValue(color), GetGValue(color), GetBValue(color)); - impl->drawGenericLayout(rLayout, salColor, font); + // The font already is set up to have glyphs rotated as needed. + impl->drawGenericLayout(rLayout, salColor, font, SkiaSalGraphicsImpl::GlyphOrientation::Ignore); return true; } diff --git a/vcl/skia/x11/textrender.cxx b/vcl/skia/x11/textrender.cxx index 02911fcf5154..a980523476b3 100644 --- a/vcl/skia/x11/textrender.cxx +++ b/vcl/skia/x11/textrender.cxx @@ -59,7 +59,8 @@ void SkiaTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalGr assert(dynamic_cast<SkiaSalGraphicsImpl*>(rGraphics.GetImpl())); SkiaSalGraphicsImpl* impl = static_cast<SkiaSalGraphicsImpl*>(rGraphics.GetImpl()); - impl->drawGenericLayout(rLayout, mnTextColor, font); + impl->drawGenericLayout(rLayout, mnTextColor, font, + SkiaSalGraphicsImpl::GlyphOrientation::Apply); } void SkiaTextRender::ClearDevFontCache() { fontManager.reset(); } |