include/vcl/embeddedfontsmanager.hxx    |    9 -----
 vcl/source/gdi/embeddedfontsmanager.cxx |   57 ++++++++++++++++----------------
 2 files changed, 29 insertions(+), 37 deletions(-)

New commits:
commit dc4a23aab2e3e1f393193665918725cc74e8424b
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Aug 26 17:47:34 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Aug 26 18:53:04 2025 +0200

    This function can be local in the CXX (make class interface smaller)
    
    Change-Id: Ideb81db98abd618b98247d57219ffaf1c8e7a351
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190222
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/include/vcl/embeddedfontsmanager.hxx 
b/include/vcl/embeddedfontsmanager.hxx
index 826fe532ec9e..383bc2facbd4 100644
--- a/include/vcl/embeddedfontsmanager.hxx
+++ b/include/vcl/embeddedfontsmanager.hxx
@@ -75,15 +75,6 @@ public:
                               const 
css::uno::Reference<css::task::XInteractionHandler>& xHandler,
                               bool& activatedRestrictedFonts);
 
-    /**
-      Returns if the restrictions specified in the font (if present) allow 
embedding
-      the font for a particular purpose.
-      @param data font data
-      @param size size of the font data
-      @param rights type of operation to be allowed for the font
-    */
-    static bool sufficientTTFRights( const void* data, tools::Long size, 
FontRights rights );
-
     /**
       Removes all temporary fonts in the path used by 
fileUrlForTemporaryFont().
       @internal
diff --git a/vcl/source/gdi/embeddedfontsmanager.cxx 
b/vcl/source/gdi/embeddedfontsmanager.cxx
index 66b01ba36581..e740afea9c09 100644
--- a/vcl/source/gdi/embeddedfontsmanager.cxx
+++ b/vcl/source/gdi/embeddedfontsmanager.cxx
@@ -214,6 +214,35 @@ OUString getFilenameForExport(std::u16string_view 
familyName, FontFamily family,
                             RTL_TEXTENCODING_UTF8);
 }
 
+// Check if it's (legally) allowed to embed the font file into a document
+// (ttf has a flag allowing this). PhysicalFontFace::IsEmbeddable() appears
+// to have a different meaning (guessing from code, IsSubsettable() might
+// possibly mean it's ttf, while IsEmbeddable() might mean it's type1).
+// So just try to open the data as ttf and see.
+bool sufficientTTFRights(const void* data, tools::Long size,
+                         EmbeddedFontsManager::FontRights rights)
+{
+    TrueTypeFont* font;
+    if (OpenTTFontBuffer(data, size, 0 /*TODO*/, &font) == SFErrCodes::Ok)
+    {
+        TTGlobalFontInfo info;
+        GetTTGlobalFontInfo(font, &info);
+        CloseTTFont(font);
+        // https://www.microsoft.com/typography/otspec/os2.htm#fst
+        int copyright = info.typeFlags;
+        switch (rights)
+        {
+            case EmbeddedFontsManager::FontRights::ViewingAllowed:
+                // Embedding not restricted completely.
+                return (copyright & 0x02) != 0x02;
+            case EmbeddedFontsManager::FontRights::EditingAllowed:
+                // Font is installable or editable.
+                return copyright == 0 || (copyright & 0x08);
+        }
+    }
+    return true; // no known restriction
+}
+
 }
 
 EmbeddedFontsManager::EmbeddedFontsManager(const 
uno::Reference<frame::XModel>& xModel)
@@ -512,34 +541,6 @@ void EmbeddedFontsManager::releaseFonts(const 
std::vector<std::pair<OUString, OU
     OutputDevice::ImplUpdateAllFontData(true);
 }
 
-// Check if it's (legally) allowed to embed the font file into a document
-// (ttf has a flag allowing this). PhysicalFontFace::IsEmbeddable() appears
-// to have a different meaning (guessing from code, IsSubsettable() might
-// possibly mean it's ttf, while IsEmbeddable() might mean it's type1).
-// So just try to open the data as ttf and see.
-bool EmbeddedFontsManager::sufficientTTFRights( const void* data, tools::Long 
size, FontRights rights )
-{
-    TrueTypeFont* font;
-    if( OpenTTFontBuffer( data, size, 0 /*TODO*/, &font ) == SFErrCodes::Ok )
-    {
-        TTGlobalFontInfo info;
-        GetTTGlobalFontInfo( font, &info );
-        CloseTTFont( font );
-        // https://www.microsoft.com/typography/otspec/os2.htm#fst
-        int copyright = info.typeFlags;
-        switch( rights )
-        {
-            case FontRights::ViewingAllowed:
-                // Embedding not restricted completely.
-                return ( copyright & 0x02 ) != 0x02;
-            case FontRights::EditingAllowed:
-                // Font is installable or editable.
-                return copyright == 0 || ( copyright & 0x08 );
-        }
-    }
-    return true; // no known restriction
-}
-
 // static
 bool EmbeddedFontsManager::isEmbeddedAndRestricted(std::u16string_view 
familyName)
 {

Reply via email to