[gs-cvs] gs/src
Igor Melichev
igor at ghostscript.com
Thu Mar 3 05:21:32 PST 2005
Update of /cvs/ghostscript/gs/src
In directory casper2:/tmp/cvs-serv31753/gs/src
Modified Files:
Tag: GS_8_1X
gdevpdtc.c gdevpdte.c
Log Message:
pdfwrite : Use character codes instead CIDs when creating a ToUnicode CMap.
DETAILS :
Bug 687954 "copy and pasting asian text problems".
The problem depends on what a Postscript printer driver
puts into the GlyphNames2Unicode table.
GlyphNames2Unicode is an undocumented feature, which PScript5.dll uses to
communicate with Adobe Distiller. A long ago from its name
we concluded that it maps character names to Unicode, and it was
confirmed with multiple documents. Now we got a document
(the test case of the bug 687954), which uses character codes instead CIDs,
(CIDs are usually interpreted as "glyph names" in the case of CID fonts).
In the test document CIDs are not equal to character codes due to the embedded CMap
named WinCharSetFFFF-H2. We did not notice this problem before
due to most old documents from PScript5.dll use an identity CMap WinCharSetFFFF-H,
Now we change Ghostscript with using character codes instead CIDs
as keys to GlyphNames2Unicode. We have no technology for a regression test
of the related behavior. We will pass this revision to users in order to study
consequences of this patch from users' responses.
EXPECTED DIFFERENCES :
None.
Index: gdevpdtc.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdtc.c,v
retrieving revision 1.17.2.7
retrieving revision 1.17.2.8
diff -u -d -r1.17.2.7 -r1.17.2.8
--- gdevpdtc.c 20 Oct 2004 17:00:37 -0000 1.17.2.7
+++ gdevpdtc.c 3 Mar 2005 13:21:30 -0000 1.17.2.8
@@ -387,15 +387,21 @@
code = pdf_obtain_cidfont_widths_arrays(pdev, pdsubf, wmode, &w, &w0, &v);
if (code < 0)
return code;
- unicode_char = subfont->procs.decode_glyph(subfont, glyph);
- if (unicode_char != GS_NO_CHAR) {
+ {
pdf_font_resource_t *pdfont;
code = pdf_obtain_parent_type0_font_resource(pdev, pdsubf,
&font->data.CMap->CMapName, &pdfont);
if (code < 0)
return code;
- code = pdf_add_ToUnicode(pdev, subfont, pdfont, glyph, cid);
+ if (pdf_is_CID_font(subfont)) {
+ /* Since PScript5.dll creates GlyphNames2Unicode with character codes
+ instead CIDs, and with the WinCharSetFFFF-H2 CMap
+ character codes appears different than CIDs (Bug 687954),
+ pass the character code intead the CID. */
+ code = pdf_add_ToUnicode(pdev, subfont, pdfont, chr + GS_MIN_CID_GLYPH, chr);
+ } else
+ code = pdf_add_ToUnicode(pdev, subfont, pdfont, glyph, cid);
if (code < 0)
return code;
}
Index: gdevpdte.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdte.c,v
retrieving revision 1.33.2.18
retrieving revision 1.33.2.19
diff -u -d -r1.33.2.18 -r1.33.2.19
--- gdevpdte.c 24 Jan 2005 16:12:56 -0000 1.33.2.18
+++ gdevpdte.c 3 Mar 2005 13:21:30 -0000 1.33.2.19
@@ -102,9 +102,18 @@
num_codes = pfcid->cidata.common.CIDCount;
key_size = 2;
} else if (font->FontType == ft_CID_TrueType) {
+#if 0
gs_font_cid2 *pfcid = (gs_font_cid2 *)font;
num_codes = pfcid->cidata.common.CIDCount;
+#else
+ /* Since PScript5.dll creates GlyphNames2Unicode with character codes
+ instead CIDs, and with the WinCharSetFFFF-H2 CMap
+ character codes appears from the range 0-0xFFFF (Bug 687954),
+ we must use the maximal character code value for the ToUnicode
+ code count. */
+ num_codes = 65536;
+#endif
key_size = 2;
}
code = gs_cmap_ToUnicode_alloc(pdev->pdf_memory, pdfont->rid, num_codes, key_size,
More information about the gs-cvs
mailing list