summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2018-02-08 14:31:34 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2018-02-08 21:12:40 +0100
commite3caecb5a33288dd46a80b2ffcc47a2288305052 (patch)
tree7f992c324c3ae096512af7df1001fde063aec088 /vcl
parentb738bbdd6f795b328219079c3706f96d4ce7d7fb (diff)
Removed unused code for reading kern table
Change-Id: I66b17dbee0a04e61b99e23933a7fed4be30f3a93 Reviewed-on: https://gerrit.libreoffice.org/49426 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/sft.hxx16
-rw-r--r--vcl/source/fontsubset/sft.cxx79
2 files changed, 0 insertions, 95 deletions
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 696e267d547b..0edec67ac376 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -101,13 +101,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,
@@ -189,12 +182,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 */
@@ -485,8 +472,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[] */
@@ -502,7 +487,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 c61c74b672dd..70b52fa1298d 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)
@@ -1582,7 +1506,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;
@@ -1715,7 +1638,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
GetNames(t);
FindCmap(t);
- GetKern(t);
return SF_OK;
}
@@ -1737,7 +1659,6 @@ void CloseTTFont(TrueTypeFont *ttf)
free( ttf->usubfamily );
free(ttf->tables);
free(ttf->tlens);
- free(ttf->kerntables);
free(ttf);
}