[poppler] 2 commits - fofi/FoFiTrueType.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Mar 14 19:08:52 UTC 2022
fofi/FoFiTrueType.cc | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
New commits:
commit c612cba087668456b254e861724fbe9809181f16
Author: Zachary Travis <ztravis at everlaw.com>
Date: Sun Mar 13 22:52:59 2022 -0700
Add support for format 13 as well
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index 35e8a2df..f45ab191 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -605,6 +605,7 @@ int FoFiTrueType::mapCodeToGID(int i, unsigned int c) const
gid = getU16BE(pos + 10 + 2 * (c - cmapFirst), &ok);
break;
case 12:
+ case 13:
segCnt = getU32BE(pos + 12, &ok);
a = -1;
b = segCnt - 1;
@@ -627,7 +628,10 @@ int FoFiTrueType::mapCodeToGID(int i, unsigned int c) const
if (c < segStart) {
return 0;
}
- gid = segDelta + (c - segStart);
+ // In format 12, the glyph codes increment through
+ // each segment; in format 13 the same glyph code is used
+ // for an entire segment.
+ gid = segDelta + (cmaps[i].fmt == 12 ? (c - segStart) : 0);
break;
default:
return 0;
commit 1e9f1f69ad235536b64e757ce2e6429e47a508af
Author: Zachary Travis <ztravis at everlaw.com>
Date: Sun Mar 13 20:49:21 2022 -0700
Type 2 cmap
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index 0b154b10..35e8a2df 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -531,6 +531,7 @@ int FoFiTrueType::mapCodeToGID(int i, unsigned int c) const
unsigned int segCnt, segEnd, segStart, segDelta, segOffset;
unsigned int cmapFirst, cmapLen;
int pos, a, b, m;
+ unsigned int high, low, idx;
bool ok;
if (i < 0 || i >= nCmaps) {
@@ -545,6 +546,21 @@ int FoFiTrueType::mapCodeToGID(int i, unsigned int c) const
}
gid = getU8(cmaps[i].offset + 6 + c, &ok);
break;
+ case 2:
+ high = c >> 8;
+ low = c & 0xFFU;
+ idx = getU16BE(pos + 6 + high * 2, &ok);
+ segStart = getU16BE(pos + 6 + 512 + idx, &ok);
+ segCnt = getU16BE(pos + 6 + 512 + idx + 2, &ok);
+ segDelta = getS16BE(pos + 6 + 512 + idx + 4, &ok);
+ segOffset = getU16BE(pos + 6 + 512 + idx + 6, &ok);
+ if (low < segStart || low >= segStart + segCnt) {
+ gid = 0;
+ } else {
+ int val = getU16BE(pos + 6 + 512 + idx + 6 + segOffset + (low - segStart) * 2, &ok);
+ gid = val == 0 ? 0 : (val + segDelta) & 0xFFFFU;
+ }
+ break;
case 4:
segCnt = getU16BE(pos + 6, &ok) / 2;
a = -1;
More information about the poppler
mailing list