@@ 253-291 (lines=39) @@ | ||
250 | return $a['N']; |
|
251 | } |
|
252 | ||
253 | function CheckTTF($file) |
|
254 | { |
|
255 | //Check if font license allows embedding |
|
256 | $f=fopen($file,'rb'); |
|
257 | if(!$f) |
|
258 | die('<b>Error:</b> Can\'t open '.$file); |
|
259 | //Extract number of tables |
|
260 | fseek($f,4,SEEK_CUR); |
|
261 | $nb=ReadShort($f); |
|
262 | fseek($f,6,SEEK_CUR); |
|
263 | //Seek OS/2 table |
|
264 | $found=false; |
|
265 | for($i=0;$i<$nb;$i++) |
|
266 | { |
|
267 | if(fread($f,4)=='OS/2') |
|
268 | { |
|
269 | $found=true; |
|
270 | break; |
|
271 | } |
|
272 | fseek($f,12,SEEK_CUR); |
|
273 | } |
|
274 | if(!$found) |
|
275 | { |
|
276 | fclose($f); |
|
277 | return; |
|
278 | } |
|
279 | fseek($f,4,SEEK_CUR); |
|
280 | $offset=ReadLong($f); |
|
281 | fseek($f,$offset,SEEK_SET); |
|
282 | //Extract fsType flags |
|
283 | fseek($f,8,SEEK_CUR); |
|
284 | $fsType=ReadShort($f); |
|
285 | $rl=($fsType & 0x02)!=0; |
|
286 | $pp=($fsType & 0x04)!=0; |
|
287 | $e=($fsType & 0x08)!=0; |
|
288 | fclose($f); |
|
289 | if($rl && !$pp && !$e) |
|
290 | echo '<b>Warning:</b> font license does not allow embedding'; |
|
291 | } |
|
292 | ||
293 | /******************************************************************************* |
|
294 | * fontfile: path to TTF file (or empty string if not to be embedded) * |
@@ 253-291 (lines=39) @@ | ||
250 | return $a['N']; |
|
251 | } |
|
252 | ||
253 | function CheckTTF($file) |
|
254 | { |
|
255 | //Check if font license allows embedding |
|
256 | $f=fopen($file,'rb'); |
|
257 | if(!$f) |
|
258 | die('<b>Error:</b> Can\'t open '.$file); |
|
259 | //Extract number of tables |
|
260 | fseek($f,4,SEEK_CUR); |
|
261 | $nb=ReadShort($f); |
|
262 | fseek($f,6,SEEK_CUR); |
|
263 | //Seek OS/2 table |
|
264 | $found=false; |
|
265 | for($i=0;$i<$nb;$i++) |
|
266 | { |
|
267 | if(fread($f,4)=='OS/2') |
|
268 | { |
|
269 | $found=true; |
|
270 | break; |
|
271 | } |
|
272 | fseek($f,12,SEEK_CUR); |
|
273 | } |
|
274 | if(!$found) |
|
275 | { |
|
276 | fclose($f); |
|
277 | return; |
|
278 | } |
|
279 | fseek($f,4,SEEK_CUR); |
|
280 | $offset=ReadLong($f); |
|
281 | fseek($f,$offset,SEEK_SET); |
|
282 | //Extract fsType flags |
|
283 | fseek($f,8,SEEK_CUR); |
|
284 | $fsType=ReadShort($f); |
|
285 | $rl=($fsType & 0x02)!=0; |
|
286 | $pp=($fsType & 0x04)!=0; |
|
287 | $e=($fsType & 0x08)!=0; |
|
288 | fclose($f); |
|
289 | if($rl && !$pp && !$e) |
|
290 | echo '<b>Warning:</b> font license does not allow embedding'; |
|
291 | } |
|
292 | ||
293 | /******************************************************************************* |
|
294 | * fontfile: path to TTF file (or empty string if not to be embedded) * |