diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-07-30 10:38:43 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-07-31 18:29:39 +0200 |
commit | 74317ed5f794816bc9b33e087c5412833fbba420 (patch) | |
tree | b192e0a424d3434d3cbc8cc0db17029b9d640554 /cui | |
parent | aa2e694e8d9e22de94dbf21f81883f9af0e34ce9 (diff) |
Font features: Use Graphite instead of HarfBuzz if available
When searching for font features, use Graphtie if it is available
instead of HarfBuzz, because HarfBuzz will only give a subset of
OpenType features in a Graphite font, but will ignore additional
features specific to Graphite.
Change-Id: I00c8790ee4d1e1ab906928f649d2a3e54163557f
Reviewed-on: https://gerrit.libreoffice.org/58306
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/FontFeaturesDialog.cxx | 27 | ||||
-rw-r--r-- | cui/source/inc/FontFeaturesDialog.hxx | 2 | ||||
-rw-r--r-- | cui/uiconfig/ui/fontfeaturesdialog.ui | 2 |
3 files changed, 21 insertions, 10 deletions
diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx index 21c71ce753b7..078e9a630a80 100644 --- a/cui/source/dialogs/FontFeaturesDialog.cxx +++ b/cui/source/dialogs/FontFeaturesDialog.cxx @@ -9,7 +9,6 @@ */ #include <FontFeaturesDialog.hxx> - #include <vcl/font/FeatureParser.hxx> #include <svx/dialmgr.hxx> @@ -56,20 +55,32 @@ void FontFeaturesDialog::initialize() if (!aVDev->GetFontFeatures(rFontFeatures)) return; - vcl::font::FeatureParser aParser(m_sFontName); - std::unordered_map<sal_uInt32, sal_uInt32> aExistingFeatures = aParser.getFeaturesMap(); - std::unordered_set<sal_uInt32> aDoneFeatures; + std::vector<vcl::font::Feature> rFilteredFontFeatures; - sal_Int32 i = 0; for (vcl::font::Feature const& rFontFeature : rFontFeatures) { sal_uInt32 nFontFeatureCode = rFontFeature.m_aID.m_aFeatureCode; - if (aDoneFeatures.find(nFontFeatureCode) != aDoneFeatures.end()) continue; - aDoneFeatures.insert(nFontFeatureCode); + rFilteredFontFeatures.push_back(rFontFeature); + } + + fillGrid(rFilteredFontFeatures); + + updateFontPreview(); +} + +void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures) +{ + vcl::font::FeatureParser aParser(m_sFontName); + std::unordered_map<sal_uInt32, sal_uInt32> aExistingFeatures = aParser.getFeaturesMap(); + + sal_Int32 i = 0; + for (vcl::font::Feature const& rFontFeature : rFontFeatures) + { + sal_uInt32 nFontFeatureCode = rFontFeature.m_aID.m_aFeatureCode; vcl::font::FeatureDefinition aDefinition; if (rFontFeature.m_aDefinition) @@ -138,8 +149,6 @@ void FontFeaturesDialog::initialize() i++; } - - updateFontPreview(); } void FontFeaturesDialog::updateFontPreview() diff --git a/cui/source/inc/FontFeaturesDialog.hxx b/cui/source/inc/FontFeaturesDialog.hxx index 533384d2e972..aa3a4aa22d0f 100644 --- a/cui/source/inc/FontFeaturesDialog.hxx +++ b/cui/source/inc/FontFeaturesDialog.hxx @@ -45,6 +45,8 @@ private: void initialize(); OUString createFontNameWithFeatures(); + void fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures); + DECL_LINK(ComboBoxSelectedHdl, ComboBox&, void); DECL_LINK(CheckBoxToggledHdl, CheckBox&, void); diff --git a/cui/uiconfig/ui/fontfeaturesdialog.ui b/cui/uiconfig/ui/fontfeaturesdialog.ui index f7ae893eb9c0..33964b4538bd 100644 --- a/cui/uiconfig/ui/fontfeaturesdialog.ui +++ b/cui/uiconfig/ui/fontfeaturesdialog.ui @@ -6,7 +6,7 @@ <object class="GtkDialog" id="FontFeaturesDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> - <property name="title" translatable="yes" context="newtabledialog|NewTableDialog">Font Features</property> + <property name="title" translatable="yes" context="fontfeaturesdialog|FontFeaturesDialog">Font Features</property> <property name="modal">True</property> <property name="default_width">1</property> <property name="default_height">1</property> |