Kaydet (Commit) e99d502d authored tarafından Luboš Luňák's avatar Luboš Luňák

fix handling of ttf embedding restrictions

Font is usable for viewing if not restricted from embedding completely
(since otherwise either viewing is allowed or a less restrictive setting
is present). Font is usable for editing if it's installable or editable.

Change-Id: I57604a54390b935bae3699dda581d1093fc245e3
üst 8da3cfcd
...@@ -146,17 +146,15 @@ bool EmbeddedFontsHelper::sufficientFontRights( const void* data, long size, Fon ...@@ -146,17 +146,15 @@ bool EmbeddedFontsHelper::sufficientFontRights( const void* data, long size, Fon
GetTTGlobalFontInfo( font, &info ); GetTTGlobalFontInfo( font, &info );
CloseTTFont( font ); CloseTTFont( font );
// http://www.microsoft.com/typography/tt/ttf_spec/ttch02.doc // http://www.microsoft.com/typography/tt/ttf_spec/ttch02.doc
// font embedding is allowed if either
// no restriction at all (bit 1 clear)
// viewing allowed (bit 1 set, bit 2 set)
// editting allowed (bit 1 set, bit 3 set)
int copyright = info.typeFlags & TYPEFLAG_COPYRIGHT_MASK; int copyright = info.typeFlags & TYPEFLAG_COPYRIGHT_MASK;
switch( rights ) switch( rights )
{ {
case ViewingAllowed: case ViewingAllowed:
return ( copyright & 0x02 ) == 0 || ( copyright & 0x04 ) || ( copyright & 0x08 ); // Embedding not restricted completely.
return ( copyright & 0x02 ) != 0x02;
case EditingAllowed: case EditingAllowed:
return ( copyright & 0x02 ) == 0 || ( copyright & 0x08 ); // Font is installable or editable.
return copyright == 0 || ( copyright & 0x08 );
} }
} }
return true; // no known restriction return true; // no known restriction
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment