vcl/Executable_sftfuzzer.mk   |   45 ---------------
 vcl/Module_vcl.mk             |    1 
 vcl/inc/fontsubset.hxx        |    1 
 vcl/inc/sft.hxx               |    5 -
 vcl/source/fontsubset/sft.cxx |  126 ------------------------------------------
 vcl/workben/fftester.cxx      |    7 --
 vcl/workben/sftfuzzer.cxx     |   43 --------------
 7 files changed, 228 deletions(-)

New commits:
commit 280ec672983a8314fcb0d2648c2ce1d17aa6db51
Author:     Khaled Hosny <[email protected]>
AuthorDate: Tue Feb 17 21:57:15 2026 +0200
Commit:     Khaled Hosny <[email protected]>
CommitDate: Fri Feb 20 22:29:25 2026 +0100

    Remove TestFontSubset() and sftfuzzer
    
    The code it tests is now unused.
    
    Change-Id: Icc5b8c0f70ef71037dfea160fefde80f7459a342
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199576
    Tested-by: Jenkins
    Reviewed-by: Khaled Hosny <[email protected]>

diff --git a/vcl/Executable_sftfuzzer.mk b/vcl/Executable_sftfuzzer.mk
deleted file mode 100644
index 41781d024e77..000000000000
--- a/vcl/Executable_sftfuzzer.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-include $(SRCDIR)/vcl/commonfuzzer.mk
-
-$(eval $(call gb_Executable_Executable,sftfuzzer))
-
-$(eval $(call gb_Executable_use_api,sftfuzzer,\
-    offapi \
-    udkapi \
-))
-
-$(eval $(call gb_Executable_use_externals,sftfuzzer,\
-       $(fuzzer_externals) \
-))
-
-$(eval $(call gb_Executable_set_include,sftfuzzer,\
-    $$(INCLUDE) \
-    -I$(SRCDIR)/vcl/inc \
-))
-
-$(eval $(call gb_Executable_use_libraries,sftfuzzer,\
-    $(fuzzer_core_libraries) \
-))
-
-$(eval $(call gb_Executable_use_static_libraries,sftfuzzer,\
-    $(fuzzer_statics) \
-))
-
-$(eval $(call gb_Executable_add_exception_objects,sftfuzzer,\
-    vcl/workben/sftfuzzer \
-))
-
-$(eval $(call gb_Executable_add_libs,sftfuzzer,\
-    $(LIB_FUZZING_ENGINE) \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index edbb9ef6e40a..1e0758842276 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -214,7 +214,6 @@ $(eval $(call gb_Module_add_targets,vcl,\
     Executable_mmlfuzzer \
     Executable_mtpfuzzer \
     Executable_htmlfuzzer \
-    Executable_sftfuzzer \
     Executable_eotfuzzer \
     Executable_dbffuzzer \
     Executable_webpfuzzer \
diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx
index efa3f3a452ec..066ace263376 100644
--- a/vcl/inc/fontsubset.hxx
+++ b/vcl/inc/fontsubset.hxx
@@ -87,6 +87,5 @@ private:
     SAL_DLLPRIVATE bool CreateFontSubsetFromCff();
 };
 
-int VCL_DLLPUBLIC TestFontSubset(const void* data, sal_uInt32 size);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 6877307ded3c..322f250f9c88 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1952,35 +1952,5 @@ FontWeight AnalyzeTTFWeight(const TrueTypeFont* ttf)
 
 } // namespace vcl
 
-int TestFontSubset(const void* data, sal_uInt32 size)
-{
-    int nResult = -1;
-    vcl::TrueTypeFont* pTTF = nullptr;
-    if (OpenTTFontBuffer(data, size, 0, &pTTF) == vcl::SFErrCodes::Ok)
-    {
-        vcl::TTGlobalFontInfo aInfo;
-        GetTTGlobalFontInfo(pTTF, &aInfo);
-
-        sal_uInt16 aGlyphIds[ 256 ] = {};
-        sal_uInt8 aEncoding[ 256 ] = {};
-
-        for (sal_uInt16 c = 32; c < 256; ++c)
-        {
-            aEncoding[c] = c;
-            aGlyphIds[c] = c - 31;
-        }
-
-        std::vector<sal_uInt8> aBuffer;
-        CreateTTFromTTGlyphs(pTTF, aBuffer, aGlyphIds, aEncoding, 256);
-
-
-        // cleanup
-        CloseTTFont( pTTF );
-        // success
-        nResult = 0;
-    }
-
-    return nResult;
-}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 08f4605d8023..5fee71a4f664 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -250,13 +250,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
             SvFileStream aFileStream(out, StreamMode::READ);
             ret = static_cast<int>(ImportWebpGraphic(aFileStream, aGraphic));
         }
-        else if (strcmp(argv[2], "sft") == 0)
-        {
-            SvFileStream aFileStream(out, StreamMode::READ);
-            std::vector<sal_uInt8> aData(aFileStream.remainingSize());
-            aFileStream.ReadBytes(aData.data(), aData.size());
-            ret = TestFontSubset(aData.data(), aData.size());
-        }
         else if (strcmp(argv[2], "eot") == 0)
         {
             SvFileStream aFileStream(out, StreamMode::READ);
diff --git a/vcl/workben/sftfuzzer.cxx b/vcl/workben/sftfuzzer.cxx
deleted file mode 100644
index f0a4a9a8cadf..000000000000
--- a/vcl/workben/sftfuzzer.cxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <fontsubset.hxx>
-#include "commonfuzzer.hxx"
-
-#include <config_features.h>
-#include <osl/detail/component-mapping.h>
-
-const lib_to_factory_mapping* lo_get_factory_map(void)
-{
-    static lib_to_factory_mapping map[] = { { 0, 0 } };
-
-    return map;
-}
-
-const lib_to_constructor_mapping* lo_get_constructor_map(void)
-{
-    static lib_to_constructor_mapping map[] = { { 0, 0 } };
-
-    return map;
-}
-
-extern "C" void* lo_get_custom_widget_func(const char*) { return nullptr; }
-
-extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
-{
-    TypicalFuzzerInitialize(argc, argv);
-    return 0;
-}
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
-{
-    return TestFontSubset(data, size);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a16762548438b9e9d2b34fb4ca1df8d9f3c4db0d
Author:     Khaled Hosny <[email protected]>
AuthorDate: Tue Feb 17 21:52:17 2026 +0200
Commit:     Khaled Hosny <[email protected]>
CommitDate: Fri Feb 20 22:29:12 2026 +0100

    Remove now unused CreateTTFfontSubset()/FillFontSubsetInfo()
    
    Change-Id: I7dcb25e1df7e51a5f7e7058a2f8783deba31ae62
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199575
    Tested-by: Jenkins
    Reviewed-by: Khaled Hosny <[email protected]>

diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index a196ff2358f0..3e4a6a695f71 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -576,11 +576,6 @@ class TrueTypeFont;
                               sal_uInt8 const *encoding,
                               int            nGlyphs);
 
-    VCL_DLLPUBLIC bool CreateTTFfontSubset(AbstractTrueTypeFont& aTTF,
-                              std::vector<sal_uInt8>& rOutBuffer,
-                              const sal_GlyphId* pGlyphIds,
-                              const sal_uInt8* pEncoding,
-                              int nGlyphCount, FontSubsetInfo& rInfo);
 
     bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength,
                               std::vector<sal_uInt8>& rOutBuffer,
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index dc03041dafcf..6877307ded3c 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1408,35 +1408,6 @@ SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont  
*ttf,
     return res;
 }
 
-namespace
-{
-void FillFontSubsetInfo(const AbstractTrueTypeFont* ttf, FontSubsetInfo& rInfo)
-{
-    TTGlobalFontInfo aTTInfo;
-    GetTTGlobalFontInfo(ttf, &aTTInfo);
-
-    rInfo.m_aPSName = OUString::fromUtf8(aTTInfo.psname);
-    rInfo.m_nFontType = FontType::SFNT_TTF;
-    rInfo.m_aFontBBox
-        = tools::Rectangle(Point(aTTInfo.xMin, aTTInfo.yMin), 
Point(aTTInfo.xMax, aTTInfo.yMax));
-    rInfo.m_nCapHeight = aTTInfo.yMax; // Well ...
-    rInfo.m_nAscent = aTTInfo.winAscent;
-    rInfo.m_nDescent = aTTInfo.winDescent;
-
-    // mac fonts usually do not have an OS2-table
-    // => get valid ascent/descent values from other tables
-    if (!rInfo.m_nAscent)
-        rInfo.m_nAscent = +aTTInfo.typoAscender;
-    if (!rInfo.m_nAscent)
-        rInfo.m_nAscent = +aTTInfo.ascender;
-    if (!rInfo.m_nDescent)
-        rInfo.m_nDescent = +aTTInfo.typoDescender;
-    if (!rInfo.m_nDescent)
-        rInfo.m_nDescent = -aTTInfo.descender;
-
-    rInfo.m_bFilled = true;
-}
-}
 
 bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength,
                          std::vector<sal_uInt8>& rOutBuffer, const 
sal_GlyphId* pGlyphIds,
@@ -1464,73 +1435,6 @@ bool CreateCFFfontSubset(const unsigned char* 
pFontBytes, int nByteLength,
     return bRet;
 }
 
-bool CreateTTFfontSubset(vcl::AbstractTrueTypeFont& rTTF, 
std::vector<sal_uInt8>& rOutBuffer,
-                         const sal_GlyphId* pGlyphIds, const sal_uInt8* 
pEncoding,
-                         const int nOrigGlyphCount, FontSubsetInfo& rInfo)
-{
-    // Get details about the subset font.
-    FillFontSubsetInfo(&rTTF, rInfo);
-
-    // Shortcut for CFF-subsetting.
-    sal_uInt32 nCFF;
-    const sal_uInt8* pCFF = rTTF.table(O_CFF, nCFF);
-    if (nCFF)
-        return CreateCFFfontSubset(pCFF, nCFF, rOutBuffer, pGlyphIds, 
pEncoding,
-                                   nOrigGlyphCount, rInfo);
-
-    // Multiple questions:
-    // - Why is there a glyph limit?
-    //   MacOS used to handle 257 glyphs...
-    //   Also the much more complex PrintFontManager variant has this limit.
-    //   Also the very first implementation has the limit in
-    //   commit 8789ed701e98031f2a1657ea0dfd6f7a0b050992
-    // - Why doesn't the PrintFontManager care about the fake glyph? It
-    //   is used on all unx platforms to create the subset font.
-    // - Should the SAL_WARN actually be asserts, like on MacOS?
-    if (nOrigGlyphCount > 256)
-    {
-        SAL_WARN("vcl.fonts", "too many glyphs for subsetting");
-        return false;
-    }
-
-    int nGlyphCount = nOrigGlyphCount;
-    sal_uInt16 aShortIDs[256];
-    sal_uInt8 aTempEncs[256];
-
-    // handle the undefined / first font glyph
-    int nNotDef = -1, i;
-    for (i = 0; i < nGlyphCount; ++i)
-    {
-        aTempEncs[i] = pEncoding[i];
-        aShortIDs[i] = static_cast<sal_uInt16>(pGlyphIds[i]);
-        if (!aShortIDs[i])
-            if (nNotDef < 0)
-                nNotDef = i;
-    }
-
-    // nNotDef glyph must be in pos 0 => swap glyphids
-    if (nNotDef != 0)
-    {
-        if (nNotDef < 0)
-        {
-            if (nGlyphCount == 256)
-            {
-                SAL_WARN("vcl.fonts", "too many glyphs for subsetting");
-                return false;
-            }
-            nNotDef = nGlyphCount++;
-        }
-
-        aShortIDs[nNotDef] = aShortIDs[0];
-        aTempEncs[nNotDef] = aTempEncs[0];
-        aShortIDs[0] = 0;
-        aTempEncs[0] = 0;
-    }
-
-    // write subset into destination file
-    return (CreateTTFromTTGlyphs(&rTTF, rOutBuffer, aShortIDs, aTempEncs, 
nGlyphCount)
-            == vcl::SFErrCodes::Ok);
-}
 
 bool GetTTGlobalFontHeadInfo(const AbstractTrueTypeFont *ttf, int& xMin, int& 
yMin, int& xMax, int& yMax, sal_uInt16& macStyle)
 {

Reply via email to