summaryrefslogtreecommitdiff
path: root/in_sfnt.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2007-12-02 18:38:31 +0000
committerBen Harris <bjh21@bjh21.me.uk>2007-12-02 18:38:31 +0000
commit5527360cf7e5b68a1954874c82128690ed7df488 (patch)
tree5523c2e2c9968179f0cb9bf0752612d31a19f65d /in_sfnt.c
parent9f1e64f3255128130020f9bb636e17234f8a3d69 (diff)
downloadhalibut-5527360cf7e5b68a1954874c82128690ed7df488.zip
halibut-5527360cf7e5b68a1954874c82128690ed7df488.tar.gz
halibut-5527360cf7e5b68a1954874c82128690ed7df488.tar.bz2
halibut-5527360cf7e5b68a1954874c82128690ed7df488.tar.xz
Cope with TrueType fonts with slightly broken cmaps, just ignoring code points
that can't be resolved (apart from warning about it). [originally from svn r7800]
Diffstat (limited to 'in_sfnt.c')
-rw-r--r--in_sfnt.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/in_sfnt.c b/in_sfnt.c
index 73479b1..fc37dc0 100644
--- a/in_sfnt.c
+++ b/in_sfnt.c
@@ -885,19 +885,31 @@ void sfnt_getmap(font_info *fi) {
for (k = startCode[j]; k <= endCode[j]; k++) {
idx = (k + idDelta[j]) & 0xffff;
if (idx != 0) {
- if (idx > sf->nglyphs) goto bad;
+ if (idx > sf->nglyphs) {
+ error(err_sfntbadglyph, &sf->pos,
+ (wchar_t)k);
+ continue;
+ }
fi->bmp[k] = sfnt_indextoglyph(sf, idx);
}
}
} else {
unsigned startidx = idRangeOffset[j]/2 - segcount + j;
for (k = startCode[j]; k <= endCode[j]; k++) {
- if (startidx + k - startCode[j] >= nglyphindex)
- goto bad;
+ if (startidx + k - startCode[j] >=
+ nglyphindex) {
+ error(err_sfntbadglyph, &sf->pos,
+ (wchar_t)k);
+ continue;
+ }
idx = glyphIndexArray[startidx + k - startCode[j]];
if (idx != 0) {
idx = (idx + idDelta[j]) & 0xffff;
- if (idx > sf->nglyphs) goto bad;
+ if (idx > sf->nglyphs) {
+ error(err_sfntbadglyph, &sf->pos,
+ (wchar_t)k);
+ continue;
+ }
fi->bmp[k] = sfnt_indextoglyph(sf, idx);
}
}