vcl/inc/sft.hxx                      |   73 ++-------------------
 vcl/source/font/PhysicalFontFace.cxx |    7 --
 vcl/source/fontsubset/cff.cxx        |  117 ++++++++++++++++-------------------
 vcl/source/fontsubset/sft.cxx        |   62 +-----------------
 4 files changed, 70 insertions(+), 189 deletions(-)

New commits:
commit 345f5bc1407845712a3e7eaae920a3844a6ca5bc
Author:     Khaled Hosny <[email protected]>
AuthorDate: Wed Feb 18 02:13:05 2026 +0200
Commit:     Khaled Hosny <[email protected]>
CommitDate: Fri Feb 20 22:31:12 2026 +0100

    Rename CreateCFFfontSubset -> ConvertCFFfontToType1
    
    It does not need to do any subsetting now, but to only convert CFF fonts
    to Type1.
    
    Change-Id: Ia3120cbf6e2667f5b62202e80b318e3aa5262369
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199593
    Reviewed-by: Khaled Hosny <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 8e7c355a06d2..6486d6facc0a 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -46,8 +46,6 @@
 #include <vcl/fontcapabilities.hxx>
 #include <i18nlangtag/lang.h>
 
-#include "glyphid.hxx"
-
 #include <array>
 #include <vector>
 #include "fontsubset.hxx"
@@ -437,11 +435,9 @@ class TrueTypeFont;
  */
     void VCL_DLLPUBLIC CloseTTFont(TrueTypeFont *);
 
-    bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength,
+    bool ConvertCFFfontToType1(const unsigned char* pFontBytes, int 
nByteLength,
                               std::vector<sal_uInt8>& rOutBuffer,
-                              const sal_GlyphId* pGlyphIds,
-                              const sal_uInt8* pEncoding,
-                              int nGlyphCount, FontSubsetInfo& rInfo);
+                              FontSubsetInfo& rInfo);
 
 /**
  * Returns global font information about the TrueType font.
diff --git a/vcl/source/font/PhysicalFontFace.cxx 
b/vcl/source/font/PhysicalFontFace.cxx
index 35205a1eab81..3f965ac5852f 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -458,12 +458,7 @@ bool 
PhysicalFontFace::CreateFontSubset(std::vector<sal_uInt8>& rOutBuffer,
         const unsigned char* pCffData
             = reinterpret_cast<const unsigned 
char*>(hb_blob_get_data(pCFFBlob, &nCffLen));
 
-        std::vector<sal_GlyphId> aNewGlyphIds(nGlyphCount);
-        for (int i = 0; i < nGlyphCount; ++i)
-            aNewGlyphIds[i] = i;
-
-        if (!CreateCFFfontSubset(pCffData, nCffLen, rOutBuffer, 
aNewGlyphIds.data(), pEncoding,
-                                 nGlyphCount, rInfo))
+        if (!ConvertCFFfontToType1(pCffData, nCffLen, rOutBuffer, rInfo))
             return false;
     }
     else
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 07abeca6eb7b..c178a003c799 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -716,7 +716,7 @@ struct CharString
 };
 
 
-class CffSubsetterContext
+class CffContext
 :   private CffGlobal
 {
 public:
@@ -724,16 +724,14 @@ public:
     static const int NMAXHINTS = 2*96;  // see CFF.appendixB
     static const int NMAXTRANS = 32;    // see CFF.appendixB
 
-    explicit CffSubsetterContext( const U8* pBasePtr, int nBaseLen);
+    explicit CffContext( const U8* pBasePtr, int nBaseLen);
 
     bool    initialCffRead();
-    void    emitAsType1( class Type1Emitter&,
-                const sal_GlyphId* pGlyphIds, const U8* pEncoding,
-                int nGlyphCount, FontSubsetInfo& );
+    void    emitAsType1(class Type1Emitter&, FontSubsetInfo&);
 
 private:
-    void    convertCharStrings(const sal_GlyphId* pGlyphIds, int nGlyphCount,
-                std::vector<CharString>& rCharStrings);
+    void    convertCharStrings(std::vector<CharString>& rCharStrings,
+                                int nGlyphCount, const sal_GlyphId* pGlyphIds 
= nullptr);
     int     convert2Type1Ops( CffLocal*, const U8* pType2Ops, int nType2Len, 
U8* pType1Ops);
     void    convertOneTypeOp();
     void    convertOneTypeEsc();
@@ -807,7 +805,7 @@ private:
 
 }
 
-CffSubsetterContext::CffSubsetterContext( const U8* pBasePtr, int nBaseLen)
+CffContext::CffContext( const U8* pBasePtr, int nBaseLen)
     : mpBasePtr( pBasePtr)
     , mpBaseEnd( pBasePtr+nBaseLen)
     , mpReadPtr(nullptr)
@@ -830,7 +828,7 @@ CffSubsetterContext::CffSubsetterContext( const U8* 
pBasePtr, int nBaseLen)
     mpCffLocal = &maCffLocal[0];
 }
 
-inline int CffSubsetterContext::popInt()
+inline int CffContext::popInt()
 {
     const ValType aVal = popVal();
     const int nInt = static_cast<int>(aVal);
@@ -838,7 +836,7 @@ inline int CffSubsetterContext::popInt()
     return nInt;
 }
 
-inline void CffSubsetterContext::updateWidth( bool bUseFirstVal)
+inline void CffContext::updateWidth( bool bUseFirstVal)
 {
     // the first value is not a hint but the charwidth
     if( maCharWidth>0 )
@@ -855,7 +853,7 @@ inline void CffSubsetterContext::updateWidth( bool 
bUseFirstVal)
     }
 }
 
-void CffSubsetterContext::addHints( bool bVerticalHints)
+void CffContext::addHints( bool bVerticalHints)
 {
     // the first charstring value may a charwidth instead of a charwidth
     updateWidth( (mnStackIdx & 1) != 0);
@@ -883,7 +881,7 @@ void CffSubsetterContext::addHints( bool bVerticalHints)
     mnStackIdx = 0;
 }
 
-void CffSubsetterContext::readDictOp()
+void CffContext::readDictOp()
 {
     const U8 c = *mpReadPtr;
     if( c <= 21 ) {
@@ -1010,7 +1008,7 @@ void CffSubsetterContext::readDictOp()
     }
 }
 
-void CffSubsetterContext::read2push()
+void CffContext::read2push()
 {
     ValType aVal = 0;
 
@@ -1040,7 +1038,7 @@ void CffSubsetterContext::read2push()
     push( aVal);
 }
 
-void CffSubsetterContext::writeType1Val( ValType aVal)
+void CffContext::writeType1Val( ValType aVal)
 {
     U8* pOut = mpWritePtr;
 
@@ -1095,18 +1093,18 @@ void CffSubsetterContext::writeType1Val( ValType aVal)
     }
 }
 
-inline void CffSubsetterContext::writeTypeOp( int nTypeOp)
+inline void CffContext::writeTypeOp( int nTypeOp)
 {
     *(mpWritePtr++) = static_cast<U8>(nTypeOp);
 }
 
-inline void CffSubsetterContext::writeTypeEsc( int nTypeEsc)
+inline void CffContext::writeTypeEsc( int nTypeEsc)
 {
     *(mpWritePtr++) = TYPE1OP::T1ESC;
     *(mpWritePtr++) = static_cast<U8>(nTypeEsc);
 }
 
-void CffSubsetterContext::pop2MultiWrite( int nArgsPerTypo, int nTypeOp, int 
nTypeXor)
+void CffContext::pop2MultiWrite( int nArgsPerTypo, int nTypeOp, int nTypeXor)
 {
     for( int i = 0; i < mnStackIdx;) {
         for( int j = 0; j < nArgsPerTypo; ++j) {
@@ -1120,7 +1118,7 @@ void CffSubsetterContext::pop2MultiWrite( int 
nArgsPerTypo, int nTypeOp, int nTy
     clear();
 }
 
-void CffSubsetterContext::popAll2Write( int nTypeOp)
+void CffContext::popAll2Write( int nTypeOp)
 {
     // pop in reverse order, then write
     for( int i = 0; i < mnStackIdx; ++i) {
@@ -1131,7 +1129,7 @@ void CffSubsetterContext::popAll2Write( int nTypeOp)
     writeTypeOp( nTypeOp);
 }
 
-void CffSubsetterContext::writeCurveTo( int nStackPos,
+void CffContext::writeCurveTo( int nStackPos,
     int nIX1, int nIY1, int nIX2, int nIY2, int nIX3, int nIY3)
 {
     // get the values from the stack
@@ -1154,7 +1152,7 @@ void CffSubsetterContext::writeCurveTo( int nStackPos,
     writeTypeOp( TYPE1OP::RCURVETO );
 }
 
-void CffSubsetterContext::convertOneTypeOp()
+void CffContext::convertOneTypeOp()
 {
     const int nType2Op = *(mpReadPtr++);
 
@@ -1390,7 +1388,7 @@ void CffSubsetterContext::convertOneTypeOp()
     }
 }
 
-void CffSubsetterContext::convertOneTypeEsc()
+void CffContext::convertOneTypeEsc()
 {
     const int nType2Esc = *(mpReadPtr++);
     ValType* pTop = &mnValStack[ mnStackIdx-1];
@@ -1569,7 +1567,7 @@ void CffSubsetterContext::convertOneTypeEsc()
     }
 }
 
-void CffSubsetterContext::callType2Subr( bool bGlobal, int nSubrNumber)
+void CffContext::callType2Subr( bool bGlobal, int nSubrNumber)
 {
     const U8* const pOldReadPtr = mpReadPtr;
     const U8* const pOldReadEnd = mpReadEnd;
@@ -1589,7 +1587,7 @@ void CffSubsetterContext::callType2Subr( bool bGlobal, 
int nSubrNumber)
     mpReadEnd = pOldReadEnd;
 }
 
-int CffSubsetterContext::convert2Type1Ops( CffLocal* pCffLocal, const U8* 
const pT2Ops, int nT2Len, U8* const pT1Ops)
+int CffContext::convert2Type1Ops( CffLocal* pCffLocal, const U8* const pT2Ops, 
int nT2Len, U8* const pT1Ops)
 {
     mpCffLocal = pCffLocal;
 
@@ -1611,7 +1609,7 @@ int CffSubsetterContext::convert2Type1Ops( CffLocal* 
pCffLocal, const U8* const
     mpReadEnd = pT2Ops + nT2Len;
     // prepend "hsbw" or "sbw"
     // TODO: only emit hsbw when charwidth is known
-    writeType1Val(0); // TODO: aSubsetterContext.getLeftSideBearing();
+    writeType1Val(0); // TODO: aContext.getLeftSideBearing();
     U8* pCharWidthPtr=mpWritePtr; // need to overwrite that later
     // pad out 5 bytes for the char width with default val 1000 (to be
     // filled with the actual value below)
@@ -1652,7 +1650,7 @@ int CffSubsetterContext::convert2Type1Ops( CffLocal* 
pCffLocal, const U8* const
     return nType1Len;
 }
 
-RealType CffSubsetterContext::readRealVal()
+RealType CffContext::readRealVal()
 {
     // TODO: more thorough number validity test
     bool bComma = false;
@@ -1723,7 +1721,7 @@ RealType CffSubsetterContext::readRealVal()
 }
 
 // prepare to access an element inside a CFF/CID index table
-int CffSubsetterContext::seekIndexData( int nIndexBase, int nDataIndex)
+int CffContext::seekIndexData( int nIndexBase, int nDataIndex)
 {
     assert( (nIndexBase > 0) && (mpBasePtr + nIndexBase + 3 <= mpBaseEnd));
     if( nDataIndex < 0)
@@ -1762,7 +1760,7 @@ int CffSubsetterContext::seekIndexData( int nIndexBase, 
int nDataIndex)
 }
 
 // skip over a CFF/CID index table
-void CffSubsetterContext::seekIndexEnd( int nIndexBase)
+void CffContext::seekIndexEnd( int nIndexBase)
 {
     assert( (nIndexBase > 0) && (mpBasePtr + nIndexBase + 3 <= mpBaseEnd));
     mpReadPtr = mpBasePtr + nIndexBase;
@@ -1821,7 +1819,7 @@ CffGlobal::CffGlobal()
 {
 }
 
-bool CffSubsetterContext::initialCffRead()
+bool CffContext::initialCffRead()
 {
     // get the CFFHeader
     mpReadPtr = mpBasePtr;
@@ -1879,7 +1877,7 @@ bool CffSubsetterContext::initialCffRead()
         mnFDAryCount = (mpReadPtr[0]<<8) + mpReadPtr[1];
         if (o3tl::make_unsigned(mnFDAryCount) >= SAL_N_ELEMENTS(maCffLocal))
         {
-            SAL_INFO("vcl.fonts", "CffSubsetterContext: too many CFF in font");
+            SAL_INFO("vcl.fonts", "CffContext: too many CFF in font");
             return false;
         }
 
@@ -1926,7 +1924,7 @@ bool CffSubsetterContext::initialCffRead()
 }
 
 // get a cstring from a StringID
-OString CffSubsetterContext::getString( int nStringID)
+OString CffContext::getString( int nStringID)
 {
     // get a standard string if possible
     const static int nStdStrings = SAL_N_ELEMENTS(pStringIds);
@@ -1951,7 +1949,7 @@ OString CffSubsetterContext::getString( int nStringID)
 }
 
 // access a CID's FDSelect table
-int CffSubsetterContext::getFDSelect( int nGlyphIndex) const
+int CffContext::getFDSelect( int nGlyphIndex) const
 {
     assert( nGlyphIndex >= 0);
     assert( nGlyphIndex < mnCharStrCount);
@@ -1994,7 +1992,7 @@ int CffSubsetterContext::getFDSelect( int nGlyphIndex) 
const
     return -1;
 }
 
-int CffSubsetterContext::getGlyphSID( int nGlyphIndex) const
+int CffContext::getGlyphSID( int nGlyphIndex) const
 {
     if( nGlyphIndex == 0)
         return 0;       // ".notdef"
@@ -2042,7 +2040,7 @@ int CffSubsetterContext::getGlyphSID( int nGlyphIndex) 
const
 }
 
 // NOTE: the result becomes invalid with the next call to this method
-OString CffSubsetterContext::getGlyphName( int nGlyphIndex)
+OString CffContext::getGlyphName( int nGlyphIndex)
 {
     // the first glyph is always the .notdef glyph
     if( nGlyphIndex == 0)
@@ -2076,7 +2074,7 @@ OString CffSubsetterContext::getGlyphName( int 
nGlyphIndex)
     }
 }
 
-bool CffSubsetterContext::getBaseAccent(ValType aBase, ValType aAccent, int* 
nBase, int* nAccent)
+bool CffContext::getBaseAccent(ValType aBase, ValType aAccent, int* nBase, 
int* nAccent)
 {
     bool bBase = false, bAccent = false;
     for (int i = 0; i < mnCharStrCount; i++)
@@ -2207,8 +2205,8 @@ void Type1Emitter::emitValVector( const char* pLineHead, 
const char* pLineTail,
     maBuffer.append( pLineTail);
 }
 
-void CffSubsetterContext::convertCharStrings(const sal_GlyphId* pGlyphIds, int 
nGlyphCount,
-                                             std::vector<CharString>& 
rCharStrings)
+void CffContext::convertCharStrings(std::vector<CharString>& rCharStrings,
+     int nGlyphCount, const sal_GlyphId* pGlyphIds)
 {
     // If we are doing extra glyphs used for seac operator, check for already
     // converted glyphs.
@@ -2216,7 +2214,7 @@ void CffSubsetterContext::convertCharStrings(const 
sal_GlyphId* pGlyphIds, int n
     rCharStrings.reserve(rCharStrings.size() + nGlyphCount);
     for (int i = 0; i < nGlyphCount; ++i)
     {
-        const int nCffGlyphId = pGlyphIds[i];
+        const int nCffGlyphId = pGlyphIds ? pGlyphIds[i] : i;
         assert((nCffGlyphId >= 0) && (nCffGlyphId < mnCharStrCount));
 
         if (!bCheckDuplicates)
@@ -2247,13 +2245,11 @@ void CffSubsetterContext::convertCharStrings(const 
sal_GlyphId* pGlyphIds, int n
     }
 }
 
-void CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
-    const sal_GlyphId* pReqGlyphIds, const U8* pReqEncoding,
-    int nGlyphCount, FontSubsetInfo& rFSInfo)
+void CffContext::emitAsType1(Type1Emitter& rEmitter, FontSubsetInfo& rFSInfo)
 {
-    OString aSubsetName = rFSInfo.m_aPSName.toUtf8();
-    if (aSubsetName.getLength() > 255)
-        aSubsetName = aSubsetName.copy(0, 255);
+    OString aFontName = rFSInfo.m_aPSName.toUtf8();
+    if (aFontName.getLength() > 255)
+        aFontName = aFontName.copy(0, 255);
 
     // prepare some fontdirectory details
     static const int nUniqueIdBase = 4100000; // using private-interchange 
UniqueIds
@@ -2265,13 +2261,13 @@ void CffSubsetterContext::emitAsType1( Type1Emitter& 
rEmitter,
     rEmitter.emitRawData( aPfbHeader, sizeof(aPfbHeader)-1);
 
     rEmitter.maBuffer.append(
-        "%!FontType1-1.0: " + OString::Concat(aSubsetName) + " 001.003
");
+        "%!FontType1-1.0: " + OString::Concat(aFontName) + " 001.003
");
     // emit TOPDICT
     rEmitter.maBuffer.append(
         "11 dict begin
"   // TODO: dynamic entry count for TOPDICT
         "/FontType 1 def
"
         "/PaintType 0 def
");
-    rEmitter.maBuffer.append( "/FontName /" + OString::Concat(aSubsetName) + " 
def
");
+    rEmitter.maBuffer.append( "/FontName /" + OString::Concat(aFontName) + " 
def
");
     rEmitter.maBuffer.append( "/UniqueID " + OString::number(nUniqueId) + " def
");
     // emit FontMatrix
     if( maFontMatrix.size() == 6)
@@ -2296,17 +2292,17 @@ void CffSubsetterContext::emitAsType1( Type1Emitter& 
rEmitter,
     // emit FONTINFO into TOPDICT
     rEmitter.maBuffer.append(
         "/FontInfo 2 dict dup begin
"  // TODO: check fontinfo entry count
-        " /FullName (" + OString::Concat(aSubsetName) + ") readonly def
"
-        " /FamilyName (" + aSubsetName + ") readonly def
"
+        " /FullName (" + OString::Concat(aFontName) + ") readonly def
"
+        " /FamilyName (" + aFontName + ") readonly def
"
         "end readonly def
");
 
     rEmitter.maBuffer.append(
         "/Encoding 256 array
"
         "0 1 255 {1 index exch /.notdef put} for
");
-    for( int i = 1; (i < nGlyphCount) && (i < 256); ++i) {
-        OString pGlyphName = getGlyphName( pReqGlyphIds[i]);
+    for( int i = 1; (i < mnCharStrCount) && (i < 256); ++i) {
+        OString pGlyphName = getGlyphName(i);
         rEmitter.maBuffer.append(
-            "dup " + OString::number(pReqEncoding[i]) + " /" + pGlyphName + " 
put
");
+            "dup " + OString::number(i) + " /" + pGlyphName + " put
");
     }
     rEmitter.maBuffer.append( "readonly def
");
     rEmitter.maBuffer.append(
@@ -2441,14 +2437,14 @@ void CffSubsetterContext::emitAsType1( Type1Emitter& 
rEmitter,
     // emit the CharStrings for the requested glyphs
     std::vector<CharString> aCharStrings;
     mbDoSeac = true;
-    convertCharStrings(pReqGlyphIds, nGlyphCount, aCharStrings);
+    convertCharStrings(aCharStrings, mnCharStrCount);
 
     // The previous convertCharStrings might collect extra glyphs used in seac
     // operator, convert them as well
     if (!maExtraGlyphIds.empty())
     {
         mbDoSeac = false;
-        convertCharStrings(maExtraGlyphIds.data(), maExtraGlyphIds.size(), 
aCharStrings);
+        convertCharStrings(aCharStrings, maExtraGlyphIds.size(), 
maExtraGlyphIds.data());
     }
     rEmitter.maBuffer.append(
         "2 index /CharStrings " + OString::number(aCharStrings.size()) + " 
dict dup begin
");
@@ -2489,30 +2485,25 @@ void CffSubsetterContext::emitAsType1( Type1Emitter& 
rEmitter,
         "\x80\x03";
     rEmitter.emitRawData( aPfxFooter, sizeof(aPfxFooter)-1);
 
-    // provide details to the subset requesters, TODO: move into own method?
-    // note: Top and Bottom are flipped between Type1 and VCL
-    // note: the rest of VCL expects the details below to be scaled like for 
an emUnits==1000 font
-
     rFSInfo.m_nFontType = FontType::TYPE1_PFB;
 }
 
 namespace vcl
 {
-bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength,
-                         std::vector<sal_uInt8>& rOutBuffer, const 
sal_GlyphId* pGlyphIds,
-                         const sal_uInt8* pEncoding, int nGlyphCount, 
FontSubsetInfo& rInfo)
+bool ConvertCFFfontToType1(const unsigned char* pFontBytes, int nByteLength,
+                         std::vector<sal_uInt8>& rOutBuffer,
+                         FontSubsetInfo& rInfo)
 {
-    CffSubsetterContext aCff(pFontBytes, nByteLength);
+    CffContext aCff(pFontBytes, nByteLength);
     bool bRC = aCff.initialCffRead();
     if (!bRC)
         return bRC;
 
     SvMemoryStream aStream;
 
-    // emit Type1 subset from the CFF input
-    // TODO: also support CFF->CFF subsetting (when PDF-export and PS-printing 
need it)
+    // emit Type1 font from the CFF input
     Type1Emitter aType1Emitter(aStream);
-    aCff.emitAsType1(aType1Emitter, pGlyphIds, pEncoding, nGlyphCount, rInfo);
+    aCff.emitAsType1(aType1Emitter, rInfo);
 
     rOutBuffer.assign(static_cast<const sal_uInt8*>(aStream.GetData()),
                       static_cast<const sal_uInt8*>(aStream.GetData()) + 
aStream.Tell());
commit 598ad0bea7f393506d4d297d3563ec1131d6b548
Author:     Khaled Hosny <[email protected]>
AuthorDate: Wed Feb 18 01:33:07 2026 +0200
Commit:     Khaled Hosny <[email protected]>
CommitDate: Fri Feb 20 22:31:01 2026 +0100

    Remove some unused code from sft.cxx
    
    Change-Id: I299539533d520983c2240036d51b1701c20f212b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199592
    Tested-by: Jenkins
    Reviewed-by: Khaled Hosny <[email protected]>

diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 537e3a9a0ce5..8e7c355a06d2 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -141,23 +141,8 @@ namespace vcl
         int   width = 0;              /**< value of WidthClass or 0 if can't 
be determined         */
         int   pitch = 0;              /**< 0: proportional font, otherwise: 
monospaced             */
         int   italicAngle = 0;        /**< in counter-clockwise degrees * 
65536                    */
-        int   xMin = 0;               /**< global bounding box: xMin           
                    */
-        int   yMin = 0;               /**< global bounding box: yMin           
                    */
-        int   xMax = 0;               /**< global bounding box: xMax           
                    */
-        int   yMax = 0;               /**< global bounding box: yMax           
                    */
-        int   ascender = 0;           /**< typographic ascent.                 
                    */
-        int   descender = 0;          /**< typographic descent.                
                    */
-        int   linegap = 0;            /**< typographic line gap.\ Negative 
values are treated as
-                                     zero in Win 3.1, System 6 and System 7.   
              */
-        int   typoAscender = 0;       /**< OS/2 portable typographic ascender  
                    */
-        int   typoDescender = 0;      /**< OS/2 portable typographic descender 
                    */
-        int   typoLineGap = 0;        /**< OS/2 portable typographic line gap  
                     */
-        int   winAscent = 0;          /**< ascender metric for Windows         
                    */
-        int   winDescent = 0;         /**< descender metric for Windows        
                    */
         bool  microsoftSymbolEncoded = false;  /**< true: MS symbol encoded */
-        sal_uInt8  panose[10] = {};   /**< PANOSE classification number        
                    */
         sal_uInt32 typeFlags = 0;     /**< type flags (copyright bits)         
                    */
-        sal_uInt16 fsSelection = 0;   /**< OS/2 fsSelection */
     } TTGlobalFontInfo;
 
 
@@ -234,24 +219,16 @@ namespace vcl
 
 */
 constexpr int OS2_Legacy_length = 68;
-constexpr int OS2_V0_length = 78;
 constexpr int OS2_V1_length = 86;
 
 constexpr int OS2_usWeightClass_offset = 4;
 constexpr int OS2_usWidthClass_offset = 6;
 constexpr int OS2_fsType_offset = 8;
-constexpr int OS2_panose_offset = 32;
-constexpr int OS2_panoseNbBytes_offset = 10;
 constexpr int OS2_ulUnicodeRange1_offset = 42;
 constexpr int OS2_ulUnicodeRange2_offset = 46;
 constexpr int OS2_ulUnicodeRange3_offset = 50;
 constexpr int OS2_ulUnicodeRange4_offset = 54;
 constexpr int OS2_fsSelection_offset = 62;
-constexpr int OS2_typoAscender_offset = 68;
-constexpr int OS2_typoDescender_offset = 70;
-constexpr int OS2_typoLineGap_offset = 72;
-constexpr int OS2_winAscent_offset = 74;
-constexpr int OS2_winDescent_offset = 76;
 constexpr int OS2_ulCodePageRange1_offset = 78;
 constexpr int OS2_ulCodePageRange2_offset = 82;
 
@@ -477,22 +454,6 @@ class TrueTypeFont;
  */
 void GetTTGlobalFontInfo(const AbstractTrueTypeFont *ttf, TTGlobalFontInfo 
*info);
 
-/**
- * Returns part of the head table info, normally collected by 
GetTTGlobalFontInfo.
- *
- * Just implemented separate, because this info not available via Qt API.
- *
- * @param ttf         pointer to a AbstractTrueTypeFont structure
- * @param xMin        global glyph bounding box min X
- * @param yMin        global glyph bounding box min Y
- * @param xMax        global glyph bounding box max X
- * @param yMax        global glyph bounding box max Y
- * @param macStyle    encoded Mac style flags of the font
- * @return            true, if table data could be decoded
- * @ingroup sft
- */
-bool GetTTGlobalFontHeadInfo(const AbstractTrueTypeFont *ttf, int& xMin, int& 
yMin, int& xMax, int& yMax, sal_uInt16& macStyle);
-
 OUString analyzeSfntName(const TrueTypeFont* pTTFont, sal_uInt16 nameId, const 
LanguageTag& rPrefLang);
 
 FontWeight AnalyzeTTFWeight(const TrueTypeFont* pTTFont);
@@ -505,26 +466,19 @@ constexpr int O_glyf = 1;    /* 'glyf' */
 constexpr int O_head = 2;    /* 'head' */
 constexpr int O_loca = 3;    /* 'loca' */
 constexpr int O_name = 4;    /* 'name' */
-constexpr int O_hhea = 5;    /* 'hhea' */
-constexpr int O_hmtx = 6;    /* 'hmtx' */
-constexpr int O_cmap = 7;    /* 'cmap' */
-constexpr int O_vhea = 8;    /* 'vhea' */
-constexpr int O_vmtx = 9;    /* 'vmtx' */
-constexpr int O_OS2  = 10;   /* 'OS/2' */
-constexpr int O_post = 11;   /* 'post' */
-constexpr int O_cvt  = 12;   /* 'cvt_' - only used in TT->TT generation */
-constexpr int O_prep = 13;   /* 'prep' - only used in TT->TT generation */
-constexpr int O_fpgm = 14;   /* 'fpgm' - only used in TT->TT generation */
-constexpr int O_CFF = 15;   /* 'CFF' */
-constexpr int NUM_TAGS = 16;
+constexpr int O_cmap = 5;    /* 'cmap' */
+constexpr int O_OS2  = 6;   /* 'OS/2' */
+constexpr int O_post = 7;   /* 'post' */
+constexpr int O_cvt  = 8;   /* 'cvt_' - only used in TT->TT generation */
+constexpr int O_prep = 9;   /* 'prep' - only used in TT->TT generation */
+constexpr int O_fpgm = 10;   /* 'fpgm' - only used in TT->TT generation */
+constexpr int O_CFF = 11;   /* 'CFF' */
+constexpr int NUM_TAGS = 12;
 
 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) AbstractTrueTypeFont
 {
     std::string m_sFileName;
     sal_uInt32 m_nGlyphs;
-    sal_uInt32 m_nHorzMetrics;
-    sal_uInt32 m_nVertMetrics; /* if not 0 => font has vertical metrics 
information */
-    sal_uInt32 m_nUnitsPerEm;
     std::vector<sal_uInt32> m_aGlyphOffsets;
     bool m_bMicrosoftSymbolEncoded;
 
@@ -540,9 +494,6 @@ public:
     std::string const & fileName() const { return m_sFileName; }
     sal_uInt32 glyphCount() const { return m_nGlyphs; }
     sal_uInt32 glyphOffset(sal_uInt32 glyphID) const;
-    sal_uInt32 horzMetricCount() const { return m_nHorzMetrics; }
-    sal_uInt32 vertMetricCount() const { return m_nVertMetrics; }
-    sal_uInt32 unitsPerEm() const { return m_nUnitsPerEm; }
     bool IsMicrosoftSymbolEncoded() const { return m_bMicrosoftSymbolEncoded; }
 
     virtual bool hasTable(sal_uInt32 ord) const = 0;
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index af5b4772b3bd..d4b2e74b7cfa 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -448,9 +448,6 @@ bool withinBounds(sal_uInt32 tdoffset, sal_uInt32 
moreoffset, sal_uInt32 len, sa
 
 AbstractTrueTypeFont::AbstractTrueTypeFont(const char* pFileName)
     : m_nGlyphs(0xFFFFFFFF)
-    , m_nHorzMetrics(0)
-    , m_nVertMetrics(0)
-    , m_nUnitsPerEm(0)
     , m_bMicrosoftSymbolEncoded(false)
 {
     if (pFileName)
@@ -511,10 +508,10 @@ SFErrCodes AbstractTrueTypeFont::indexGlyphData()
     if (table_size < HEAD_Length)
         return SFErrCodes::TtFormat;
 
-    m_nUnitsPerEm = GetUInt16(table, HEAD_unitsPerEm_offset);
+    sal_uInt32 unitsPerEm = GetUInt16(table, HEAD_unitsPerEm_offset);
     int indexfmt = GetInt16(table, HEAD_indexToLocFormat_offset);
 
-    if (((indexfmt != 0) && (indexfmt != 1)) || (m_nUnitsPerEm <= 0))
+    if (((indexfmt != 0) && (indexfmt != 1)) || (unitsPerEm <= 0))
         return SFErrCodes::TtFormat;
 
     if (hasTable(O_glyf) && (table = this->table(O_loca, table_size))) /* TTF 
or TTF-OpenType */
@@ -545,12 +542,6 @@ SFErrCodes AbstractTrueTypeFont::indexGlyphData()
         m_aGlyphOffsets.clear();
     }
 
-    table = this->table(O_hhea, table_size);
-    m_nHorzMetrics = (table && table_size >= 36) ? GetUInt16(table, 34) : 0;
-
-    table = this->table(O_vhea, table_size);
-    m_nVertMetrics = (table && table_size >= 36) ? GetUInt16(table, 34) : 0;
-
     table = this->table(O_cmap, table_size);
     m_bMicrosoftSymbolEncoded = HasMicrosoftSymbolCmap(table, table_size);
 
@@ -608,11 +599,7 @@ SFErrCodes TrueTypeFont::open(sal_uInt32 facenum)
             case T_head: nIndex = O_head; break;
             case T_loca: nIndex = O_loca; break;
             case T_name: nIndex = O_name; break;
-            case T_hhea: nIndex = O_hhea; break;
-            case T_hmtx: nIndex = O_hmtx; break;
             case T_cmap: nIndex = O_cmap; break;
-            case T_vhea: nIndex = O_vhea; break;
-            case T_vmtx: nIndex = O_vmtx; break;
             case T_OS2 : nIndex = O_OS2;  break;
             case T_post: nIndex = O_post; break;
             case T_cvt : nIndex = O_cvt;  break;
@@ -697,28 +684,8 @@ SFErrCodes TrueTypeFont::open(sal_uInt32 facenum)
     return AbstractTrueTypeFont::initialize();
 }
 
-bool GetTTGlobalFontHeadInfo(const AbstractTrueTypeFont *ttf, int& xMin, int& 
yMin, int& xMax, int& yMax, sal_uInt16& macStyle)
-{
-    sal_uInt32 table_size;
-    const sal_uInt8* table = ttf->table(O_head, table_size);
-    if (table_size < 46)
-        return false;
-
-    const int UPEm = ttf->unitsPerEm();
-    if (UPEm == 0)
-        return false;
-    xMin = XUnits(UPEm, GetInt16(table, HEAD_xMin_offset));
-    yMin = XUnits(UPEm, GetInt16(table, HEAD_yMin_offset));
-    xMax = XUnits(UPEm, GetInt16(table, HEAD_xMax_offset));
-    yMax = XUnits(UPEm, GetInt16(table, HEAD_yMax_offset));
-    macStyle = GetUInt16(table, HEAD_macStyle_offset);
-    return true;
-}
-
 void GetTTGlobalFontInfo(const AbstractTrueTypeFont *ttf, TTGlobalFontInfo 
*info)
 {
-    int UPEm = ttf->unitsPerEm();
-
     info->family = ttf->family;
     info->ufamily = ttf->ufamily;
     info->subfamily = ttf->subfamily;
@@ -732,19 +699,6 @@ void GetTTGlobalFontInfo(const AbstractTrueTypeFont *ttf, 
TTGlobalFontInfo *info
     {
         info->weight = GetUInt16(table, OS2_usWeightClass_offset);
         info->width  = GetUInt16(table, OS2_usWidthClass_offset);
-
-        if (table_size >= OS2_V0_length && UPEm != 0) {
-            info->typoAscender = XUnits(UPEm,GetInt16(table, 
OS2_typoAscender_offset));
-            info->typoDescender = XUnits(UPEm, GetInt16(table, 
OS2_typoDescender_offset));
-            info->typoLineGap = XUnits(UPEm, GetInt16(table, 
OS2_typoLineGap_offset));
-            info->winAscent = XUnits(UPEm, GetUInt16(table, 
OS2_winAscent_offset));
-            info->winDescent = XUnits(UPEm, GetUInt16(table, 
OS2_winDescent_offset));
-            /* sanity check; some fonts treat winDescent as signed
-           * violating the standard */
-            if( info->winDescent > 5*UPEm )
-                info->winDescent = XUnits(UPEm, GetInt16(table, 
OS2_winDescent_offset));
-        }
-        memcpy(info->panose, table + OS2_panose_offset, 
OS2_panoseNbBytes_offset);
         info->typeFlags = GetUInt16( table, OS2_fsType_offset );
     }
 
@@ -755,15 +709,9 @@ void GetTTGlobalFontInfo(const AbstractTrueTypeFont *ttf, 
TTGlobalFontInfo *info
         info->italicAngle = GetInt32(table, POST_italicAngle_offset);
     }
 
-    GetTTGlobalFontHeadInfo(ttf, info->xMin, info->yMin, info->xMax, 
info->yMax, info->macStyle);
-
-    table  = ttf->table(O_hhea, table_size);
-    if (table_size >= 10 && UPEm != 0)
-    {
-        info->ascender  = XUnits(UPEm, GetInt16(table, HHEA_ascender_offset));
-        info->descender = XUnits(UPEm, GetInt16(table, HHEA_descender_offset));
-        info->linegap   = XUnits(UPEm, GetInt16(table, HHEA_lineGap_offset));
-    }
+    table = ttf->table(O_head, table_size);
+    if (table_size >= 46)
+        info->macStyle = GetUInt16(table, HEAD_macStyle_offset);
 }
 
 

Reply via email to