summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-04-13 19:13:59 +0100
committerRobin Watts <robin.watts@artifex.com>2017-04-18 16:45:49 +0100
commit670fe1b085fde8355b6d1a70b143eab60e34b1b6 (patch)
treeeca6b0c5e2561a2da269fb9abd1c8d7a9bdeffcb /scripts
parenta742ac09981f7c681f63f88738e7eded95412599 (diff)
downloadmupdf-670fe1b085fde8355b6d1a70b143eab60e34b1b6.tar.xz
Use splay trees for loading/merging cmaps.
This allows for overlaps, merges adjacent (mergeable) ranges and gets us properly searchable results. This causes 1 diff in the test suites (Bug694353.pdf), which is due to the fallback font not having a hypen present at UCS 0x2010.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmapdump.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/scripts/cmapdump.c b/scripts/cmapdump.c
index eb84cb4c..e8ed5742 100644
--- a/scripts/cmapdump.c
+++ b/scripts/cmapdump.c
@@ -51,7 +51,7 @@ main(int argc, char **argv)
FILE *fo;
char name[256];
char *realname;
- int i, k, m;
+ int i, k;
fz_context *ctx;
if (argc < 3)
@@ -141,10 +141,19 @@ main(int argc, char **argv)
fprintf(fo, "static const pdf_mrange cmap_%s_mranges[] = {", name);
for (k = 0; k < cmap->mlen; k++)
{
- fprintf(fo, "\n{%uu,%uu,{", cmap->mranges[k].low, cmap->mranges[k].len);
- for (m = 0; m < PDF_MRANGE_CAP; ++m)
- fprintf(fo, "%uu,", cmap->mranges[k].out[m]);
- fprintf(fo, "}},");
+ fprintf(fo, "\n{%uu,%uu},", cmap->mranges[k].low, cmap->mranges[k].out);
+ }
+ fprintf(fo, "\n};\n\n");
+ }
+
+ if (cmap->dlen > 0)
+ {
+ fprintf(fo, "static const int cmap_%s_dict[] = {", name);
+ for (k = 0; k < cmap->dlen; k++)
+ {
+ if (k % 4 == 0)
+ fprintf(fo, "\n");
+ fprintf(fo, "%uu,", cmap->dict[k]);
}
fprintf(fo, "\n};\n\n");
}
@@ -177,6 +186,10 @@ main(int argc, char **argv)
fprintf(fo, "\t%u, %u, (pdf_mrange*) cmap_%s_mranges,\n", cmap->mlen, cmap->mlen, name);
else
fprintf(fo, "\t0, 0, NULL,\n");
+ if (cmap->dict)
+ fprintf(fo, "\t%u, %u, (int*) cmap_%s_dict,\n", cmap->dlen, cmap->dlen, name);
+ else
+ fprintf(fo, "\t0, 0, NULL,\n");
fprintf(fo, "};\n");