Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/FontLib/AdobeFontMetrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function write($file, $encoding = null) {
$this->endSection("CharMetrics");

$kern = $font->getData("kern", "subtable");
$tree = $kern["tree"];
$tree = is_array($kern) ? $kern["tree"] : null;

if (!$encoding && is_array($tree)) {
$this->startSection("KernData");
Expand Down
23 changes: 13 additions & 10 deletions src/FontLib/BinaryStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ class BinaryStream {
const modeReadWrite = "rb+";

static function backtrace() {
var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
}

/**
* Open a font file in read mode
*
* @param string $filename The file name of the font to open
*
* @return bool
*/
/**
* Open a font file in read mode
*
* @param string $filename The file name of the font to open
*
* @return bool
* @throws \Exception
*/
public function load($filename) {
return $this->open($filename, self::modeRead);
}
Expand Down Expand Up @@ -142,15 +143,17 @@ public function read($n) {
return "";
}

return fread($this->f, $n);
// handle the return data, DO NOT spew E_NOTICEs
return @fread($this->f, $n);
}

public function write($data, $length = null) {
if ($data === null || $data === "" || $data === false) {
return 0;
}

return fwrite($this->f, $data, $length);
// handle the return data, DO NOT spew E_NOTICEs
return @fwrite($this->f, $data, $length);
}

public function readUInt8() {
Expand Down