diff options
author | Igor Melichev <igor.melichev@artifex.com> | 2002-09-15 13:21:09 +0000 |
---|---|---|
committer | Igor Melichev <igor.melichev@artifex.com> | 2002-09-15 13:21:09 +0000 |
commit | b0bd3891bf82bd618edfa5749667ec4fed98183e (patch) | |
tree | 379146e041e3173908d92bd83943f689cb34e14e | |
parent | 4019febeed98076b052b50aed24f7f7920292965 (diff) |
Fix (pdfwrite) : Completely removing the generation of "space chars",
because they can overflow Encoding.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@3039 a1074d23-0009-0410-80fe-cf8c14f379e6
-rw-r--r-- | gs/src/devs.mak | 2 | ||||
-rw-r--r-- | gs/src/gdevpdtf.h | 10 | ||||
-rw-r--r-- | gs/src/gdevpdti.c | 48 | ||||
-rw-r--r-- | gs/src/gdevpdti.h | 6 | ||||
-rw-r--r-- | gs/src/gdevpdts.c | 15 |
5 files changed, 1 insertions, 80 deletions
diff --git a/gs/src/devs.mak b/gs/src/devs.mak index 48faafcc1..c78b80d4b 100644 --- a/gs/src/devs.mak +++ b/gs/src/devs.mak @@ -1023,7 +1023,7 @@ $(GLOBJ)gdevpdti.$(OBJ) : $(GLSRC)gdevpdti.c $(memory__h) $(string__h) $(gx_h)\ $(GLCC) $(GLO_)gdevpdti.$(OBJ) $(C_) $(GLSRC)gdevpdti.c $(GLOBJ)gdevpdts.$(OBJ) : $(GLSRC)gdevpdts.c $(gx_h) $(math__h) $(memory__h)\ - $(gdevpdfx_h) $(gdevpdtf_h) $(gdevpdti_h) $(gdevpdts_h) $(gdevpdtx_h) + $(gdevpdfx_h) $(gdevpdtf_h) $(gdevpdts_h) $(gdevpdtx_h) $(GLCC) $(GLO_)gdevpdts.$(OBJ) $(C_) $(GLSRC)gdevpdts.c $(GLOBJ)gdevpdtt.$(OBJ) : $(GLSRC)gdevpdtt.c $(gx_h) $(math__h) $(string__h)\ diff --git a/gs/src/gdevpdtf.h b/gs/src/gdevpdtf.h index ce2bc5b2e..5053cd6cf 100644 --- a/gs/src/gdevpdtf.h +++ b/gs/src/gdevpdtf.h @@ -222,16 +222,6 @@ struct pdf_font_resource_s { gs_int_rect FontBBox; pdf_char_proc_t *char_procs; int max_y_offset; - /* - * spaces[sp] = ch if character code ch produces a - * space of width sp + X_SPACE_MIN (in device units, - * since this only applies to bitmap fonts). - * The range should be determined by the device - * resolution, but currently it isn't. - */ -/*#define X_SPACE_MIN xxx*/ /* in gdevpdfx.h */ -/*#define X_SPACE_MAX nnn*/ /* in gdevpdfx.h */ - byte spaces[X_SPACE_MAX - X_SPACE_MIN + 1]; } type3; } s; diff --git a/gs/src/gdevpdti.c b/gs/src/gdevpdti.c index 67a39a41c..9f4a48bf3 100644 --- a/gs/src/gdevpdti.c +++ b/gs/src/gdevpdti.c @@ -50,7 +50,6 @@ struct pdf_bitmap_fonts_s { bool use_open_font; /* if false, start new open_font */ long bitmap_encoding_id; int max_embedded_code; /* max Type 3 code used */ - long space_char_ids[X_SPACE_MAX - X_SPACE_MIN + 1]; }; gs_private_st_ptrs1(st_pdf_bitmap_fonts, pdf_bitmap_fonts_t, "pdf_bitmap_fonts_t", pdf_bitmap_fonts_enum_ptrs, @@ -110,7 +109,6 @@ private int write_contents_bitmap(gx_device_pdf *pdev, pdf_font_resource_t *pdfont) { stream *s = pdev->strm; - pdf_bitmap_fonts_t *const pbfs = pdev->text->bitmap_fonts; pprintld1(s, "/Encoding %ld 0 R/CharProcs", pdev->text->bitmap_fonts->bitmap_encoding_id); @@ -118,7 +116,6 @@ write_contents_bitmap(gx_device_pdf *pdev, pdf_font_resource_t *pdfont) /* Write the CharProcs. */ { const pdf_char_proc_t *pcp; - int w; stream_puts(s, "<<"); /* Write real characters. */ @@ -128,14 +125,6 @@ write_contents_bitmap(gx_device_pdf *pdev, pdf_font_resource_t *pdfont) pprintld2(s, "/a%ld\n%ld 0 R", (long)pcp->char_code, pdf_char_proc_id(pcp)); } - /* Write space characters. */ - for (w = 0; w < countof(pdfont->u.simple.s.type3.spaces); ++w) { - byte ch = pdfont->u.simple.s.type3.spaces[w]; - - if (ch) - pprintld2(s, "/a%ld\n%ld 0 R", (long)ch, - pbfs->space_char_ids[w]); - } stream_puts(s, ">>"); } @@ -290,43 +279,6 @@ pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp, } /* - * Assign a code for a given X width in the current font, if needed and - * possible. - */ -int -pdf_space_char(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, int dx) -{ - int dx_i = dx - X_SPACE_MIN; - int code; - - if (dx_i < 0 || dx_i >= countof(pdfont->u.simple.s.type3.spaces)) - return -1; - code = pdfont->u.simple.s.type3.spaces[dx_i]; - if (code == 0) { - if (pdfont != pdev->text->bitmap_fonts->open_font) - return -1; - code = assign_char_code(pdev, dx); - if (code < 0) - return -1; - pdfont->u.simple.s.type3.spaces[dx_i] = (byte)code; - if (pdev->text->bitmap_fonts->space_char_ids[dx_i] == 0) { - /* Create the space char_proc now. */ - char spstr[3 + 14 + 1]; - stream *s; - - sprintf(spstr, "%d 0 0 0 0 0 d1\n", dx); - pdev->text->bitmap_fonts->space_char_ids[dx_i] = - pdf_begin_separate(pdev); - s = pdev->strm; - pprintd1(s, "<</Length %d>>\nstream\n", strlen(spstr)); - pprints1(s, "%sendstream\n", spstr); - pdf_end_separate(pdev); - } - } - return code; -} - -/* * Write the Encoding for bitmap fonts, if needed. */ int diff --git a/gs/src/gdevpdti.h b/gs/src/gdevpdti.h index c88ce31f2..9dd52dffd 100644 --- a/gs/src/gdevpdti.h +++ b/gs/src/gdevpdti.h @@ -68,12 +68,6 @@ int pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp, pdf_bitmap_fonts_t *pdf_bitmap_fonts_alloc(gs_memory_t *mem); /* - * Assign a code for a given X width in the current font, if needed and - * possible. - */ -int pdf_space_char(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, int dx); - -/* * Write the Encoding for bitmap fonts, if needed. */ int pdf_write_bitmap_fonts_Encoding(gx_device_pdf *pdev); diff --git a/gs/src/gdevpdts.c b/gs/src/gdevpdts.c index adee5e8be..3ace1b4f0 100644 --- a/gs/src/gdevpdts.c +++ b/gs/src/gdevpdts.c @@ -22,7 +22,6 @@ #include "gdevpdfx.h" #include "gdevpdtx.h" #include "gdevpdtf.h" /* for pdfont->FontType */ -#include "gdevpdti.h" /* for pdf_space_char */ #include "gdevpdts.h" /* ================ Types and structures ================ */ @@ -176,7 +175,6 @@ add_text_delta_move(gx_device_pdf *pdev, const gs_matrix *pmat) const double precis = 0.001; if (matrix_is_compatible(pmat, &pts->in.matrix)) { - pdf_font_resource_t *const pdfont = pts->in.pdfont; double dx = pmat->tx - pts->in.matrix.tx, dy = pmat->ty - pts->in.matrix.ty; gs_point dist; @@ -189,19 +187,6 @@ add_text_delta_move(gx_device_pdf *pdev, const gs_matrix *pmat) dw = dist.x, dnotw = dist.y; if (dnotw == 0 && any_abs(dw - pts->in.character_spacing) < precis) goto finish; - if (dnotw == 0 && any_abs(dw - (int)dw) < precis && pdfont != 0 && - pdfont->FontType == ft_user_defined - ) { - /* Use a pseudo-character. */ - int code = pdf_space_char(pdev, pdfont, (int)dw); - - if (code >= 0) { - byte space_char = (byte)code; - - pdf_append_chars(pdev, &space_char, 1, dx, dy); - goto finish; - } - } if (dnotw == 0 && pts->buffer.count_chars > 0 && /* * Acrobat Reader limits the magnitude of user-space |