本文整理汇总了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';
}
}