diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-02-06 13:47:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-02-09 14:33:20 +0000 |
commit | cea018b386018d32dd9a762dfddd5bf316f218aa (patch) | |
tree | 7555e13536d44e10d72babd69074b95bc2b2207b /vcl/source/fontsubset | |
parent | 052a4a89ed6293298b930b52de9e53837dd908e3 (diff) |
Resolves: fdo#33510 A way to query about likely font layout capabilities
Diffstat (limited to 'vcl/source/fontsubset')
-rw-r--r-- | vcl/source/fontsubset/gsub.cxx | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 9fc03ca81185..e27b91d0e5a2 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -50,9 +50,9 @@ typedef sal_uInt8 FT_Byte; typedef std::map<USHORT,USHORT> GlyphSubstitution; -inline long NEXT_Long( const unsigned char* &p ) +inline sal_uInt32 NEXT_Long( const unsigned char* &p ) { - long nVal = (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; + sal_uInt32 nVal = (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; p += 4; return nVal; } @@ -358,6 +358,24 @@ int HasVerticalGSUB( struct _TrueTypeFont* pTTFile ) return pGlyphSubstitution ? +1 : 0; } +void getTTFontLayoutCapabilities(FontLayoutCapabilities &rFontLayoutCapabilities, const unsigned char* pBase) +{ + // parse GSUB/GPOS header + const FT_Byte* pGsubHeader = pBase; + pGsubHeader+=4; + const USHORT nOfsScriptList = NEXT_UShort(pGsubHeader); + + // parse Script Table + const FT_Byte* pScriptHeader = pBase + nOfsScriptList; + const USHORT nCntScript = NEXT_UShort(pScriptHeader); + for( USHORT nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) + { + sal_uInt32 nTag = NEXT_Long(pScriptHeader); + pScriptHeader += 2; + rFontLayoutCapabilities.push_back(nTag); // e.g. hani/arab/kana/hang + } +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |