Pop\Font\AbstractFont::shiftToSigned PHP Метод

shiftToSigned() публичный Метод

Method to shift an unpacked signed short from little endian to big endian
public shiftToSigned ( integer | array $values ) : integer | array
$values integer | array
Результат integer | array
    public function shiftToSigned($values)
    {
        if (is_array($values)) {
            foreach ($values as $key => $value) {
                if ($value >= pow(2, 15)) {
                    $values[$key] -= pow(2, 16);
                }
            }
        } else {
            if ($values >= pow(2, 15)) {
                $values -= pow(2, 16);
            }
        }
        return $values;
    }

Usage Example

Пример #1
0
 /**
  * Constructor
  *
  * Instantiate a TTF 'post' table object.
  *
  * @param  \Pop\Font\AbstractFont $font
  * @return \Pop\Font\TrueType\Table\Post
  */
 public function __construct(\Pop\Font\AbstractFont $font)
 {
     $bytePos = $font->tableInfo['post']->offset + 4;
     $italicBytes = $font->read($bytePos, 4);
     $this->italicAngle = $font->readFixed(16, 16, $italicBytes);
     $bytePos += 8;
     $ary = unpack('nfixed/', $font->read($bytePos, 2));
     $ary = $font->shiftToSigned($ary);
     $this->fixed = $ary['fixed'];
 }
All Usage Examples Of Pop\Font\AbstractFont::shiftToSigned