summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-07-14 14:03:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-07-14 14:03:56 +0100
commit50d0b31d330b3eb245e96d9950328261e89e00cd (patch)
tree6b656e98cc67837b60b63aedb83d4914f3bc47f3
parentc375cd09d8c901b161176d0bb8f3cb6a2df1dc17 (diff)
Related: fdo#31821 pull tables from otf fonts as well
Change-Id: If3bd4ac640aaf6b68fa4ae2a363f691601ff942b
-rw-r--r--vcl/generic/glyphs/gcach_ftyp.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index 9da899388ef3..d186aef2df00 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -449,7 +449,9 @@ static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)
static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);}
//static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));}
-// -----------------------------------------------------------------------
+static const sal_uInt32 T_true = 0x74727565; /* 'true' */
+static const sal_uInt32 T_ttcf = 0x74746366; /* 'ttcf' */
+static const sal_uInt32 T_otto = 0x4f54544f; /* 'OTTO' */
const unsigned char* FtFontInfo::GetTable( const char* pTag, sal_uLong* pLength ) const
{
@@ -458,12 +460,13 @@ const unsigned char* FtFontInfo::GetTable( const char* pTag, sal_uLong* pLength
if( !pBuffer || nFileSize<1024 )
return NULL;
- // we currently only handle TTF and TTC headers
+ // we currently handle TTF, TTC and OTF headers
unsigned nFormat = GetUInt( pBuffer );
+
const unsigned char* p = pBuffer + 12;
- if( nFormat == 0x74746366 ) // TTC_MAGIC
+ if( nFormat == T_ttcf ) // TTC_MAGIC
p += GetUInt( p + 4 * mnFaceNum );
- else if( (nFormat!=0x00010000) && (nFormat!=0x74727565) ) // TTF_MAGIC and Apple TTF Magic
+ else if( nFormat != 0x00010000 && nFormat != T_true && nFormat != T_otto) // TTF_MAGIC and Apple TTF Magic and PS-OpenType font
return NULL;
// walk table directory until match