[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win

Noel Grandin noel.grandin at collabora.co.uk
Wed Feb 8 12:36:48 UTC 2017


 vcl/inc/sft.hxx                             |   23 +-----------
 vcl/quartz/salgdicommon.cxx                 |    2 -
 vcl/source/fontsubset/sft.cxx               |   50 +++-------------------------
 vcl/unx/generic/fontmanager/fontmanager.cxx |    3 -
 vcl/win/gdi/salfont.cxx                     |    2 -
 5 files changed, 13 insertions(+), 67 deletions(-)

New commits:
commit eb1352bb40b3571ee215d6f8bf0c8a0a85297aa4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Feb 8 12:31:17 2017 +0200

    drop unused enum TTCreationFlags
    
    there is only one method using it, and all of the call sites pass 0
    
    Change-Id: I5d71b36cf890fbcf0be9d795756da0cfd61ae309
    Reviewed-on: https://gerrit.libreoffice.org/34024
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 91c13a3..a694391 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -122,22 +122,6 @@ namespace vcl
         OVERLAP_COMPOUND          = 1<<10
     };
 
-/** Flags for TrueType generation */
-    enum TTCreationFlags {
-        TTCF_AutoName = 1,                  /**< Automatically generate a compact 'name' table.
-                                               If this flag is not set, name table is generated
-                                               either from an array of NameRecord structs passed as
-                                               arguments or if the array is NULL, 'name' table
-                                               of the generated TrueType file will be a copy
-                                               of the name table of the original file.
-                                               If this flag is set the array of NameRecord structs
-                                               is ignored and a very compact 'name' table is automatically
-                                               generated. */
-
-        TTCF_IncludeOS2 = 2                 /** If this flag is set OS/2 table from the original font will be
-                                                copied to the subset */
-    };
-
 /** Structure used by GetTTSimpleGlyphMetrics() and GetTTSimpleCharMetrics() functions */
     typedef struct {
         sal_uInt16 adv;                         /**< advance width or height            */
@@ -390,12 +374,11 @@ namespace vcl
  */
     int  CreateTTFromTTGlyphs(TrueTypeFont  *ttf,
                               const char    *fname,
-                              sal_uInt16        *glyphArray,
-                              sal_uInt8          *encoding,
+                              sal_uInt16    *glyphArray,
+                              sal_uInt8     *encoding,
                               int            nGlyphs,
                               int            nNameRecs,
-                              NameRecord    *nr,
-                              sal_uInt32        flags);
+                              NameRecord    *nr);
 
 /**
  * Generates a new PostScript Type42 font and dumps it to <b>outf</b> file.
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 0d213da..db14e36 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -319,7 +319,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
 
     // write subset into destination file
     nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.getStr(), aShortIDs,
-                                  aTempEncs, nGlyphCount, 0, nullptr, 0 );
+                                  aTempEncs, nGlyphCount, 0, nullptr );
     ::CloseTTFont(pSftFont);
     return (nRC == SF_OK);
 }
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index c4c9e69..edc08d2 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1944,8 +1944,7 @@ int  CreateTTFromTTGlyphs(TrueTypeFont  *ttf,
                           sal_uInt8          *encoding,
                           int            nGlyphs,
                           int            nNameRecs,
-                          NameRecord    *nr,
-                          sal_uInt32        flags)
+                          NameRecord    *nr)
 {
     TrueTypeCreator *ttcr;
     TrueTypeTable *head=nullptr, *hhea=nullptr, *maxp=nullptr, *cvt=nullptr, *prep=nullptr, *glyf=nullptr, *fpgm=nullptr, *cmap=nullptr, *name=nullptr, *post = nullptr, *os2 = nullptr;
@@ -1956,42 +1955,13 @@ int  CreateTTFromTTGlyphs(TrueTypeFont  *ttf,
 
     /**                       name                         **/
 
-    if (flags & TTCF_AutoName) {
-        /* not implemented yet
-           NameRecord *names;
-           NameRecord newname;
-           int n = GetTTNameRecords(ttf, &names);
-           int n1 = 0, n2 = 0, n3 = 0, n4 = 0, n5 = 0, n6 = 0;
-           sal_uInt8 *cp1;
-           sal_uInt8 suffix[32];
-           sal_uInt32 c1 = crc32(glyphArray, nGlyphs * 2);
-           sal_uInt32 c2 = crc32(encoding, nGlyphs);
-           int len;
-           snprintf(suffix, 31, "S%08X%08X-%d", c1, c2, nGlyphs);
-
-           name = TrueTypeTableNew_name(0, 0);
-           for (i = 0; i < n; i++) {
-           if (names[i].platformID == 1 && names[i].encodingID == 0 && names[i].languageID == 0 && names[i].nameID == 1) {
-
-           memcpy(newname, names+i, sizeof(NameRecord));
-           newname.slen = name[i].slen + strlen(suffix);
-        */
-        const sal_uInt8 ptr[] = {0,'T',0,'r',0,'u',0,'e',0,'T',0,'y',0,'p',0,'e',0,'S',0,'u',0,'b',0,'s',0,'e',0,'t'};
-        NameRecord n1 = {1, 0, 0, 6, 14, const_cast<sal_uInt8 *>(reinterpret_cast<sal_uInt8 const *>("TrueTypeSubset"))};
-        NameRecord n2 = {3, 1, 1033, 6, 28, nullptr};
-        n2.sptr = const_cast<sal_uInt8 *>(ptr);
-        name = TrueTypeTableNew_name(0, nullptr);
-        nameAdd(name, &n1);
-        nameAdd(name, &n2);
+    if (nNameRecs == 0) {
+        NameRecord *names;
+        int n = GetTTNameRecords(ttf, &names);
+        name = TrueTypeTableNew_name(n, names);
+        DisposeNameRecords(names, n);
     } else {
-        if (nNameRecs == 0) {
-            NameRecord *names;
-            int n = GetTTNameRecords(ttf, &names);
-            name = TrueTypeTableNew_name(n, names);
-            DisposeNameRecords(names, n);
-        } else {
-            name = TrueTypeTableNew_name(nNameRecs, nr);
-        }
+        name = TrueTypeTableNew_name(nNameRecs, nr);
     }
 
     /**                       maxp                         **/
@@ -2059,12 +2029,6 @@ int  CreateTTFromTTGlyphs(TrueTypeFont  *ttf,
         post = TrueTypeTableNew_post(0x00030000, 0, 0, 0, 0);
     }
 
-    if (flags & TTCF_IncludeOS2) {
-        if ((p = getTable(ttf, O_OS2)) != nullptr) {
-            os2 = TrueTypeTableNew(T_OS2, getTableSize(ttf, O_OS2), p);
-        }
-    }
-
     AddTable(ttcr, name); AddTable(ttcr, maxp); AddTable(ttcr, hhea);
     AddTable(ttcr, head); AddTable(ttcr, glyf); AddTable(ttcr, cmap);
     AddTable(ttcr, cvt ); AddTable(ttcr, prep); AddTable(ttcr, fpgm);
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 4bf30b2..f34960f 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -1127,8 +1127,7 @@ bool PrintFontManager::createFontSubset(
                                                      pEnc,
                                                      nGlyphs,
                                                      0,
-                                                     nullptr,
-                                                     0 ) );
+                                                     nullptr ) );
     CloseTTFont( pTTFont );
 
     return bSuccess;
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index ad7cc56..0461f31 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1737,7 +1737,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
 
     // write subset into destination file
     nRC = ::CreateTTFromTTGlyphs( aSftTTF.get(), aToFile.getStr(), aShortIDs,
-            aTempEncs, nGlyphCount, 0, nullptr, 0 );
+            aTempEncs, nGlyphCount, 0, nullptr );
     return (nRC == SF_OK);
 }
 


More information about the Libreoffice-commits mailing list