summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-11-29 13:47:38 +0000
committerRobin Watts <robin.watts@artifex.com>2012-11-29 14:41:33 +0000
commit82b666579e02a4d35b3087b79353373c355d107f (patch)
tree8a9a6b93ecbe16a663a015f233e824017e02ad50
parentc3fa0d45ff96eefe6effaeffc45516c6f85587bd (diff)
downloadmupdf-82b666579e02a4d35b3087b79353373c355d107f.tar.xz
Bug 693463: Various small fixes.
Thanks to zeniko for these. Use otf as extension for opentype fonts. fz_clampi should take ints, not floats! Fix typo in prototype. Squash unwanted warning. Remove magic number in favour of #define. Reset generation numbers when renumbering.
-rw-r--r--apps/pdfextract.c2
-rw-r--r--fitz/dev_text.c2
-rw-r--r--fitz/dev_trace.c2
-rw-r--r--fitz/fitz.h2
-rw-r--r--pdf/mupdf-internal.h2
-rw-r--r--pdf/pdf_font.c3
-rw-r--r--pdf/pdf_interpret.c2
-rw-r--r--pdf/pdf_repair.c1
-rw-r--r--pdf/pdf_write.c8
9 files changed, 17 insertions, 7 deletions
diff --git a/apps/pdfextract.c b/apps/pdfextract.c
index 7d49f997..f17edff2 100644
--- a/apps/pdfextract.c
+++ b/apps/pdfextract.c
@@ -96,6 +96,8 @@ static void savefont(pdf_obj *dict, int num)
ext = "cff";
else if (!strcmp(subtype, "CIDFontType0C"))
ext = "cid";
+ else if (!strcmp(subtype, "OpenType"))
+ ext = "otf";
else
fz_throw(ctx, "Unhandled font type '%s'", subtype);
}
diff --git a/fitz/dev_text.c b/fitz/dev_text.c
index 280d1b55..a5d765eb 100644
--- a/fitz/dev_text.c
+++ b/fitz/dev_text.c
@@ -714,7 +714,7 @@ fz_print_text_page_xml(fz_context *ctx, FILE *out, fz_text_page *page)
break;
}
fprintf(out, "\"/>\n");
- }
+ }
fprintf(out, "</span>\n");
}
fprintf(out, "</line>\n");
diff --git a/fitz/dev_trace.c b/fitz/dev_trace.c
index 514ee780..a56cc67b 100644
--- a/fitz/dev_trace.c
+++ b/fitz/dev_trace.c
@@ -114,7 +114,7 @@ fz_trace_stroke_path(fz_device *dev, fz_path *path, fz_stroke_state *stroke, fz_
static void
fz_trace_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz_matrix ctm)
{
- printf("<clip_path ");
+ printf("<clip_path");
if (even_odd)
printf(" winding=\"eofill\"");
else
diff --git a/fitz/fitz.h b/fitz/fitz.h
index 0ea3cb2c..314fadd6 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -166,7 +166,7 @@ static inline float fz_clamp(float f, float min, float max)
return (f > min ? (f < max ? f : max) : min);
}
-static inline int fz_clampi(int i, float min, float max)
+static inline int fz_clampi(int i, int min, int max)
{
return (i > min ? (i < max ? i : max) : min);
}
diff --git a/pdf/mupdf-internal.h b/pdf/mupdf-internal.h
index 3f3d0fb5..839f30f4 100644
--- a/pdf/mupdf-internal.h
+++ b/pdf/mupdf-internal.h
@@ -600,7 +600,7 @@ typedef struct pdf_js_event_s
int rc;
} pdf_js_event;
-int pdf_js_suported();
+int pdf_js_supported();
pdf_js *pdf_new_js(pdf_document *doc);
void pdf_drop_js(pdf_js *js);
void pdf_js_load_document_level(pdf_js *js);
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index 33a1a651..6879d12b 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -260,7 +260,8 @@ pdf_load_system_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname, c
pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_KOREA, serif);
else
{
- fz_warn(ctx, "unknown cid collection: %s", collection);
+ if (strcmp(collection, "Adobe-Identity") != 0)
+ fz_warn(ctx, "unknown cid collection: %s", collection);
pdf_load_substitute_font(ctx, fontdesc, fontname, mono, serif, bold, italic);
}
}
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c
index 1acef7df..6a2eab04 100644
--- a/pdf/pdf_interpret.c
+++ b/pdf/pdf_interpret.c
@@ -28,7 +28,7 @@ struct pdf_material_s
pdf_pattern *pattern;
fz_shade *shade;
float alpha;
- float v[32];
+ float v[FZ_MAX_COLORS];
};
struct pdf_gstate_s
diff --git a/pdf/pdf_repair.c b/pdf/pdf_repair.c
index dac02731..44d69b99 100644
--- a/pdf/pdf_repair.c
+++ b/pdf/pdf_repair.c
@@ -419,7 +419,6 @@ pdf_repair_xref(pdf_document *xref, pdf_lexbuf *buf)
pdf_drop_obj(dict);
}
-
}
xref->table[0].type = 'f';
diff --git a/pdf/pdf_write.c b/pdf/pdf_write.c
index a8b56964..98f0dd2e 100644
--- a/pdf/pdf_write.c
+++ b/pdf/pdf_write.c
@@ -1737,6 +1737,14 @@ dowriteobject(pdf_document *xref, pdf_write_options *opts, int num, int pass)
if (xref->table[num].type == 'o')
opts->gen_list[num] = 0;
+ /* If we are renumbering, then make sure all generation numbers are
+ * zero (except object 0 which must be free, and have a gen number of
+ * 65535). Changing the generation numbers (and indeed object numbers)
+ * will break encryption - so only do this if we are renumbering
+ * anyway. */
+ if (opts->do_garbage >= 2)
+ opts->gen_list[num] = (num == 0 ? 65535 : 0);
+
if (opts->do_garbage && !opts->use_list[num])
return;