diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2018-02-08 14:31:34 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2018-02-08 21:12:40 +0100 |
commit | e3caecb5a33288dd46a80b2ffcc47a2288305052 (patch) | |
tree | 7f992c324c3ae096512af7df1001fde063aec088 /vcl/source/fontsubset | |
parent | b738bbdd6f795b328219079c3706f96d4ce7d7fb (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/source/fontsubset')
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 79 |
1 files changed, 0 insertions, 79 deletions
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); } |