[Libreoffice-commits] core.git: vcl/inc vcl/win
Mark Hung (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 8 04:35:07 UTC 2021
vcl/inc/win/DWriteTextRenderer.hxx | 2 +-
vcl/win/gdi/DWriteTextRenderer.cxx | 14 ++++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
New commits:
commit b35b8079b3f03b93efdaf2d54b4a515df296e71d
Author: Mark Hung <marklh9 at gmail.com>
AuthorDate: Sun May 2 11:28:34 2021 +0800
Commit: Mark Hung <marklh9 at gmail.com>
CommitDate: Sat May 8 06:34:31 2021 +0200
vcl: Rotate glyph in DWriteTextRenderer for vertical writing.
- This is part of the work to make all the text renders
consistently use the positions created from harfbuzz.
- Rotate 90 deg if the glyph is vertical.
Change-Id: I0ef6569cf019ed2cfeec0b7e7b9709a7e8cf8021
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115016
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9 at gmail.com>
diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx
index 9011a951d277..6e097546d1e2 100644
--- a/vcl/inc/win/DWriteTextRenderer.hxx
+++ b/vcl/inc/win/DWriteTextRenderer.hxx
@@ -88,7 +88,7 @@ private:
class WinFontTransformGuard
{
public:
- WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline);
+ WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, bool bIsVertical);
~WinFontTransformGuard();
private:
diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx
index abf9be7d5f86..690f569dbeba 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -268,7 +268,7 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa
DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
D2D1_POINT_2F baseline = { static_cast<FLOAT>(aPos.X() - bounds.Left()) / fHScale,
static_cast<FLOAT>(aPos.Y() - bounds.Top()) };
- WinFontTransformGuard aTransformGuard(mpRT, fHScale, rLayout, baseline);
+ WinFontTransformGuard aTransformGuard(mpRT, fHScale, rLayout, baseline, pGlyph->IsVertical());
DWRITE_GLYPH_RUN glyphs = {
mpFontFace,
mlfEmHeight,
@@ -389,7 +389,8 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** p
WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale,
const GenericSalLayout& rLayout,
- const D2D1_POINT_2F& rBaseline)
+ const D2D1_POINT_2F& rBaseline,
+ bool bIsVertical)
: mpRenderTarget(pRenderTarget)
{
pRenderTarget->GetTransform(&maTransform);
@@ -400,13 +401,18 @@ WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, f
= aTransform * D2D1::Matrix3x2F::Scale(D2D1::Size(fHScale, 1.0f), D2D1::Point2F(0, 0));
}
- if (rLayout.GetOrientation())
+ Degree10 angle = rLayout.GetOrientation();
+
+ if (bIsVertical)
+ angle += 900_deg10;
+
+ if (angle)
{
// DWrite angle is in clockwise degrees, our orientation is in counter-clockwise 10th
// degrees.
aTransform = aTransform
* D2D1::Matrix3x2F::Rotation(
- -static_cast<FLOAT>(rLayout.GetOrientation().get()) / 10, rBaseline);
+ -static_cast<FLOAT>(angle.get()) / 10, rBaseline);
}
mpRenderTarget->SetTransform(aTransform);
}
More information about the Libreoffice-commits
mailing list