本文整理匯總了PHP中ReadShort函數的典型用法代碼示例。如果您正苦於以下問題:PHP ReadShort函數的具體用法?PHP ReadShort怎麽用?PHP ReadShort使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ReadShort函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: CheckTTF
function CheckTTF($file)
{
//Check if font license allows embedding
$f = fopen($file, 'rb');
if (!$f) {
die('Error: unable to open ' . $file);
}
//Extract number of tables
fseek($f, 4, SEEK_CUR);
$nb = ReadShort($f);
fseek($f, 6, SEEK_CUR);
//Seek OS/2 table
$found = false;
for ($i = 0; $i < $nb; $i++) {
if (fread($f, 4) == 'OS/2') {
$found = true;
break;
}
fseek($f, 12, SEEK_CUR);
}
if (!$found) {
fclose($f);
return;
}
fseek($f, 4, SEEK_CUR);
$offset = ReadLong($f);
fseek($f, $offset, SEEK_SET);
//Extract fsType flags
fseek($f, 8, SEEK_CUR);
$fsType = ReadShort($f);
$rl = ($fsType & 0x02) != 0;
$pp = ($fsType & 0x04) != 0;
$e = ($fsType & 0x08) != 0;
fclose($f);
if ($rl AND (!$pp) AND (!$e)) {
print "Warning: font license does not allow embedding\n";
}
}
示例2: CheckTTF
function CheckTTF($file)
{
//Check if font license allows embedding
$f = fopen($file, 'rb');
if (!$f) {
die('<B>Error:</B> Can\'t open ' . $file);
}
//Extract number of tables
fseek($f, 4, SEEK_CUR);
$nb = ReadShort($f);
fseek($f, 6, SEEK_CUR);
//Seek OS/2 table
$found = false;
for ($i = 0; $i < $nb; $i++) {
if (fread($f, 4) == 'OS/2') {
$found = true;
break;
}
fseek($f, 12, SEEK_CUR);
}
if (!$found) {
fclose($f);
return;
}
fseek($f, 4, SEEK_CUR);
$offset = ReadLong($f);
fseek($f, $offset, SEEK_SET);
//Extract fsType flags
fseek($f, 8, SEEK_CUR);
$fsType = ReadShort($f);
$rl = ($fsType & 0x2) != 0;
$pp = ($fsType & 0x4) != 0;
$e = ($fsType & 0x8) != 0;
fclose($f);
if ($rl and !$pp and !$e) {
echo '<B>Warning:</B> font license does not allow embedding';
}
}
示例3: CheckTTF
function CheckTTF($file)
{
$f = fopen($file, 'rb');
if (!$f) {
die('<b>Error:</b> Can\'t open ' . $file);
}
fseek($f, 4, SEEK_CUR);
$nb = ReadShort($f);
fseek($f, 6, SEEK_CUR);
$found = false;
for ($i = 0; $i < $nb; $i++) {
if (fread($f, 4) == 'OS/2') {
$found = true;
break;
}
fseek($f, 12, SEEK_CUR);
}
if (!$found) {
fclose($f);
return;
}
fseek($f, 4, SEEK_CUR);
$offset = ReadLong($f);
fseek($f, $offset, SEEK_SET);
fseek($f, 8, SEEK_CUR);
$fsType = ReadShort($f);
$rl = ($fsType & 0x2) != 0;
$pp = ($fsType & 0x4) != 0;
$e = ($fsType & 0x8) != 0;
fclose($f);
if ($rl && !$pp && !$e) {
echo '<b>Warning:</b> font license does not allow embedding';
}
}