From 19ed8a1acee6ef60e48ae3c2df05e606cf2a39a1 Mon Sep 17 00:00:00 2001 From: lslqtz Date: Wed, 14 Feb 2024 12:23:53 +0800 Subject: [PATCH] Add setData function --- src/FontLib/EOT/File.php | 9 +++++++++ src/FontLib/TrueType/File.php | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/src/FontLib/EOT/File.php b/src/FontLib/EOT/File.php index 55933eb..c9b4518 100644 --- a/src/FontLib/EOT/File.php +++ b/src/FontLib/EOT/File.php @@ -85,6 +85,15 @@ public function readUInt32() { return $uint32 >> 16 & 0x0000FFFF | $uint32 << 16 & 0xFFFF0000; } + + function setData($name, $key, $value) { + if (!$key) { + $this->header->data = $value; + } else { + $this->header->data[$key] = $value; + } + } + /** * Get font copyright * diff --git a/src/FontLib/TrueType/File.php b/src/FontLib/TrueType/File.php index 14e0181..4bf80e1 100644 --- a/src/FontLib/TrueType/File.php +++ b/src/FontLib/TrueType/File.php @@ -470,6 +470,14 @@ public function getData($name, $key = null) { } } + public function setData($name, $key, $value) { + if (!$key) { + $this->data[$name]->data = $value; + } else { + $this->data[$name]->data[$key] = $value; + } + } + function addDirectoryEntry(DirectoryEntry $entry) { $this->directory[$entry->tag] = $entry; }