https://bugs.documentfoundation.org/show_bug.cgi?id=163215

Julien Nabet <serval2...@yahoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |serval2...@yahoo.fr

--- Comment #4 from Julien Nabet <serval2...@yahoo.fr> ---
Khaled: I thought about a first part to create OutputDevice::HasAatFeatures
that would be then called in editeng/source/editeng/impedit3.cxx

Here's the patch:
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 3f534c50b29a..4a76bdaa18bc 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1159,6 +1159,8 @@ public:
     sal_Int32                   HasGlyphs( const vcl::Font& rFont,
std::u16string_view rStr,
                                            sal_Int32 nIndex = 0, sal_Int32
nLen = -1 ) const;

+    bool                        HasAatFeatures() const;
+
     tools::Long                        GetMinKashida() const;

     // i60594
diff --git a/vcl/inc/font/FeatureCollector.hxx
b/vcl/inc/font/FeatureCollector.hxx
index 1b71d021599d..d4c6fe4160cd 100644
--- a/vcl/inc/font/FeatureCollector.hxx
+++ b/vcl/inc/font/FeatureCollector.hxx
@@ -12,6 +12,7 @@

 #include <vcl/font/Feature.hxx>
 #include <hb.h>
+#include <hb-aat.h>
 #include <i18nlangtag/languagetag.hxx>

 #include <font/PhysicalFontFace.hxx>
@@ -42,6 +43,7 @@ private:

 public:
     bool collect();
+    bool hasAatFeatures() { return hb_aat_layout_has_substitution(m_pHbFace);
};
 };

 } // namespace vcl::font
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index a2f32327f72c..75ad8b24f6cf 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -171,6 +171,22 @@ bool
OutputDevice::GetFontFeatures(std::vector<vcl::font::Feature>& rFontFeature
     return true;
 }

+bool OutputDevice::HasAatFeatures() const
+{
+    if (!ImplNewFont())
+        return false;
+
+    LogicalFontInstance* pFontInstance = mpFontInstance.get();
+    if (!pFontInstance)
+        return false;
+
+    const LanguageTag& rOfficeLanguage =
Application::GetSettings().GetUILanguageTag();
+
+    std::vector<vcl::font::Feature> vFontFeatures;
+    vcl::font::FeatureCollector
aFeatureCollector(pFontInstance->GetFontFace(), vFontFeatures,
rOfficeLanguage);
+    return aFeatureCollector.hasAatFeatures();
+}
+
 FontMetric OutputDevice::GetFontMetric() const
 {
     FontMetric aMetric;

Does it seem reasonable or is there a simpler way?

(of course, I may clean the duplicated code in OutputDevice::HasAatFeatures
with a lcl function but it's just for the idea).

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to