diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-10-04 15:03:19 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-11-12 12:12:13 +0100 |
commit | 5054202e71605cb4f10c798be766798d99cb1b6a (patch) | |
tree | b8acfb363bee5faf60f9fd191cab0a29880d4c14 /toolkit | |
parent | b2247f86e42c05991165834ff5d63731b0da2b3b (diff) |
make it possible to find out what fonts are actually really used
A document specifies which font each text is supposed to use,
but we still need to map that to a real available font, which
includes also font fallback in case the font selected doesn't
cover all glyphs.
This commit adds API to track this font mapping, first
StartTrackingFontMappingUse() will make VCL record this
information, and then FinishTrackingFontMappingUse() will stop
and return all the information, as a listing saying that
a requested font got mapped to a list of fonts and the number
of times this took place. This can be useful to find out
what actually gets used for a specific document, or compare how
changing fonts available affects a specific document.
Change-Id: I6426ecef354166bef337b1dc9b9007fda148d5c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123051
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 6914d7125c9b..5991df78fddb 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -564,6 +564,11 @@ public: // css::awt::XReschedule: virtual void SAL_CALL reschedule() override; + // css::awt::XFontMappingUse: + virtual void SAL_CALL startTrackingFontMappingUse() override; + + virtual css::uno::Sequence<css::awt::XFontMappingUseItem> SAL_CALL finishTrackingFontMappingUse() override; + // css:awt:XToolkitRobot virtual void SAL_CALL keyPress( const css::awt::KeyEvent & aKeyEvent ) override; @@ -2532,6 +2537,29 @@ void SAL_CALL VCLXToolkit::reschedule() Application::Reschedule(true); } +// css::awt::XFontMappingUse: +void SAL_CALL VCLXToolkit::startTrackingFontMappingUse() +{ + SolarMutexGuard aSolarGuard; + OutputDevice::StartTrackingFontMappingUse(); +} + +css::uno::Sequence<css::awt::XFontMappingUseItem> +SAL_CALL VCLXToolkit::finishTrackingFontMappingUse() +{ + SolarMutexGuard aSolarGuard; + OutputDevice::FontMappingUseData data = OutputDevice::FinishTrackingFontMappingUse(); + css::uno::Sequence<css::awt::XFontMappingUseItem> ret( data.size()); + for( size_t i = 0; i < data.size(); ++i ) + { + ret[ i ].originalFont = data[ i ].mOriginalFont; + ret[ i ].usedFonts = comphelper::arrayToSequence<OUString,OUString> + (data[ i ].mUsedFonts.data(), data[ i ].mUsedFonts.size()); + ret[ i ].count = data[ i ].mCount; + } + return ret; +} + // css::awt::XToolkitExperimental void SAL_CALL VCLXToolkit::processEventsToIdle() |