[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/inc vcl/source
Khaled Hosny
khaledhosny at eglug.org
Fri Feb 9 00:02:56 UTC 2018
vcl/inc/sft.hxx | 16 --------
vcl/source/fontsubset/sft.cxx | 79 ------------------------------------------
2 files changed, 95 deletions(-)
New commits:
commit cf3c1bd0b91fe68682a7a3c3cb34066e1fb8d17c
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Thu Feb 8 14:31:34 2018 +0200
Removed unused code for reading kern table
Change-Id: I66b17dbee0a04e61b99e23933a7fed4be30f3a93
Reviewed-on: https://gerrit.libreoffice.org/49426
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
(cherry picked from commit e3caecb5a33288dd46a80b2ffcc47a2288305052)
Reviewed-on: https://gerrit.libreoffice.org/49451
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 3dc6cb77b21f..2577166cc3f1 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -102,13 +102,6 @@ namespace vcl
FWIDTH_ULTRA_EXPANDED = 9 /**< 200% of normal */
};
-/** Type of the 'kern' table, stored in TrueTypeFont::kerntype */
- enum KernType {
- KT_NONE = 0, /**< no kern table */
- KT_APPLE_NEW = 1, /**< new Apple kern table */
- KT_MICROSOFT = 2 /**< Microsoft table */
- };
-
/** Composite glyph flags definition */
enum CompositeFlags {
ARG_1_AND_2_ARE_WORDS = 1,
@@ -190,12 +183,6 @@ namespace vcl
#define TYPEFLAG_COPYRIGHT_MASK 0x000000E
#define TYPEFLAG_PS_OPENTYPE 0x0010000
-/** Structure used by KernGlyphs() */
- typedef struct {
- int x; /**< positive: right, negative: left */
- int y; /**< positive: up, negative: down */
- } KernData;
-
/** ControlPoint structure used by GetTTGlyphPoints() */
typedef struct {
sal_uInt32 flags; /**< 00000000 00000000 e0000000 bbbbbbbb */
@@ -486,8 +473,6 @@ namespace vcl
sal_uInt32 (*mapper)(const sal_uInt8 *, sal_uInt32, sal_uInt32); /* character to glyphID translation function */
const sal_uInt8 **tables; /* array of pointers to raw subtables in SFNT file */
sal_uInt32 *tlens; /* array of table lengths */
- sal_uInt32 nkern; /* number of kern subtables */
- const sal_uInt8** kerntables; /* array of pointers to kern subtables */
};
/* indexes into TrueTypeFont::tables[] and TrueTypeFont::tlens[] */
@@ -503,7 +488,6 @@ namespace vcl
#define O_vmtx 9 /* 'vmtx' */
#define O_OS2 10 /* 'OS/2' */
#define O_post 11 /* 'post' */
-#define O_kern 12 /* 'kern' */
#define O_cvt 13 /* 'cvt_' - only used in TT->TT generation */
#define O_prep 14 /* 'prep' - only used in TT->TT generation */
#define O_fpgm 15 /* 'fpgm' - only used in TT->TT generation */
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 7c35d3207e0d..1bf9b9003de5 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -119,7 +119,6 @@ static const sal_uInt32 T_otto = 0x4f54544f; /* 'OTTO' */
#define T_vmtx 0x766D7478
#define T_OS2 0x4F532F32
#define T_post 0x706F7374
-#define T_kern 0x6B65726E
#define T_cvt 0x63767420
#define T_prep 0x70726570
#define T_fpgm 0x6670676D
@@ -1339,81 +1338,6 @@ static void FindCmap(TrueTypeFont *ttf)
}
}
-static void GetKern(TrueTypeFont *ttf)
-{
- const sal_uInt8* table = getTable(ttf, O_kern);
- int nTableSize = getTableSize(ttf, O_kern);
- const sal_uInt8 *ptr;
-
- if( !table )
- goto badtable;
-
- if (nTableSize >= 4 && GetUInt16(table, 0) == 0) { /* Traditional Microsoft style table with sal_uInt16 version and nTables fields */
- ttf->nkern = GetUInt16(table, 2);
- ptr = table + 4;
-
- const sal_uInt32 remaining_table_size = nTableSize-4;
- const sal_uInt32 nMinRecordSize = 2;
- const sal_uInt32 nMaxRecords = remaining_table_size / nMinRecordSize;
- if (ttf->nkern > nMaxRecords)
- {
- SAL_WARN("vcl.fonts", "Parsing error in " << OUString::createFromAscii(ttf->fname) <<
- ": " << nMaxRecords << " max possible entries, but " <<
- ttf->nkern << " claimed, truncating");
- ttf->nkern = nMaxRecords;
- }
-
- ttf->kerntables = static_cast<const sal_uInt8**>(calloc(ttf->nkern, sizeof(sal_uInt8 *)));
- assert(ttf->kerntables != nullptr);
-
- for( unsigned i = 0; i < ttf->nkern; ++i) {
- ttf->kerntables[i] = ptr;
- ptr += GetUInt16(ptr, 2);
- /* sanity check */
- if( ptr > ttf->ptr+ttf->fsize )
- {
- free( ttf->kerntables );
- goto badtable;
- }
- }
- return;
- }
-
- if (nTableSize >= 8 && GetUInt32(table, 0) == 0x00010000) { /* MacOS style kern tables: fixed32 version and sal_uInt32 nTables fields */
- ttf->nkern = GetUInt32(table, 4);
- ptr = table + 8;
-
- const sal_uInt32 remaining_table_size = nTableSize-8;
- const sal_uInt32 nMinRecordSize = 4;
- const sal_uInt32 nMaxRecords = remaining_table_size / nMinRecordSize;
- if (ttf->nkern > nMaxRecords)
- {
- SAL_WARN("vcl.fonts", "Parsing error in " << OUString::createFromAscii(ttf->fname) <<
- ": " << nMaxRecords << " max possible entries, but " <<
- ttf->nkern << " claimed, truncating");
- ttf->nkern = nMaxRecords;
- }
-
- ttf->kerntables = static_cast<const sal_uInt8**>(calloc(ttf->nkern, sizeof(sal_uInt8 *)));
- assert(ttf->kerntables != nullptr);
-
- for( unsigned i = 0; i < ttf->nkern; ++i) {
- ttf->kerntables[i] = ptr;
- ptr += GetUInt32(ptr, 0);
- /* sanity check; there are some fonts that are broken in this regard */
- if( ptr > ttf->ptr+ttf->fsize )
- {
- free( ttf->kerntables );
- goto badtable;
- }
- }
- return;
- }
-
- badtable:
- ttf->kerntables = nullptr;
-}
-
/*- Public functions */
int CountTTCFonts(const char* fname)
@@ -1581,7 +1505,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
case T_vmtx: nIndex = O_vmtx; break;
case T_OS2 : nIndex = O_OS2; break;
case T_post: nIndex = O_post; break;
- case T_kern: nIndex = O_kern; break;
case T_cvt : nIndex = O_cvt; break;
case T_prep: nIndex = O_prep; break;
case T_fpgm: nIndex = O_fpgm; break;
@@ -1706,7 +1629,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
GetNames(t);
FindCmap(t);
- GetKern(t);
return SF_OK;
}
@@ -1728,7 +1650,6 @@ void CloseTTFont(TrueTypeFont *ttf)
free( ttf->usubfamily );
free(ttf->tables);
free(ttf->tlens);
- free(ttf->kerntables);
free(ttf);
}
More information about the Libreoffice-commits
mailing list