FreeBSD Bugzilla – Attachment 39363 Details for
Bug 62078
print/ghostscript-gnu: apply patches to fix CJK PDF handling
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 14.04 KB, created by
KOMATSU Shinichiro
on 2004-01-29 19:40:17 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
KOMATSU Shinichiro
Created:
2004-01-29 19:40:17 UTC
Size:
14.04 KB
patch
obsolete
>diff --exclude=*.log* --exclude=CVS -urN ghostscript-gnu/Makefile ghostscript-gnu.new/Makefile >--- ghostscript-gnu/Makefile Mon Jan 12 23:34:03 2004 >+++ ghostscript-gnu.new/Makefile Fri Jan 30 03:59:36 2004 >@@ -7,7 +7,7 @@ > > PORTNAME= ghostscript > PORTVERSION= ${GS_VERSION} >-PORTREVISION= 5 >+PORTREVISION= 6 > CATEGORIES= print > MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:S/$/:gs_srcs,gprint,bjc250/} \ > http://www.gelhaus.net/hp880c/1.4beta/:hp8xx \ >diff --exclude=*.log* --exclude=CVS -urN ghostscript-gnu/files/patch-lib:gs_cidfn.ps ghostscript-gnu.new/files/patch-lib:gs_cidfn.ps >--- ghostscript-gnu/files/patch-lib:gs_cidfn.ps Thu Jan 1 09:00:00 1970 >+++ ghostscript-gnu.new/files/patch-lib:gs_cidfn.ps Fri Jan 30 03:56:37 2004 >@@ -0,0 +1,51 @@ >+--- lib/gs_cidfn.ps.org 2003-04-12 23:02:38.000000000 +0900 >++++ lib/gs_cidfn.ps 2003-09-03 07:28:28.000000000 +0900 >+@@ -511,9 +511,32 @@ >+ >+ .loadinitialcidfonts >+ >++% <fontname> <font> .RenameFontForNeverEmbed <fontname> <font'> >++/.RenameFontForNeverEmbed { >++ /DEVICE where { pop DEVICE (pdfwrite) eq { >++ currentdistillerparams /NeverEmbed get { >++ 2 index eq { >++ (*** unembeddable CIDFont: ) print 1 index == flush >++ dup length 1 add dict copy >++ dup /FID undef >++ dup /.orig_CIDFontName 1 index /CIDFontName get put >++ dup /CIDFontName 3 index dup type /stringtype eq { >++ dup rcheck { >++ dup length string 0 1 2 index length 1 sub { >++ 2 index 1 index get 3 copy put pop pop >++ } for exch pop >++ } if >++ } if put >++ dup /FontName 1 index /CIDFontName get put >++ } if >++ } forall >++ } if } if >++} bind def >++ >+ /CIDFontmapHandler << >+ /nametype { >+ /CIDFont findresource >++ .RenameFontForNeverEmbed >+ /CIDFont defineresource pop >+ } bind >+ /stringtype { >+@@ -528,6 +551,7 @@ >+ pop pop >+ } { >+ % Give a name different from the name defined in the file >++ .RenameFontForNeverEmbed >+ /CIDFont defineresource pop >+ } ifelse >+ } { >+@@ -546,6 +570,7 @@ >+ 3 -1 roll put >+ % Expand array >+ aload pop .loadcjkvttcidfont >++ .RenameFontForNeverEmbed >+ /CIDFont defineresource pop >+ } { >+ /undefinedresource signalerror >diff --exclude=*.log* --exclude=CVS -urN ghostscript-gnu/files/patch-lib:ps2pdfwr ghostscript-gnu.new/files/patch-lib:ps2pdfwr >--- ghostscript-gnu/files/patch-lib:ps2pdfwr Thu Jan 1 09:00:00 1970 >+++ ghostscript-gnu.new/files/patch-lib:ps2pdfwr Fri Jan 30 03:58:06 2004 >@@ -0,0 +1,173 @@ >+--- lib/ps2pdfwr.org 2003-09-01 18:39:30.000000000 +0900 >++++ lib/ps2pdfwr 2003-09-25 18:39:14.000000000 +0900 >+@@ -31,6 +31,169 @@ >+ outfile="$2" >+ fi >+ >++[ "$NeverEmbedFontList" != "" ] || NeverEmbedFontList=" >++/Courier >++/Courier-Bold >++/Courier-BoldOblique >++/Courier-Oblique >++/Helvetica >++/Helvetica-Bold >++/Helvetica-BoldOblique >++/Helvetica-Oblique >++/Symbol >++/Times-Bold >++/Times-BoldItalic >++/Times-Italic >++/Times-Roman >++/ZapfDingbats >++" >++[ "$AlwaysEmbedFontList" != "" ] || AlwaysEmbedFontList=" >++/AvantGarde-Book >++/AvantGarde-BookOblique >++/AvantGarde-Demi >++/AvantGarde-DemiOblique >++/Bookman-Demi >++/Bookman-DemiItalic >++/Bookman-Light >++/Bookman-LightItalic >++/Helvetica-Narrow >++/Helvetica-Narrow-Bold >++/Helvetica-Narrow-BoldOblique >++/Helvetica-Narrow-Oblique >++/Palatino-Bold >++/Palatino-BoldItalic >++/Palatino-Italic >++/Palatino-Roman >++/ZapfChancery-MediumItalic >++ >++/Arial-BoldItalicMT >++/Arial-BoldMT >++/Arial-ItalicMT >++/ArialMT >++/ArialNarrow >++/ArialNarrow-Bold >++/ArialNarrow-BoldItalic >++/ArialNarrow-Italic >++/BookmanOldStyle >++/BookmanOldStyle-Bold >++/BookmanOldStyle-BoldItalic >++/BookmanOldStyle-Italic >++/CenturyGothic >++/CenturyGothic-Bold >++/CenturyGothic-BoldItalic >++/CenturyGothic-Italic >++/CourierNewPS-BoldItalicMT >++/CourierNewPS-BoldMT >++/CourierNewPS-ItalicMT >++/CourierNewPSMT >++/NewCenturySchlbk-Bold >++/NewCenturySchlbk-BoldItalic >++/NewCenturySchlbk-Italic >++/NewCenturySchlbk-Roman >++/PalatinoLinotype-Bold >++/PalatinoLinotype-BoldItalic >++/PalatinoLinotype-Italic >++/PalatinoLinotype-Roman >++/TimesNewRomanPS-BoldItalicMT >++/TimesNewRomanPS-BoldMT >++/TimesNewRomanPS-ItalicMT >++/TimesNewRomanPSMT >++" >++[ "$NeverEmbedCIDFontList" != "" ] || NeverEmbedCIDFontList=" >++/MSung-Light >++/MSung-Medium >++/MHei-Medium >++/MKai-Medium >++/STSong-Light >++/STFangsong-Light >++/STHeiti-Regular >++/STKaiti-Regular >++/Ryumin-Light >++/GothicBBB-Medium >++/HeiseiMin-W3 >++/HeiseiKakuGo-W5 >++/KozMin-Regular >++/HYGoThic-Medium >++/HYGungSo-Bold >++/HYKHeadLine-Bold >++/HYKHeadLine-Medium >++/HYSMyeongJo-Medium >++/HYRGoThic-Medium >++ >++/MOEKai-Regular >++/MOESung-Regular >++/WadaGo-Bold >++/WadaMaruGo-Regular >++/WadaMaruGo-RegularH >++/WadaMin-Bold >++/WadaMin-Regular >++/WadaMin-RegularH >++/Munhwa-Bold >++/Munhwa-Regular >++/MunhwaGothic-Bold >++/MunhwaGothic-Regular >++/MunhwaGungSeo-Bold >++/MunhwaGungSeo-Light >++/MunhwaGungSeoHeulim-Bold >++/MunhwaGungSeoHeulim-Light >++/MunhwaHoonMin-Regular >++ >++/MingLiU >++/PMingLiU >++/SimHei >++/SimSun >++/NSimSun >++/HGGothicE >++/HGGothicEPRO >++/HGGothicM >++/HGGyoshotai >++/HGMarugothicMPRO >++/HGPGothicE >++/HGPGothicM >++/HGPGyoshotai >++/HGPSoeiKakugothicUB >++/HGPSoeiKakupoptai >++/HGSGothicE >++/HGSGothicM >++/HGSGyoshotai >++/HGSSoeiKakugothicUB >++/HGSSoeiKakupoptai >++/HGSeikaishotaiPRO >++/HGSoeiKakugothicUB >++/HGSoeiKakupoptai >++/Kochi-Gothic >++/Kochi-Mincho >++/MojikumiKata-EB >++/Mona >++/MS-Mincho >++/MS-PMincho >++/MS-Gothic >++/MS-PGothic >++/MS-UIGothic >++/Batang >++/BatangChe >++/Gungsuh >++/GungsuhChe >++/Gulim >++/GulimChe >++/Dotum >++/DotumChe >++/New-Gulim >++ >++/MHei-Medium-Acro >++/MSung-Light-Acro >++/STSong-Light-Acro >++/HeiseiKakuGo-W5-Acro >++/HeiseiMin-W3-Acro >++/HYGoThic-Medium-Acro >++/HYSMyeongJo-Medium-Acro >++" >++[ "$AlwaysEmbedCIDFontList" != "" ] || AlwaysEmbedCIDFontList=" >++/SimSun-18030-Adobe-CNS1 >++/NSimSun-18030-Adobe-CNS1 >++/SimSun-18030 >++/NSimSun-18030 >++" >+ # We have to include the options twice because -I only takes effect if it >+ # appears before other options. >+-exec gs $OPTIONS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "-sOutputFile=$outfile" $OPTIONS -c .setpdfwrite -f "$infile" >++exec gs $OPTIONS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "-sOutputFile=$outfile" $OPTIONS -c ".setpdfwrite <</NeverEmbed [$NeverEmbedFontList $NeverEmbedCIDFontList] /AlwaysEmbed [$AlwaysEmbedFontList $AlwaysEmbedCIDFontList]>> setdistillerparams" -f "$infile" >diff --exclude=*.log* --exclude=CVS -urN ghostscript-gnu/files/patch-src:gdevpdff.c ghostscript-gnu.new/files/patch-src:gdevpdff.c >--- ghostscript-gnu/files/patch-src:gdevpdff.c Thu Jan 1 09:00:00 1970 >+++ ghostscript-gnu.new/files/patch-src:gdevpdff.c Fri Jan 30 03:55:16 2004 >@@ -0,0 +1,59 @@ >+--- src/gdevpdff.c.org 2003-01-17 09:49:02.000000000 +0900 >++++ src/gdevpdff.c 2003-09-21 05:08:36.000000000 +0900 >+@@ -276,6 +276,11 @@ >+ const byte *chars = font->font_name.chars; >+ uint size = font->font_name.size; >+ >++ /* CIDFonts has null string in font_name, key_name is used */ >++ if (0 == size) { >++ chars = font->key_name.chars; >++ size = font->key_name.size; >++ } >+ /* >+ * The behavior of Acrobat Distiller changed between 3.0 (PDF 1.2), >+ * which will never embed the base 14 fonts, and 4.0 (PDF 1.3), which >+@@ -720,19 +725,22 @@ >+ same &= ~FONT_SAME_METRICS; >+ break; >+ case FONT_EMBED_NO: >+- /* >+- * Per the PDF 1.3 documentation, there are only 3 BaseEncoding >+- * values allowed for non-embedded fonts. Pick one here. >+- */ >+- BaseEncoding = >+- ((const gs_font_base *)base_font)->nearest_encoding_index; >+- switch (BaseEncoding) { >+- default: >+- BaseEncoding = ENCODING_INDEX_WINANSI; >+- case ENCODING_INDEX_WINANSI: >+- case ENCODING_INDEX_MACROMAN: >+- case ENCODING_INDEX_MACEXPERT: >+- break; >++ if (!(font->FontType == ft_CID_encrypted || >++ font->FontType == ft_CID_TrueType)) { >++ /* >++ * Per the PDF 1.3 documentation, there are only 3 BaseEncoding >++ * values allowed for non-embedded fonts. Pick one here. >++ */ >++ BaseEncoding = >++ ((const gs_font_base *)base_font)->nearest_encoding_index; >++ switch (BaseEncoding) { >++ default: >++ BaseEncoding = ENCODING_INDEX_WINANSI; >++ case ENCODING_INDEX_WINANSI: >++ case ENCODING_INDEX_MACROMAN: >++ case ENCODING_INDEX_MACEXPERT: >++ break; >++ } >+ } >+ code = pdf_compute_font_descriptor(pdev, &fdesc, font, NULL); >+ if (code < 0) >+@@ -888,6 +896,7 @@ >+ memcpy(ppf->widths_known, ftemp_widths_known, >+ sizeof(ftemp_widths_known)); >+ } >++ ppf->embed = embed; >+ code = pdf_register_font(pdev, font, ppf); >+ >+ *pppf = ppf; >+ >diff --exclude=*.log* --exclude=CVS -urN ghostscript-gnu/files/patch-src:gdevpdff.h ghostscript-gnu.new/files/patch-src:gdevpdff.h >--- ghostscript-gnu/files/patch-src:gdevpdff.h Thu Jan 1 09:00:00 1970 >+++ ghostscript-gnu.new/files/patch-src:gdevpdff.h Fri Jan 30 03:54:44 2004 >@@ -0,0 +1,37 @@ >+--- src/gdevpdff.h.org 2003-01-17 09:49:02.000000000 +0900 >++++ src/gdevpdff.h 2003-09-18 23:42:38.000000000 +0900 >+@@ -117,6 +117,12 @@ >+ FONT_SUBSET_NO >+ } pdf_font_do_subset_t; >+ >++typedef enum { >++ FONT_EMBED_STANDARD, /* 14 standard fonts */ >++ FONT_EMBED_NO, >++ FONT_EMBED_YES >++} pdf_font_embed_t; >++ >+ struct pdf_font_descriptor_s { >+ pdf_resource_common(pdf_font_descriptor_t); >+ pdf_font_name_t FontName; >+@@ -198,6 +204,7 @@ >+ gs_font *font; /* non-0 iff font will notify us; */ >+ /* should be a weak pointer */ >+ int index; /* in pdf_standard_fonts, -1 if not base 14 */ >++ pdf_font_embed_t embed; /* status of pdf_font_embed_status() */ >+ gs_matrix orig_matrix; /* FontMatrix of unscaled font for embedding */ >+ bool is_MM_instance; /* for Type 1/2 fonts, true iff the font */ >+ /* is a Multiple Master instance */ >+@@ -320,12 +327,6 @@ >+ >+ /* ---------------- Exported by gdevpdff.c ---------------- */ >+ >+-typedef enum { >+- FONT_EMBED_STANDARD, /* 14 standard fonts */ >+- FONT_EMBED_NO, >+- FONT_EMBED_YES >+-} pdf_font_embed_t; >+- >+ typedef struct pdf_standard_font_s { >+ const char *fname; >+ gs_encoding_index_t base_encoding; >+ >diff --exclude=*.log* --exclude=CVS -urN ghostscript-gnu/files/patch-src:gdevpdfs.c ghostscript-gnu.new/files/patch-src:gdevpdfs.c >--- ghostscript-gnu/files/patch-src:gdevpdfs.c Thu Jan 1 09:00:00 1970 >+++ ghostscript-gnu.new/files/patch-src:gdevpdfs.c Fri Jan 30 03:56:00 2004 >@@ -0,0 +1,41 @@ >+--- src/gdevpdfs.c.org 2003-09-20 00:11:16.000000000 +0900 >++++ src/gdevpdfs.c 2003-09-25 17:44:10.000000000 +0900 >+@@ -481,15 +481,21 @@ >+ >+ if (cid < pfd->chars_count) { >+ int index = cid >> 3, mask = 0x80 >> (cid & 7); >++ int gid; >++ >++ if (!(pfd->chars_used.data[index] & mask) || >++ !(psubf->widths_known[index] & mask)) { >+ >+- if (!(pfd->chars_used.data[index] & mask)) { >+- pfd->chars_used.data[index] |= mask; >+ if (psubf->CIDToGIDMap) { >+ gs_font_cid2 *const subfont2 = >+ (gs_font_cid2 *)subfont; >+- int gid = >+- subfont2->cidata.CIDMap_proc(subfont2, glyph); >+ >++ gid = subfont2->cidata.CIDMap_proc(subfont2, glyph); >++ } >++ } >++ if (!(pfd->chars_used.data[index] & mask)) { >++ pfd->chars_used.data[index] |= mask; >++ if (psubf->CIDToGIDMap) { >+ if (gid >= 0) { >+ psubf->CIDToGIDMap[cid] = gid; >+ mark_glyphs_used(subfont, gid + gs_min_cid_glyph, >+@@ -500,7 +506,11 @@ >+ if (!(psubf->widths_known[index] & mask)) { >+ int width; >+ >+- code = pdf_glyph_width(psubf, glyph, subfont, &width); >++ if (psubf->CIDToGIDMap) >++ code = pdf_glyph_width(psubf, gid + gs_min_cid_glyph, >++ subfont, &width); >++ else >++ code = pdf_glyph_width(psubf, glyph, subfont, &width); >+ if (code == 0) { >+ psubf->Widths[cid] = width; >+ psubf->widths_known[index] |= mask; >diff --exclude=*.log* --exclude=CVS -urN ghostscript-gnu/files/patch-src:gdevpdfw.c ghostscript-gnu.new/files/patch-src:gdevpdfw.c >--- ghostscript-gnu/files/patch-src:gdevpdfw.c Thu Jan 1 09:00:00 1970 >+++ ghostscript-gnu.new/files/patch-src:gdevpdfw.c Fri Jan 30 03:55:43 2004 >@@ -0,0 +1,60 @@ >+--- src/gdevpdfw.c.org 2003-01-17 09:49:02.000000000 +0900 >++++ src/gdevpdfw.c 2003-09-25 17:50:54.000000000 +0900 >+@@ -348,18 +348,19 @@ >+ /* Use the most common width as DW. */ >+ >+ { >+- ushort counts[1001]; >++ ushort counts[1500*2]; /* histogram of (-1500..1500) */ >+ int dw_count = 0, i; >+ >+ memset(counts, 0, sizeof(counts)); >+ while (!psf_enumerate_glyphs_next(&genum, &glyph)) { >+- int width = ppf->Widths[glyph - gs_min_cid_glyph]; >++ int cid = glyph - gs_min_cid_glyph; >++ int width = ppf->Widths[cid]; >+ >+- counts[min(width, countof(counts) - 1)]++; >++ counts[max(0,min(width+countof(counts)/2,countof(counts)-1))]++; >+ } >+- for (i = 0; i < countof(counts); ++i) >++ for (i = 0; i < countof(counts); i++) >+ if (counts[i] > dw_count) >+- dw = i, dw_count = counts[i]; >++ dw = i - countof(counts)/2, dw_count = counts[i]; >+ if (dw != 0) >+ pprintd1(s, "/DW %d\n", dw); >+ } >+@@ -496,14 +497,16 @@ >+ if (pdf_has_subset_prefix(chars, size)) >+ chars += SUBSET_PREFIX_SIZE, size -= SUBSET_PREFIX_SIZE; >+ pdf_put_name(pdev, chars, size); >+- if (pef->sub_font_type == ft_CID_encrypted && >++ if ((pef->sub_font_type == ft_CID_encrypted || >++ pef->sub_font_type == ft_CID_TrueType) && >+ pef->cmapname[0] == '/' >+ ) { >+ stream_putc(s, '-'); >+ pdf_put_name_chars(pdev, (const byte*) (pef->cmapname + 1), >+ strlen(pef->cmapname + 1)); >+ } >+- pprints1(s, "/Encoding %s", pef->cmapname); >++ pprints1(s, (pef->cmapname[0] == '/') ? "/Encoding%s" : "/Encoding %s", >++ pef->cmapname); >+ pprintld1(s, "/DescendantFonts[%ld 0 R]", >+ pdf_resource_id((const pdf_resource_t *)pef->DescendantFont)); >+ write_Widths = 0; >+@@ -563,8 +566,10 @@ >+ break; >+ case -1: >+ pdf_write_CIDFont_widths(pdev, pef); >+- if (pef->FontType == ft_CID_TrueType) >+- pdf_write_CIDToGIDMap(pdev, pef, &cidmap_id); >++ if (pef->FontType == ft_CID_TrueType) { >++ if (pef->embed != FONT_EMBED_NO) >++ pdf_write_CIDToGIDMap(pdev, pef, &cidmap_id); >++ } >+ break; >+ } >+ if (pef->Differences) { >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 62078
: 39363