[Libreoffice-commits] core.git: canvas/source include/canvas
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 1 13:28:02 UTC 2018
canvas/source/directx/dx_canvasfont.cxx | 6 ++++--
canvas/source/directx/dx_canvasfont.hxx | 2 ++
canvas/source/directx/dx_textlayout_drawhelper.cxx | 8 ++++++++
canvas/source/tools/canvastools.cxx | 11 +++++++++++
canvas/source/vcl/canvasfont.cxx | 9 ++++++++-
include/canvas/canvastools.hxx | 7 +++++++
6 files changed, 40 insertions(+), 3 deletions(-)
New commits:
commit 17cd7dd708631f7af9e66860b403627416e4545e
Author: Mark Hung <marklh9 at gmail.com>
AuthorDate: Wed Oct 24 00:04:56 2018 +0800
Commit: Mark Hung <marklh9 at gmail.com>
CommitDate: Thu Nov 1 14:27:31 2018 +0100
tdf#43671 set emphasis mark of vcl::Font (windows).
Process extra font properties of the canvas font to
set emphasis mark when creating vcl::Font.
Change-Id: I18ea1aecdde92ed3c777b0db27fcee7976e88476
Reviewed-on: https://gerrit.libreoffice.org/62245
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9 at gmail.com>
diff --git a/canvas/source/directx/dx_canvasfont.cxx b/canvas/source/directx/dx_canvasfont.cxx
index 5bf74ccc0d2e..e306fe84b1af 100644
--- a/canvas/source/directx/dx_canvasfont.cxx
+++ b/canvas/source/directx/dx_canvasfont.cxx
@@ -47,14 +47,14 @@ namespace dxcanvas
}
CanvasFont::CanvasFont( const rendering::FontRequest& rFontRequest,
- const uno::Sequence< beans::PropertyValue >& /*extraFontProperties*/,
+ const uno::Sequence< beans::PropertyValue >& extraFontProperties,
const geometry::Matrix2D& fontMatrix ) :
CanvasFont_Base( m_aMutex ),
mpGdiPlusUser( GDIPlusUser::createInstance() ),
- // TODO(F1): extraFontProperties, fontMatrix
mpFontFamily(),
mpFont(),
maFontRequest( rFontRequest ),
+ mnEmphasisMark(0),
maFontMatrix( fontMatrix )
{
mpFontFamily.reset( new Gdiplus::FontFamily(o3tl::toW(rFontRequest.FontDescription.FamilyName.getStr()),nullptr) );
@@ -65,6 +65,8 @@ namespace dxcanvas
static_cast<Gdiplus::REAL>(rFontRequest.CellSize),
calcFontStyle( rFontRequest ),
Gdiplus::UnitWorld ));
+
+ ::canvas::tools::extractExtraFontProperties(extraFontProperties, mnEmphasisMark);
}
void SAL_CALL CanvasFont::disposing()
diff --git a/canvas/source/directx/dx_canvasfont.hxx b/canvas/source/directx/dx_canvasfont.hxx
index 7d463a386ae2..15b2fa8eef03 100644
--- a/canvas/source/directx/dx_canvasfont.hxx
+++ b/canvas/source/directx/dx_canvasfont.hxx
@@ -77,12 +77,14 @@ namespace dxcanvas
double getEmHeight() const;
FontSharedPtr getFont() const;
const css::geometry::Matrix2D& getFontMatrix() const;
+ sal_uInt32 getEmphasisMark() const { return mnEmphasisMark; }
private:
GDIPlusUserSharedPtr mpGdiPlusUser;
FontFamilySharedPtr mpFontFamily;
FontSharedPtr mpFont;
css::rendering::FontRequest maFontRequest;
+ sal_uInt32 mnEmphasisMark;
css::geometry::Matrix2D maFontMatrix;
};
diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx
index f4d51e9d8d73..7441bbbf933b 100644
--- a/canvas/source/directx/dx_textlayout_drawhelper.cxx
+++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx
@@ -125,6 +125,10 @@ namespace dxcanvas
aFont.SetColor( aColor );
aFont.SetFillColor( aColor );
+ CanvasFont::ImplRef pFont(tools::canvasFontFromXFont(rCanvasFont));
+ if (pFont.is() && pFont->getEmphasisMark())
+ aFont.SetEmphasisMark(FontEmphasisMark(pFont->getEmphasisMark()));
+
// adjust to stretched font
if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11))
{
@@ -270,6 +274,10 @@ namespace dxcanvas
aFont.SetAverageFontWidth( nNewWidth );
}
+ CanvasFont::ImplRef pFont(tools::canvasFontFromXFont(rCanvasFont));
+ if (pFont.is() && pFont->getEmphasisMark())
+ aFont.SetEmphasisMark(FontEmphasisMark(pFont->getEmphasisMark()));
+
// set font
xVirtualDevice->SetFont(aFont);
diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx
index 189efe4a2e75..55e2cfcdf13a 100644
--- a/canvas/source/tools/canvastools.cxx
+++ b/canvas/source/tools/canvastools.cxx
@@ -1309,6 +1309,17 @@ namespace canvas
p2ndOutDev->SetClipRegion( aClipRegion );
}
}
+
+ void extractExtraFontProperties(const uno::Sequence<beans::PropertyValue>& rExtraFontProperties,
+ sal_uInt32 &rEmphasisMark)
+ {
+ for(sal_Int32 nIdx = 0; nIdx < rExtraFontProperties.getLength(); ++nIdx)
+ {
+ if (rExtraFontProperties[nIdx].Name == "EmphasisMark")
+ rExtraFontProperties[0].Value >>= rEmphasisMark;
+ }
+ }
+
} // namespace tools
} // namespace canvas
diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx
index 5eb27f9cf0c4..d3ca032d6563 100644
--- a/canvas/source/vcl/canvasfont.cxx
+++ b/canvas/source/vcl/canvasfont.cxx
@@ -35,7 +35,7 @@ using namespace ::com::sun::star;
namespace vclcanvas
{
CanvasFont::CanvasFont( const rendering::FontRequest& rFontRequest,
- const uno::Sequence< beans::PropertyValue >& ,
+ const uno::Sequence< beans::PropertyValue >& rExtraFontProperties,
const geometry::Matrix2D& rFontMatrix,
rendering::XGraphicDevice& rDevice,
const OutDevProviderSharedPtr& rOutDevProvider ) :
@@ -82,6 +82,13 @@ namespace vclcanvas
rOutDev.EnableMapMode(bOldMapState);
}
+
+ sal_uInt32 nEmphasisMark = 0;
+
+ ::canvas::tools::extractExtraFontProperties(rExtraFontProperties, nEmphasisMark);
+
+ if (nEmphasisMark)
+ maFont->SetEmphasisMark(FontEmphasisMark(nEmphasisMark));
}
void SAL_CALL CanvasFont::disposing()
diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx
index 7416fc31529b..31c8ba3fc345 100644
--- a/include/canvas/canvastools.hxx
+++ b/include/canvas/canvastools.hxx
@@ -71,6 +71,10 @@ namespace com { namespace sun { namespace star { namespace awt
class XWindow2;
} } } }
+namespace com { namespace sun { namespace star { namespace beans {
+ struct PropertyValue;
+} } } }
+
class Color;
class OutputDevice;
@@ -549,6 +553,9 @@ namespace canvas
const css::rendering::RenderState& renderState,
OutputDevice& rOutDev,
OutputDevice* p2ndOutDev=nullptr);
+
+ CANVASTOOLS_DLLPUBLIC void extractExtraFontProperties(const css::uno::Sequence<css::beans::PropertyValue>& rExtraFontProperties,
+ sal_uInt32& rEmphasisMark);
}
}
More information about the Libreoffice-commits
mailing list