本文整理汇总了PHP中TCPDF_STATIC::_getUFWORD方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_STATIC::_getUFWORD方法的具体用法?PHP TCPDF_STATIC::_getUFWORD怎么用?PHP TCPDF_STATIC::_getUFWORD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF_STATIC
的用法示例。
在下文中一共展示了TCPDF_STATIC::_getUFWORD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addTTFfont
//.........这里部分代码省略.........
$tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
$indexToLoc[$i] = TCPDF_STATIC::_getUSHORT($font, $offset) * 2;
$offset += 2;
}
} else {
// long version
$tot_num_glyphs = floor($table['loca']['length'] / 4); // numGlyphs + 1
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
$indexToLoc[$i] = TCPDF_STATIC::_getULONG($font, $offset);
$offset += 4;
}
}
// get glyphs indexes of chars from cmap table
$offset = $table['cmap']['offset'] + 2;
$numEncodingTables = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
$encodingTables = array();
for ($i = 0; $i < $numEncodingTables; ++$i) {
$encodingTables[$i]['platformID'] = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
$encodingTables[$i]['encodingID'] = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
$encodingTables[$i]['offset'] = TCPDF_STATIC::_getULONG($font, $offset);
$offset += 4;
}
// ---------- get os/2 metrics ----------
$offset = $table['OS/2']['offset'];
$offset += 2; // skip version
// xAvgCharWidth
$fmetric['AvgWidth'] = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk);
$offset += 2;
// usWeightClass
$usWeightClass = round(TCPDF_STATIC::_getUFWORD($font, $offset) * $urk);
// estimate StemV and StemH (400 = usWeightClass for Normal - Regular font)
$fmetric['StemV'] = round((70 * $usWeightClass) / 400);
$fmetric['StemH'] = round((30 * $usWeightClass) / 400);
$offset += 2;
$offset += 2; // usWidthClass
$fsType = TCPDF_STATIC::_getSHORT($font, $offset);
$offset += 2;
if ($fsType == 2) {
// This Font cannot be modified, embedded or exchanged in any manner without first obtaining permission of the legal owner.
return false;
}
// ---------- get font name ----------
$fmetric['name'] = '';
$offset = $table['name']['offset'];
$offset += 2; // skip Format selector (=0).
// Number of NameRecords that follow n.
$numNameRecords = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
// Offset to start of string storage (from start of table).
$stringStorageOffset = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
for ($i = 0; $i < $numNameRecords; ++$i) {
$offset += 6; // skip Platform ID, Platform-specific encoding ID, Language ID.
// Name ID.
$nameID = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
if ($nameID == 6) {
// String length (in bytes).
$stringLength = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
// String offset from start of storage area (in bytes).
$stringOffset = TCPDF_STATIC::_getUSHORT($font, $offset);