diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2018-02-08 14:31:34 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-09 01:01:42 +0100 |
commit | f0416352ba0290087ad20f4e3a84c34fe7212a21 (patch) | |
tree | 9d805881e2c01a59c2627bf5f751e2a620bb30d0 /vcl | |
parent | df30a561499305a1da6c5fb578315feefe873881 (diff) |
Removed unused code for reading kern table
Reviewed-on: https://gerrit.libreoffice.org/49426
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
(cherry picked from commit e3caecb5a33288dd46a80b2ffcc47a2288305052)
Change-Id: I66b17dbee0a04e61b99e23933a7fed4be30f3a93
Reviewed-on: https://gerrit.libreoffice.org/49452
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/sft.hxx | 18 | ||||
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 85 |
2 files changed, 0 insertions, 103 deletions
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 17efc970fa9b..bca8054b6875 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, @@ -197,12 +190,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 */ @@ -495,10 +482,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 */ - int kerntype; /* Defined in the KernType enum */ - sal_uInt32 nkern; /* number of kern subtables */ - const sal_uInt8** kerntables; /* array of pointers to kern subtables */ - void *pGSubstitution; /* info provided by GSUB for UseGSUB() */ }; /* indexes into TrueTypeFont::tables[] and TrueTypeFont::tlens[] */ @@ -514,7 +497,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 966393fa4fe3..f968c9c092d9 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -123,7 +123,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 @@ -1345,86 +1344,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); - ttf->kerntype = KT_MICROSOFT; - 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); - ttf->kerntype = KT_APPLE_NEW; - 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->kerntype = KT_NONE; - ttf->kerntables = nullptr; - - return; -} - /*- Public functions */ int CountTTCFonts(const char* fname) @@ -1452,7 +1371,6 @@ static void allocTrueTypeFont( TrueTypeFont** ttf ) (*ttf)->fsize = -1; (*ttf)->ptr = nullptr; (*ttf)->nglyphs = 0xFFFFFFFF; - (*ttf)->pGSubstitution = nullptr; } } @@ -1597,7 +1515,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; @@ -1722,7 +1639,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) GetNames(t); FindCmap(t); - GetKern(t); return SF_OK; } @@ -1744,7 +1660,6 @@ void CloseTTFont(TrueTypeFont *ttf) free( ttf->usubfamily ); free(ttf->tables); free(ttf->tlens); - free(ttf->kerntables); free(ttf); return; |