summaryrefslogtreecommitdiffstats
path: root/gfx/ots/ots-rlbox.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /gfx/ots/ots-rlbox.patch
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/ots/ots-rlbox.patch')
-rw-r--r--gfx/ots/ots-rlbox.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/gfx/ots/ots-rlbox.patch b/gfx/ots/ots-rlbox.patch
new file mode 100644
index 0000000000..c5cdba3545
--- /dev/null
+++ b/gfx/ots/ots-rlbox.patch
@@ -0,0 +1,60 @@
+diff --git a/gfx/ots/src/ots.cc b/gfx/ots/src/ots.cc
+--- a/gfx/ots/src/ots.cc
++++ b/gfx/ots/src/ots.cc
+@@ -14,7 +14,7 @@
+ #include <map>
+ #include <vector>
+
+-#include <woff2/decode.h>
++#include "../RLBoxWOFF2Host.h"
+
+ // The OpenType Font File
+ // http://www.microsoft.com/typography/otspec/otff.htm
+@@ -511,43 +511,9 @@ bool ProcessWOFF(ots::FontFile *header,
+ return ProcessGeneric(header, font, woff_tag, output, data, length, tables, file);
+ }
+
+-bool ProcessWOFF2(ots::FontFile *header,
+- ots::OTSStream *output,
+- const uint8_t *data,
+- size_t length,
+- uint32_t index) {
+- size_t decompressed_size = woff2::ComputeWOFF2FinalSize(data, length);
+-
+- if (decompressed_size < length) {
+- return OTS_FAILURE_MSG_HDR("Size of decompressed WOFF 2.0 is less than compressed size");
+- }
+-
+- if (decompressed_size == 0) {
+- return OTS_FAILURE_MSG_HDR("Size of decompressed WOFF 2.0 is set to 0");
+- }
+- // decompressed font must be <= OTS_MAX_DECOMPRESSED_FILE_SIZE
+- if (decompressed_size > OTS_MAX_DECOMPRESSED_FILE_SIZE) {
+- return OTS_FAILURE_MSG_HDR("Size of decompressed WOFF 2.0 font exceeds %gMB",
+- OTS_MAX_DECOMPRESSED_FILE_SIZE / (1024.0 * 1024.0));
+- }
+-
+- if (decompressed_size > output->size()) {
+- return OTS_FAILURE_MSG_HDR("Size of decompressed WOFF 2.0 font exceeds output size (%gMB)", output->size() / (1024.0 * 1024.0));
+- }
+-
+- std::string buf(decompressed_size, 0);
+- woff2::WOFF2StringOut out(&buf);
+- if (!woff2::ConvertWOFF2ToTTF(data, length, &out)) {
+- return OTS_FAILURE_MSG_HDR("Failed to convert WOFF 2.0 font to SFNT");
+- }
+- const uint8_t *decompressed = reinterpret_cast<const uint8_t*>(buf.data());
+-
+- if (data[4] == 't' && data[5] == 't' && data[6] == 'c' && data[7] == 'f') {
+- return ProcessTTC(header, output, decompressed, out.Size(), index);
+- } else {
+- ots::Font font(header);
+- return ProcessTTF(header, &font, output, decompressed, out.Size());
+- }
++bool ProcessWOFF2(ots::FontFile* header, ots::OTSStream* output,
++ const uint8_t* data, size_t length, uint32_t index) {
++ return RLBoxProcessWOFF2(header, output, data, length, index, ProcessTTC, ProcessTTF);
+ }
+
+ ots::TableAction GetTableAction(const ots::FontFile *header, uint32_t tag) {
+