vcl/inc/font/OpenTypeFeatureDefinitionList.hxx |    2 -
 vcl/source/font/FeatureCollector.cxx           |   45 ++++++++++++-------------
 2 files changed, 23 insertions(+), 24 deletions(-)

New commits:
commit 8f058de233e5110720daa5b42e0c66e7c3b2c31f
Author:     Khaled Hosny <kha...@aliftype.com>
AuthorDate: Thu Aug 25 23:42:40 2022 +0200
Commit:     خالد حسني <kha...@aliftype.com>
CommitDate: Fri Aug 26 01:00:32 2022 +0200

    FeatureCollector: Drop redundant check
    
    HarfBuzz handles this for us, and it more future-proof this way.
    
    Change-Id: Ia8a65f0363a05c74a718a1a9f7d6df6c84373f46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138853
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@aliftype.com>

diff --git a/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx 
b/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx
index aaa89ebe5d48..52dbcfb5b9f0 100644
--- a/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx
+++ b/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx
@@ -25,12 +25,12 @@ private:
 
     void init();
 
+    static bool isSpecialFeatureCode(sal_uInt32 nFeatureCode);
     static FeatureDefinition handleSpecialFeatureCode(sal_uInt32 nFeatureCode);
 
 public:
     OpenTypeFeatureDefinitionListPrivate();
     FeatureDefinition getDefinition(sal_uInt32 nFeatureCode);
-    static bool isSpecialFeatureCode(sal_uInt32 nFeatureCode);
     bool isRequired(sal_uInt32 nFeatureCode);
 };
 
diff --git a/vcl/source/font/FeatureCollector.cxx 
b/vcl/source/font/FeatureCollector.cxx
index 653712c27e93..4f517bf6784a 100644
--- a/vcl/source/font/FeatureCollector.cxx
+++ b/vcl/source/font/FeatureCollector.cxx
@@ -135,31 +135,30 @@ void FeatureCollector::collectForTable(hb_tag_t aTableTag)
                                                
HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX, aFeatureTag,
                                                &nFeatureIdx))
         {
-            if 
(OpenTypeFeatureDefinitionListPrivate::isSpecialFeatureCode(aFeatureTag))
+            // ssXX and cvXX can have name ID defined for them, check for
+            // them and use as appropriate.
+            hb_ot_name_id_t aLabelID;
+            hb_ot_name_id_t aFirstParameterID;
+            unsigned nNamedParameters;
+            if (hb_ot_layout_feature_get_name_ids(m_pHbFace, aTableTag, 
nFeatureIdx, &aLabelID,
+                                                  nullptr, nullptr, 
&nNamedParameters,
+                                                  &aFirstParameterID))
             {
-                // ssXX and cvXX can have name ID defined for them, check for
-                // them and use as appropriate.
-                hb_ot_name_id_t aLabelID;
-                hb_ot_name_id_t aFirstParameterID;
-                unsigned nNamedParameters;
-                if (hb_ot_layout_feature_get_name_ids(m_pHbFace, aTableTag, 
nFeatureIdx, &aLabelID,
-                                                      nullptr, nullptr, 
&nNamedParameters,
-                                                      &aFirstParameterID))
+                OString sLanguage = m_rLanguageTag.getBcp47().toUtf8();
+                OUString sLabel = getName(m_pHbFace, aLabelID, sLanguage);
+                if (!sLabel.isEmpty())
+                    aDefinition = vcl::font::FeatureDefinition(aFeatureTag, 
sLabel);
+
+                // cvXX features can have parameters name IDs, check for
+                // them and populate feature parameters as appropriate.
+                for (unsigned i = 0; i < nNamedParameters; i++)
                 {
-                    OString sLanguage = m_rLanguageTag.getBcp47().toUtf8();
-                    OUString sLabel = getName(m_pHbFace, aLabelID, sLanguage);
-                    if (!sLabel.isEmpty())
-                        aDefinition = 
vcl::font::FeatureDefinition(aFeatureTag, sLabel);
-
-                    // cvXX features can have parameters name IDs, check for
-                    // them and populate feature parameters as appropriate.
-                    for (unsigned i = 0; i < nNamedParameters; i++)
-                    {
-                        hb_ot_name_id_t aNameID = aFirstParameterID + i;
-                        OUString sName = getName(m_pHbFace, aNameID, 
sLanguage);
-                        if (!sName.isEmpty())
-                            aParameters.emplace_back(uint32_t(i + 1), sName);
-                    }
+                    hb_ot_name_id_t aNameID = aFirstParameterID + i;
+                    OUString sName = getName(m_pHbFace, aNameID, sLanguage);
+                    if (!sName.isEmpty())
+                        aParameters.emplace_back(uint32_t(i + 1), sName);
+                    else
+                        aParameters.emplace_back(uint32_t(i + 1), 
OUString::number(i + 1));
                 }
             }
 

Reply via email to