[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - vcl/generic vcl/source
Caolán McNamara
caolanm at redhat.com
Sat Sep 13 08:49:26 PDT 2014
vcl/generic/fontmanager/fontmanager.cxx | 72 ++++++++++++++++++++++++++++++++
vcl/source/fontsubset/sft.cxx | 11 ++--
2 files changed, 78 insertions(+), 5 deletions(-)
New commits:
commit 8618534a73e8c6b5cddb6a7cacedcc38b62bab33
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 11 17:11:33 2014 +0100
Support version 2 ttf fonts and mac font family name encodings
i.e. get loads more fonts working with LibreOffice
Related: fdo#82259 support version 2 ttc fonts on Linux
a lot of Mac OSX fonts are in this format, and we're not
seeing them under Linux
Change-Id: I8a6974ccb43afadec320331eb26bc4a2df9b13c9
(cherry picked from commit 02f8f895f2abc4ee090b4bd42963590aa018fb49)
Related: fdo#82259 implement mac ttf fontname encoding support
which is why these font's are not appearing under Linux
Change-Id: Ib72ddb465b2df729953ece416cfa0477cd565bcd
(cherry picked from commit 9436ae99438ccc24a86aff61aaa9174a9686814f)
Reviewed-on: https://gerrit.libreoffice.org/11419
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index 3936c88..0677625 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -1018,6 +1018,65 @@ OUString PrintFontManager::convertTrueTypeName( void* pRecord ) const
}
}
}
+ else if( pNameRecord->platformID == 1 )
+ {
+ OString aName((const sal_Char*)(pNameRecord->sptr), pNameRecord->slen);
+ rtl_TextEncoding eEncoding = RTL_TEXTENCODING_DONTKNOW;
+ switch (pNameRecord->encodingID)
+ {
+ case 0:
+ eEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
+ break;
+ case 1:
+ eEncoding = RTL_TEXTENCODING_APPLE_JAPANESE;
+ break;
+ case 2:
+ eEncoding = RTL_TEXTENCODING_APPLE_CHINTRAD;
+ break;
+ case 3:
+ eEncoding = RTL_TEXTENCODING_APPLE_KOREAN;
+ break;
+ case 4:
+ eEncoding = RTL_TEXTENCODING_APPLE_ARABIC;
+ break;
+ case 5:
+ eEncoding = RTL_TEXTENCODING_APPLE_HEBREW;
+ break;
+ case 6:
+ eEncoding = RTL_TEXTENCODING_APPLE_GREEK;
+ break;
+ case 7:
+ eEncoding = RTL_TEXTENCODING_APPLE_CYRILLIC;
+ break;
+ case 9:
+ eEncoding = RTL_TEXTENCODING_APPLE_DEVANAGARI;
+ break;
+ case 10:
+ eEncoding = RTL_TEXTENCODING_APPLE_GURMUKHI;
+ break;
+ case 11:
+ eEncoding = RTL_TEXTENCODING_APPLE_GUJARATI;
+ break;
+ case 21:
+ eEncoding = RTL_TEXTENCODING_APPLE_THAI;
+ break;
+ case 25:
+ eEncoding = RTL_TEXTENCODING_APPLE_CHINSIMP;
+ break;
+ case 29:
+ eEncoding = RTL_TEXTENCODING_APPLE_CENTEURO;
+ break;
+ case 32: //Uninterpreted
+ eEncoding = RTL_TEXTENCODING_UTF8;
+ break;
+ default:
+ SAL_WARN("vcl", "Unimplmented mac encoding " << pNameRecord->encodingID << " to unicode conversion");
+ break;
+ }
+ if (eEncoding != RTL_TEXTENCODING_DONTKNOW)
+ aValue = OStringToOUString(aName, eEncoding);
+ }
+
return aValue;
}
@@ -1077,8 +1136,21 @@ void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OU
else
nMatch = 1000;
}
+ else if( pNameRecords[i].platformID == 1 )
+ {
+/*
+ // to-do, mac to LanguageType conversion
+ if( pNameRecords[i].languageID == aLang )
+ nMatch = 8000;
+ else*/ if( pNameRecords[i].languageID == 0 ) //English
+ nMatch = 2000;
+ else
+ nMatch = 1000;
+ }
OUString aName = convertTrueTypeName( pNameRecords + i );
aSet.insert( aName );
+ if (aName.isEmpty())
+ continue;
if( nMatch > nLastMatch || isBadTNR(aName, aSet) )
{
nLastMatch = nMatch;
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index c40d75c..a72627b 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1476,14 +1476,15 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
sal_uInt32 tdoffset = 0; /* offset to TableDirectory in a TTC file. For TTF files is 0 */
int indexfmt;
- sal_uInt32 version = GetInt32(t->ptr, 0, 1);
+ sal_uInt32 TTCTag = GetInt32(t->ptr, 0, 1);
- if ((version == 0x00010000) || (version == T_true)) {
+ if ((TTCTag == 0x00010000) || (TTCTag == T_true)) {
tdoffset = 0;
- } else if (version == T_otto) { /* PS-OpenType font */
+ } else if (TTCTag == T_otto) { /* PS-OpenType font */
tdoffset = 0;
- } else if (version == T_ttcf) { /* TrueType collection */
- if (GetUInt32(t->ptr, 4, 1) != 0x00010000) {
+ } else if (TTCTag == T_ttcf) { /* TrueType collection */
+ sal_uInt32 Version = GetUInt32(t->ptr, 4, 1);
+ if (Version != 0x00010000 && Version != 0x00020000) {
CloseTTFont(t);
return SF_TTFORMAT;
}
More information about the Libreoffice-commits
mailing list