1515 * @package php-font-lib
1616 */
1717class Font_EOT extends Font_TrueType {
18+ const TTEMBED_SUBSET = 0x00000001 ;
19+ const TTEMBED_TTCOMPRESSED = 0x00000004 ;
20+ const TTEMBED_FAILIFVARIATIONSIMULATED = 0x00000010 ;
21+ const TTMBED_EMBEDEUDC = 0x00000020 ;
22+ const TTEMBED_VALIDATIONTESTS = 0x00000040 ; // Deprecated
23+ const TTEMBED_WEBOBJECT = 0x00000080 ;
24+ const TTEMBED_XORENCRYPTDATA = 0x10000000 ;
25+
1826 /**
1927 * @var Font_EOT_Header
2028 */
@@ -32,7 +40,28 @@ function parseHeader(){
3240 function parse () {
3341 $ this ->parseHeader ();
3442
35- // TODO
43+ $ flags = $ this ->header ->data ["Flags " ];
44+
45+ if ($ flags & self ::TTEMBED_TTCOMPRESSED ) {
46+ $ mtx_version = $ this ->readUInt8 ();
47+ $ mtx_copy_limit = $ this ->readUInt8 () << 16 | $ this ->readUInt8 () << 8 | $ this ->readUInt8 ();
48+ $ mtx_offset_1 = $ this ->readUInt8 () << 16 | $ this ->readUInt8 () << 8 | $ this ->readUInt8 ();
49+ $ mtx_offset_2 = $ this ->readUInt8 () << 16 | $ this ->readUInt8 () << 8 | $ this ->readUInt8 ();
50+
51+ /*
52+ var_dump("$mtx_version $mtx_copy_limit $mtx_offset_1 $mtx_offset_2");
53+
54+ $pos = $this->pos();
55+ $size = $mtx_offset_1 - $pos;
56+ var_dump("pos: $pos");
57+ var_dump("size: $size");*/
58+ }
59+
60+ if ($ flags & self ::TTEMBED_XORENCRYPTDATA ) {
61+ // Process XOR
62+ }
63+
64+ // TODO Read font data ...
3665 }
3766
3867 /**
@@ -70,7 +99,7 @@ function getFontCopyright(){
7099 * @return string|null
71100 */
72101 function getFontName (){
73- return $ this ->header ->data ["FullName " ];
102+ return $ this ->header ->data ["FamilyName " ];
74103 }
75104
76105 /**
@@ -79,7 +108,7 @@ function getFontName(){
79108 * @return string|null
80109 */
81110 function getFontSubfamily (){
82- return $ this ->header ->data ["FamilyName " ];
111+ return $ this ->header ->data ["StyleName " ];
83112 }
84113
85114 /**
@@ -88,7 +117,7 @@ function getFontSubfamily(){
88117 * @return string|null
89118 */
90119 function getFontSubfamilyID (){
91- return $ this ->header ->data ["FamilyName " ];
120+ return $ this ->header ->data ["StyleName " ];
92121 }
93122
94123 /**
@@ -109,6 +138,15 @@ function getFontVersion(){
109138 return $ this ->header ->data ["VersionName " ];
110139 }
111140
141+ /**
142+ * Get font weight
143+ *
144+ * @return string|null
145+ */
146+ function getFontWeight (){
147+ return $ this ->header ->data ["Weight " ];
148+ }
149+
112150 /**
113151 * Get font Postscript name
114152 *
0 commit comments