summaryrefslogtreecommitdiff
path: root/repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-31 11:05:19 +0100
committerdavidovski <david@davidovski.xyz>2022-05-31 11:05:19 +0100
commit48ca75555522716f0f686dcae3dd6cf3d8ad714d (patch)
tree00c0f58550ba4661e87376f2f02c8001c69bae44 /repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch
parent871b2b573f01c1b3176a0f65458b3d281b41c437 (diff)
removed idea of repos
Diffstat (limited to 'repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch')
-rw-r--r--repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch58
1 files changed, 0 insertions, 58 deletions
diff --git a/repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch b/repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch
deleted file mode 100644
index d5cfe2f..0000000
--- a/repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From a3b69a0215fdface0fd5730872a4b3242d979dca Mon Sep 17 00:00:00 2001
-From: Uli Schlachter <psychon@znc.in>
-Date: Tue, 9 Feb 2021 16:54:35 +0100
-Subject: [PATCH] pdf font subset: Generate valid font names
-
-A hash value is encoded in base 26 with upper case letters for font
-names.
-
-Commit ed984146 replaced "numerator = abs (hash);" with "numerator =
-hash;" in this code, because hash has type uint32_t and the compiler
-warned about taking the absolute value of an unsigned value. However,
-abs() is actually defined to take an int argument. Thus, there was some
-implicit cast.
-
-Since numerator has type long, i.e. is signed, it is now actually
-possible to get an overflow in the implicit cast and then have a
-negative number. The following code is not prepared for this and
-produces non-letters when encoding the hash.
-
-This commit fixes that problem by not using ldiv() and instead using /
-and % to directly compute the needed values. This gets rid of the need
-to convert to type long. Since now everything works with uint32_t, there
-is no more chance for negative numbers messing things up.
-
-Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/449
-Signed-off-by: Uli Schlachter <psychon@znc.in>
----
- src/cairo-pdf-surface.c | 8 ++------
- 1 file changed, 2 insertions(+), 6 deletions(-)
-
-diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
-index 6da460878..52c49b6d2 100644
---- a/src/cairo-pdf-surface.c
-+++ b/src/cairo-pdf-surface.c
-@@ -5310,18 +5310,14 @@ _create_font_subset_tag (cairo_scaled_font_subset_t *font_subset,
- {
- uint32_t hash;
- int i;
-- long numerator;
-- ldiv_t d;
-
- hash = _hash_data ((unsigned char *) font_name, strlen(font_name), 0);
- hash = _hash_data ((unsigned char *) (font_subset->glyphs),
- font_subset->num_glyphs * sizeof(unsigned long), hash);
-
-- numerator = hash;
- for (i = 0; i < 6; i++) {
-- d = ldiv (numerator, 26);
-- numerator = d.quot;
-- tag[i] = 'A' + d.rem;
-+ tag[i] = 'A' + (hash % 26);
-+ hash /= 26;
- }
- tag[i] = 0;
- }
---
-GitLab
-