Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/FontLib/Glyph/OutlineComposite.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ function parseData() {

$this->components[] = $component;
} while ($flags & self::MORE_COMPONENTS);
if ($flags & self::WE_HAVE_INSTRUCTIONS) {
$numInstr = $font->readUInt16();
$instr = $font->read($numInstr);
$this->components[count($this->components) - 1]->instructions = pack('n', $numInstr) . $instr;
}
}

function encode() {
Expand Down Expand Up @@ -171,6 +176,8 @@ function encode() {

if ($_i < count($this->components) - 1) {
$flags |= self::MORE_COMPONENTS;
} elseif($_component->instructions !== null) {
$flags |= self::WE_HAVE_INSTRUCTIONS;
}

$size += $font->writeUInt16($flags);
Expand Down Expand Up @@ -214,6 +221,10 @@ function encode() {
}
}

if($_component->instructions !== null) {
$size += $font->write($_component->instructions, strlen($_component->instructions));
}

return $size;
}

Expand Down
27 changes: 27 additions & 0 deletions src/FontLib/Table/Type/cvt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @author Fabien Ménager <fabien.menager@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/

namespace FontLib\Table\Type;
use FontLib\Table\Table;

/**
* `cvt ` font table.
*
* @package php-font-lib
*/
class cvt extends Table {
private $rawData;
protected function _parse() {
$font = $this->getFont();
$font->seek($this->entry->offset);
$this->rawData = $font->read($this->entry->length);
}
function _encode() {
return $this->getFont()->write($this->rawData, $this->entry->length);
}
}
27 changes: 27 additions & 0 deletions src/FontLib/Table/Type/fpgm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @author Fabien Ménager <fabien.menager@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/

namespace FontLib\Table\Type;
use FontLib\Table\Table;

/**
* `fpgm` font table.
*
* @package php-font-lib
*/
class fpgm extends Table {
private $rawData;
protected function _parse() {
$font = $this->getFont();
$font->seek($this->entry->offset);
$this->rawData = $font->read($this->entry->length);
}
function _encode() {
return $this->getFont()->write($this->rawData, $this->entry->length);
}
}
30 changes: 30 additions & 0 deletions src/FontLib/Table/Type/prep.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @author Fabien Ménager <fabien.menager@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/

namespace FontLib\Table\Type;

use FontLib\Table\Table;

/**
* `prep` font table.
*
* @package php-font-lib
*/
class prep extends Table
{
private $rawData;
protected function _parse() {
$font = $this->getFont();
$font->seek($this->entry->offset);
$this->rawData = $font->read($this->entry->length);
}
function _encode() {
return $this->getFont()->write($this->rawData, $this->entry->length);
}
}
5 changes: 3 additions & 2 deletions src/FontLib/TrueType/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,12 @@ function getSubset() {

function encode($tags = array()) {
if (!self::$raw) {
$tags = array_merge(array("head", "hhea", "cmap", "hmtx", "maxp", "glyf", "loca", "name", "post"), $tags);
$tags = array_merge(array("head", "hhea", "cmap", "hmtx", "maxp", "glyf", "loca", "name", "post", "cvt ", "fpgm", "prep"), $tags);
}
else {
$tags = array_keys($this->directory);
}

$num_tables = count($tags);
$n = 16; // @todo

Font::d("Tables : " . implode(", ", $tags));
Expand All @@ -239,6 +238,8 @@ function encode($tags = array()) {
$entries[$tag] = $this->directory[$tag];
}

$num_tables = count($entries);

$this->header->data["numTables"] = $num_tables;
$this->header->encode();

Expand Down