vcl/source/fontsubset/sft.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 0d6a103aa5da6fd995acd733699708d0b24ba391
Author:     Khaled Hosny <kha...@aliftype.com>
AuthorDate: Sat Sep 24 15:15:26 2022 +0200
Commit:     خالد حسني <kha...@aliftype.com>
CommitDate: Sat Sep 24 16:18:31 2022 +0200

    vcl: accept bitmap fonts in OpenTTFontFile()
    
    We never subset such fonts after:
    
    commit 77cce80bb56801acf22da2149bd597d0d7793e3b
    Author: Khaled Hosny <kha...@aliftype.com>
    Date:   Thu Sep 22 23:35:12 2022 +0200
    
        vcl: tdf#121327 PDF export for bitmap color fonts
    
    But PrintFontManager::analyzeSfntFile() calls this function for
    non-subsetting uses, it probably shouldn’t since all info it should
    possibly need can come from FontConfig, but re-instate this for now.
    
    This check is very blunt and it would lead to empty fonts in PDF if we
    ever try to subset such a font, but lets clean this up later.
    
    Change-Id: I804d0244ee24a4b4e92b36efd26b376cbe40784d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140542
    Tested-by: Julien Nabet <serval2...@yahoo.fr>
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@aliftype.com>

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index f0141898eaa1..ee346b833836 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1284,7 +1284,7 @@ SFErrCodes AbstractTrueTypeFont::initialize()
 
 sal_uInt32 AbstractTrueTypeFont::glyphOffset(sal_uInt32 glyphID) const
 {
-    if (m_aGlyphOffsets.empty()) // the O_CFF case
+    if (m_aGlyphOffsets.empty()) // the O_CFF and Bitmap cases
         return 0;
     return m_aGlyphOffsets[glyphID];
 }
@@ -1329,7 +1329,11 @@ SFErrCodes AbstractTrueTypeFont::indexGlyphData()
         /* TODO: implement to get subsetting */
     }
     else {
-        return SFErrCodes::TtFormat;
+        // Bitmap font, accept for now.
+        // TODO: We only need this for fonts with CBDT table since they usually
+        // lack glyf or CFF table, the check should be more specific, or better
+        // non-subsetting code should not be calling this.
+        m_aGlyphOffsets.clear();
     }
 
     table = this->table(O_hhea, table_size);

Reply via email to