diff options
author | Sam James <sam@gentoo.org> | 2022-03-29 10:27:10 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-04-17 12:53:05 +0100 |
commit | 085bde903b9e684c3c1160e4df912bea9a660997 (patch) | |
tree | c4f5e6e9f2422e869ca5bc0b944520d451001282 /devices/vector/gdevpdte.c | |
parent | Import Ghostscript 9.55 (diff) | |
download | ghostscript-gpl-patches-085bde903b9e684c3c1160e4df912bea9a660997.tar.gz ghostscript-gpl-patches-085bde903b9e684c3c1160e4df912bea9a660997.tar.bz2 ghostscript-gpl-patches-085bde903b9e684c3c1160e4df912bea9a660997.zip |
Import Ghostscript 9.56.0ghostscript-9.56
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'devices/vector/gdevpdte.c')
-rw-r--r-- | devices/vector/gdevpdte.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/devices/vector/gdevpdte.c b/devices/vector/gdevpdte.c index 592205fd..5e50d2cf 100644 --- a/devices/vector/gdevpdte.c +++ b/devices/vector/gdevpdte.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -485,14 +485,14 @@ pdf_encode_string_element(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_ : *gdata); if (glyph == GS_NO_GLYPH || glyph == pet->glyph) { if((pdfont->cmap_ToUnicode == NULL || !gs_cmap_ToUnicode_check_pair(pdfont->cmap_ToUnicode, ch)) && pdev->UseOCR != UseOCRNever) - (void)pdf_add_ToUnicode(pdev, font, pdfont, glyph, ch, &gnstr); + (void)pdf_add_ToUnicode(pdev, font, pdfont, glyph, ch, NULL); return 0; } if (pet->glyph != GS_NO_GLYPH) { /* encoding conflict */ return_error(gs_error_rangecheck); /* Must not happen because pdf_obtain_font_resource - * checks for encoding compatibility. - */ + * checks for encoding compatibility. + */ } code = font->procs.glyph_name(font, glyph, &gnstr); if (code < 0) @@ -547,13 +547,13 @@ pdf_encode_string_element(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_ /* PS font has no such glyph. */ if (bytes_compare(gnstr.data, gnstr.size, (const byte *)".notdef", 7)) { pet->glyph = glyph; - pet->str = gnstr; + pdf_copy_string_to_encoding(pdev, &gnstr, pet); pet->is_difference = true; } } else if (pdfont->base_font == NULL && ccfont != NULL && (gs_copy_glyph_options(font, glyph, (gs_font *)ccfont, COPY_GLYPH_NO_NEW) != 1 || gs_copied_font_add_encoding((gs_font *)ccfont, ch, glyph) < 0)) { - /* + /* * The "complete" copy of the font appears incomplete * due to incrementally added glyphs. Drop the "complete" * copy now and continue with subset font only. @@ -566,7 +566,7 @@ pdf_encode_string_element(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_ * We also check whether the encoding is compatible. * It must be compatible here due to the pdf_obtain_font_resource * and ccfont logics, but we want to ensure for safety reason. - */ + */ ccfont = NULL; pdf_font_descriptor_drop_complete_font(pdfont->FontDescriptor); } @@ -584,16 +584,15 @@ pdf_encode_string_element(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_ pdfont->used[ch >> 3] |= 0x80 >> (ch & 7); } /* - * We always generate ToUnicode for simple fonts, because - * we can't detemine in advance, which glyphs the font actually uses. - * The decision about writing it out is deferred until pdf_write_font_resource. - */ + * We always generate ToUnicode for simple fonts, because + * we can't detemine in advance, which glyphs the font actually uses. + * The decision about writing it out is deferred until pdf_write_font_resource. + */ code = pdf_add_ToUnicode(pdev, font, pdfont, glyph, ch, &gnstr); if(code < 0) return code; pet->glyph = glyph; - pet->str = gnstr; - return 0; + return pdf_copy_string_to_encoding(pdev, &gnstr, pet); } /* @@ -725,7 +724,10 @@ process_text_estimate_bbox(pdf_text_enum_t *pte, gs_font_base *font, return code; } if (pte->text.operation & TEXT_REPLACE_WIDTHS) { - gs_text_replaced_width(&pte->text, xy_index++, &tpt); + code = gs_text_replaced_width(&pte->text, xy_index++, &tpt); + if (code < 0) + return code; + gs_distance_transform(tpt.x, tpt.y, &ctm_only(pte->pgs), &wanted); } else { gs_distance_transform(info.width[WMode].x, |