当前位置: 首页>>代码示例>>PHP>>正文


PHP ReadShort函数代码示例

本文整理汇总了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";
	}
}
开发者ID:richarrieta,项目名称:MyTeam,代码行数:39,代码来源:makefont.php

示例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';
    }
}
开发者ID:google-code-backups,项目名称:zeybux,代码行数:38,代码来源:makefont.php

示例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';
    }
}
开发者ID:tmaski45,项目名称:tedmatuszewski.com,代码行数:34,代码来源:makefont.php


注:本文中的ReadShort函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。