當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。