diff options
-rw-r--r-- | apps/pdfclean.c | 10 | ||||
-rw-r--r-- | apps/pdfdraw.c | 6 | ||||
-rw-r--r-- | fitz/filt_pipeline.c | 4 | ||||
-rw-r--r-- | fitz/res_font.c | 28 | ||||
-rw-r--r-- | mupdf/pdf_crypt.c | 12 | ||||
-rw-r--r-- | mupdf/pdf_font.c | 33 | ||||
-rw-r--r-- | mupdf/pdf_fontfile.c | 7 | ||||
-rw-r--r-- | mupdf/pdf_shade.c | 24 | ||||
-rw-r--r-- | mupdf/pdf_type3.c | 16 |
9 files changed, 59 insertions, 81 deletions
diff --git a/apps/pdfclean.c b/apps/pdfclean.c index f3e57ed5..f3f1e202 100644 --- a/apps/pdfclean.c +++ b/apps/pdfclean.c @@ -210,8 +210,10 @@ static void removeduplicateobjs(void) { fz_obj *a, *b; - /* pdf_isstream() calls pdf_cacheobject() and thus - ensures that the objects are in xref afterwards. */ + /* + pdf_isstream calls pdf_cacheobject and ensures + that the xref table has the objects loaded + */ if (num == other || pdf_isstream(xref, num, 0) || pdf_isstream(xref, other, 0)) @@ -271,9 +273,7 @@ static void retainpages(int argc, char **argv) fz_dropobj(pages); fz_dropobj(type); - /* Create a new kids array too add into pages dict - * since each element must be replaced to point to - * a retained page */ + /* Create a new kids array with only the pages we want to keep. */ kids = fz_newarray(1); count = 0; diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c index e0003246..cf2a2d45 100644 --- a/apps/pdfdraw.c +++ b/apps/pdfdraw.c @@ -287,6 +287,12 @@ int main(int argc, char **argv) if (fz_optind == argc) usage(); + if (!showtext && !showxml && !showtime && !showmd5 && !output) + { + printf("nothing to do\n"); + exit(0); + } + if (accelerate) fz_accelerate(); diff --git a/fitz/filt_pipeline.c b/fitz/filt_pipeline.c index 986ca4e7..7df89d0e 100644 --- a/fitz/filt_pipeline.c +++ b/fitz/filt_pipeline.c @@ -116,9 +116,7 @@ tail: else if (e == fz_iodone) { - /* Make sure that the head is also done. - * It may still contain end-of-data markers or garbage. - */ + /* The head may still contain end-of-data markers or garbage */ e = fz_process(p->head, in, p->buffer); if (e != fz_iodone) fz_catch(e, "head filter not done"); diff --git a/fitz/res_font.c b/fitz/res_font.c index 8dc06902..099a849f 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -249,12 +249,13 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm) trm = fz_concat(fz_scale(scale, 1), trm); } - /* freetype mutilates complex glyphs if they are loaded - * with FT_Set_Char_Size 1.0. it rounds the coordinates - * before applying transformation. to get more precision in - * freetype, we shift part of the scale in the matrix - * into FT_Set_Char_Size instead - */ + /* + Freetype mutilates complex glyphs if they are loaded + with FT_Set_Char_Size 1.0. it rounds the coordinates + before applying transformation. to get more precision in + freetype, we shift part of the scale in the matrix + into FT_Set_Char_Size instead + */ m.xx = trm.a * 64; /* should be 65536 */ m.yx = trm.b * 64; @@ -270,13 +271,14 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm) if (font->fthint) { - /* Enable hinting, but keep the huge char size so that - * it is hinted for a character. This will in effect nullify - * the effect of grid fitting. This form of hinting should - * only be used for DynaLab and similar tricky TrueType fonts, - * so that we get the correct outline shape. - */ -#ifdef USE_HINTING + /* + Enable hinting, but keep the huge char size so that + it is hinted for a character. This will in effect nullify + the effect of grid fitting. This form of hinting should + only be used for DynaLab and similar tricky TrueType fonts, + so that we get the correct outline shape. + */ +#ifdef GRIDFIT /* If you really want grid fitting, enable this code. */ float scale = fz_matrixexpansion(trm); m.xx = trm.a * 65536 / scale; diff --git a/mupdf/pdf_crypt.c b/mupdf/pdf_crypt.c index a90c77d0..d679c592 100644 --- a/mupdf/pdf_crypt.c +++ b/mupdf/pdf_crypt.c @@ -17,9 +17,7 @@ pdf_newcrypt(pdf_crypt **cryptp, fz_obj *dict, fz_obj *id) memset(crypt, 0x00, sizeof(pdf_crypt)); crypt->cf = nil; - /* - * Common to all security handlers (PDF 1.7 table 3.18) - */ + /* Common to all security handlers (PDF 1.7 table 3.18) */ obj = fz_dictgets(dict, "Filter"); if (!fz_isname(obj)) @@ -122,9 +120,7 @@ pdf_newcrypt(pdf_crypt **cryptp, fz_obj *dict, fz_obj *id) } } - /* - * Standard security handler (PDF 1.7 table 3.19) - */ + /* Standard security handler (PDF 1.7 table 3.19) */ obj = fz_dictgets(dict, "R"); if (fz_isint(obj)) @@ -167,9 +163,7 @@ pdf_newcrypt(pdf_crypt **cryptp, fz_obj *dict, fz_obj *id) if (fz_isbool(obj)) crypt->encryptmetadata = fz_tobool(obj); - /* - * Extract file identifier string - */ + /* Extract file identifier string */ crypt->idlength = 0; diff --git a/mupdf/pdf_font.c b/mupdf/pdf_font.c index 8b986963..c9f93c88 100644 --- a/mupdf/pdf_font.c +++ b/mupdf/pdf_font.c @@ -259,9 +259,7 @@ loadsimplefont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict) basefont = fz_toname(fz_dictgets(dict, "BaseFont")); fontname = cleanfontname(basefont); - /* - * Load font file - */ + /* Load font file */ fontdesc = pdf_newfontdesc(); @@ -293,9 +291,7 @@ loadsimplefont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict) else fz_setfontbbox(fontdesc->font, bbox.x0, bbox.y0, bbox.x1, bbox.y1); - /* - * Encoding - */ + /* Encoding */ symbolic = fontdesc->flags & 4; @@ -484,9 +480,7 @@ loadsimplefont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict) if (error) goto cleanup; - /* - * Widths - */ + /* Widths */ pdf_setdefaulthmtx(fontdesc, fontdesc->missingwidth); @@ -552,9 +546,7 @@ loadcidfont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *enco fz_obj *obj; int dw; - /* - * Get font name and CID collection - */ + /* Get font name and CID collection */ basefont = fz_toname(fz_dictgets(dict, "BaseFont")); @@ -582,9 +574,7 @@ loadcidfont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *enco fz_strlcat(collection, tmpstr, sizeof collection); } - /* - * Load font file - */ + /* Load font file */ fontdesc = pdf_newfontdesc(); @@ -615,9 +605,7 @@ loadcidfont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *enco else fz_setfontbbox(fontdesc->font, bbox.x0, bbox.y0, bbox.x1, bbox.y1); - /* - * Encoding - */ + /* Encoding */ error = fz_okay; if (fz_isname(encoding)) @@ -707,9 +695,8 @@ loadcidfont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *enco if (error) goto cleanup; - /* - * Horizontal - */ + /* Horizontal */ + dw = 1000; obj = fz_dictgets(dict, "DW"); if (obj) @@ -746,9 +733,7 @@ loadcidfont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *enco pdf_endhmtx(fontdesc); - /* - * Vertical - */ + /* Vertical */ if (pdf_getwmode(fontdesc->encoding) == 1) { diff --git a/mupdf/pdf_fontfile.c b/mupdf/pdf_fontfile.c index 919fe7c3..b325a7ea 100644 --- a/mupdf/pdf_fontfile.c +++ b/mupdf/pdf_fontfile.c @@ -144,9 +144,10 @@ loadsystemcidfont(pdf_fontdesc *fontdesc, int ros, int kind) { #ifndef NOCJK fz_error error; - /* We only have one builtin fallback font, we'd really like - * to have one for each combination of ROS and Kind. - */ + /* + We only have one builtin fallback font. + We'd really like to have one for each combination of ROS and Kind. + */ pdf_logfont("loading builtin CJK font\n"); error = fz_newfontfrombuffer(&fontdesc->font, (unsigned char *)pdf_font_DroidSansFallback_ttf_buf, diff --git a/mupdf/pdf_shade.c b/mupdf/pdf_shade.c index 1e196ce6..74a1cd5a 100644 --- a/mupdf/pdf_shade.c +++ b/mupdf/pdf_shade.c @@ -144,14 +144,16 @@ splitcurve(fz_point *pole, fz_point *q0, fz_point *q1, int polestep) static inline void splitstripe(pdf_tensorpatch *p, pdf_tensorpatch *s0, pdf_tensorpatch *s1) { - /* split all horizontal bezier curves in patch, - * creating two new patches with half the width. */ + /* + split all horizontal bezier curves in patch, + creating two new patches with half the width. + */ splitcurve(&p->pole[0][0], &s0->pole[0][0], &s1->pole[0][0], 4); splitcurve(&p->pole[0][1], &s0->pole[0][1], &s1->pole[0][1], 4); splitcurve(&p->pole[0][2], &s0->pole[0][2], &s1->pole[0][2], 4); splitcurve(&p->pole[0][3], &s0->pole[0][3], &s1->pole[0][3], 4); - /* bilinear interpolation to find color values of corners of the two new patches. */ + /* interpolate the colors for the two new patches. */ memcpy(s0->color[0], p->color[0], sizeof(s0->color[0])); memcpy(s0->color[1], p->color[1], sizeof(s0->color[1])); midcolor(s0->color[2], p->color[1], p->color[2]); @@ -189,14 +191,16 @@ drawstripe(pdf_tensorpatch *p, fz_shade *shade, int depth) static inline void splitpatch(pdf_tensorpatch *p, pdf_tensorpatch *s0, pdf_tensorpatch *s1) { - /* split all vertical bezier curves in patch, - * creating two new patches with half the height. */ + /* + split all vertical bezier curves in patch, + creating two new patches with half the height. + */ splitcurve(p->pole[0], s0->pole[0], s1->pole[0], 1); splitcurve(p->pole[1], s0->pole[1], s1->pole[1], 1); splitcurve(p->pole[2], s0->pole[2], s1->pole[2], 1); splitcurve(p->pole[3], s0->pole[3], s1->pole[3], 1); - /* bilinear interpolation to find color values of corners of the two new patches. */ + /* interpolate the colors for the two new patches. */ memcpy(s0->color[0], p->color[0], sizeof(s0->color[0])); midcolor(s0->color[1], p->color[0], p->color[1]); midcolor(s0->color[2], p->color[2], p->color[3]); @@ -1303,9 +1307,7 @@ pdf_loadshading(fz_shade **shadep, pdf_xref *xref, fz_obj *dict) return fz_okay; } - /* - * Type 2 pattern dictionary - */ + /* Type 2 pattern dictionary */ if (fz_dictgets(dict, "PatternType")) { pdf_logshade("load shading pattern (%d %d R) {\n", fz_tonum(dict), fz_togen(dict)); @@ -1342,9 +1344,7 @@ pdf_loadshading(fz_shade **shadep, pdf_xref *xref, fz_obj *dict) pdf_logshade("}\n"); } - /* - * Naked shading dictionary - */ + /* Naked shading dictionary */ else { error = pdf_loadshadingdict(shadep, xref, dict, fz_identity); diff --git a/mupdf/pdf_type3.c b/mupdf/pdf_type3.c index ddcf0258..3dafe68f 100644 --- a/mupdf/pdf_type3.c +++ b/mupdf/pdf_type3.c @@ -47,9 +47,7 @@ pdf_loadtype3font(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_obj fz_setfontbbox(fontdesc->font, bbox.x0, bbox.y0, bbox.x1, bbox.y1); - /* - * Encoding - */ + /* Encoding */ for (i = 0; i < 256; i++) estrings[i] = nil; @@ -96,9 +94,7 @@ pdf_loadtype3font(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_obj if (error) goto cleanup; - /* - * Widths - */ + /* Widths */ pdf_setdefaulthmtx(fontdesc, 0); @@ -122,9 +118,7 @@ pdf_loadtype3font(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_obj pdf_endhmtx(fontdesc); - /* - * Resources -- inherit page resources if the font doesn't have its own - */ + /* Resources -- inherit page resources if the font doesn't have its own */ fontdesc->font->t3resources = fz_dictgets(dict, "Resources"); if (!fontdesc->font->t3resources) @@ -137,9 +131,7 @@ pdf_loadtype3font(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_obj fontdesc->font->t3xref = xref; fontdesc->font->t3run = pdf_runcontents; - /* - * CharProcs - */ + /* CharProcs */ charprocs = fz_dictgets(dict, "CharProcs"); if (!charprocs) |