summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMamoru Komachi <usata@gentoo.org>2005-04-23 14:36:34 +0000
committerMamoru Komachi <usata@gentoo.org>2005-04-23 14:36:34 +0000
commit6429cb088cfd3a5d72d1b15bfc338e94bec0a378 (patch)
tree36f0f0ee72e3b4f3d6bae1e9bd5bc89019fe2fe0 /app-text
parentnew version (diff)
downloadhistorical-6429cb088cfd3a5d72d1b15bfc338e94bec0a378.tar.gz
historical-6429cb088cfd3a5d72d1b15bfc338e94bec0a378.tar.bz2
historical-6429cb088cfd3a5d72d1b15bfc338e94bec0a378.zip
Removed problematic entries from CIDFnmap.CJK. Added patches for better CJK handling. This closes bug #90009.
Package-Manager: portage-2.0.51.19
Diffstat (limited to 'app-text')
-rw-r--r--app-text/ghostscript/ChangeLog14
-rw-r--r--app-text/ghostscript/Manifest48
-rw-r--r--app-text/ghostscript/files/digest-ghostscript-7.07.1-r93
-rw-r--r--app-text/ghostscript/files/ghostscript-7.07-bigposttable.patch34
-rw-r--r--app-text/ghostscript/files/ghostscript-7.07-coverage-glyphcount.patch84
-rw-r--r--app-text/ghostscript/files/ghostscript-7.07-fix_cidfontname_Encoding_CIDToGIDMap_DW_W.patch194
-rw-r--r--app-text/ghostscript/files/ghostscript-7.07-fix_rename_font_gs_cidfn.ps.patch51
-rw-r--r--app-text/ghostscript/files/ghostscript-7.07-gsublookuptable.patch114
-rw-r--r--app-text/ghostscript/files/gs7.07.1-cjk.diff172
-rw-r--r--app-text/ghostscript/ghostscript-7.07.1-r9.ebuild187
10 files changed, 880 insertions, 21 deletions
diff --git a/app-text/ghostscript/ChangeLog b/app-text/ghostscript/ChangeLog
index 4b996b55a0e9..e261c0f23bd4 100644
--- a/app-text/ghostscript/ChangeLog
+++ b/app-text/ghostscript/ChangeLog
@@ -1,6 +1,18 @@
# ChangeLog for app-text/ghostscript
# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-text/ghostscript/ChangeLog,v 1.104 2005/04/18 16:54:53 hansmi Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-text/ghostscript/ChangeLog,v 1.105 2005/04/23 14:36:34 usata Exp $
+
+*ghostscript-7.07.1-r9 (23 Apr 2005)
+
+ 23 Apr 2005; Mamoru KOMACHI <usata@gentoo.org>
+ +files/ghostscript-7.07-bigposttable.patch,
+ +files/ghostscript-7.07-coverage-glyphcount.patch,
+ +files/ghostscript-7.07-fix_cidfontname_Encoding_CIDToGIDMap_DW_W.patch,
+ +files/ghostscript-7.07-fix_rename_font_gs_cidfn.ps.patch,
+ +files/gs7.07.1-cjk.diff, +files/ghostscript-7.07-gsublookuptable.patch,
+ +ghostscript-7.07.1-r9.ebuild:
+ Removed problematic entries from CIDFnmap.CJK. Added patches for better CJK
+ handling. This closes bug #90009.
18 Apr 2005; Michael Hanselmann <hansmi@gentoo.org>
ghostscript-7.07.1-r8.ebuild:
diff --git a/app-text/ghostscript/Manifest b/app-text/ghostscript/Manifest
index 17f3c142b630..6063a3cdd9b6 100644
--- a/app-text/ghostscript/Manifest
+++ b/app-text/ghostscript/Manifest
@@ -1,27 +1,35 @@
-MD5 7fd4dfbfa9ce4a9349364cba6f1384ec ghostscript-7.05.6-r2.ebuild 2936
+MD5 af21206c14eb6b58b5595b3e51c94f2a ghostscript-7.07.1-r9.ebuild 5860
+MD5 6e8af02a323f6f61f488aa5b05ab8ee9 ChangeLog 17048
MD5 26b4b081d538c195dc39bcb2ec8e6f3a metadata.xml 161
-MD5 f7e5921a869da1105a18bef0ca16233a ChangeLog 16504
MD5 ed96d26acb65498d1129fb1066d36bcd ghostscript-7.07.1-r8.ebuild 5476
+MD5 7fd4dfbfa9ce4a9349364cba6f1384ec ghostscript-7.05.6-r2.ebuild 2936
MD5 566fe86c5f5d7d8809e383b1430e26af ghostscript-7.07.1-r7.ebuild 4273
-MD5 3d1cdf07dabc4a05bde9a2dc6f7da2de files/gs7.07.1-fontconfig-rh.patch.bz2 6121
-MD5 0cb94835c5d49c5eeeba6e11b2cd65ed files/gs7.07.1-fontconfig-rh.patch.2.bz2 6113
-MD5 92fa24960f2c7802749ce6908aeaf60d files/gs7.07.1-nogtk2.patch 1419
-MD5 291c8895063b8ecee12b68d45a705ab4 files/gs7.05-gdevhl12.c.bz2 7406
-MD5 d3f26c93b9fb75b509c375cbf841da9a files/gs7.05.6-tempfile.patch 2763
-MD5 b7ca313a24a8adf4c527c0a097354f60 files/digest-ghostscript-7.07.1-r8 212
-MD5 06fe485954243190f4f0f4d8e1542f92 files/gs7.07.1-cjk.diff.bz2 3055
-MD5 8c6a3d7e8897b4297ef853dbd89e408b files/gs-fix-gc.patch 5627
-MD5 fd34b2b7a029f19eab4ba3f69afe295e files/ghostscript-7.05.6.man.patch 1231
-MD5 1d5618d793799f7247d624ced0dea493 files/gs7.07.1-tempfile.patch 3123
-MD5 370d4bcd16d8acd03190ba84e2f61a41 files/gs7.07.1-ijsdestdir.patch 1418
-MD5 212a5ece7d789ef9d04e15fd7d36eea3 files/gs-osx-unix-dll.patch 1930
MD5 5f1b04ca58928a339b749703e067e2ba files/gs7.05.6-kochi-substitute.patch 3774
-MD5 343b6a60e15e35d0c5f825b4f361fd29 files/gs7.05.6-cjk.diff.bz2 3287
-MD5 51736590c7ec64f9029fa9524e1ab50c files/gs7.07.1-destdir.patch 12261
-MD5 b7ca313a24a8adf4c527c0a097354f60 files/digest-ghostscript-7.07.1-r7 212
-MD5 acda8ddfde1efeaf451cb28a67dcc773 files/gs7.07.1-krgb.patch.gz 5569
-MD5 ac6af6bf67095500ea043aea27062d62 files/gs7.07.1-ijs.patch 401
MD5 186fc94fd3208e808026580e7436dbdc files/gs-osx-ijs.patch 1566
-MD5 68fa21d11a860c222c8ba89c39ce578e files/gs7.05.6-gdevpx.patch 402
MD5 b2ca914ffcff3e5296d6b5acc7fac182 files/gs7.07.1-ps2ps.patch 244
+MD5 fd34b2b7a029f19eab4ba3f69afe295e files/ghostscript-7.05.6.man.patch 1231
+MD5 68fa21d11a860c222c8ba89c39ce578e files/gs7.05.6-gdevpx.patch 402
+MD5 ac6af6bf67095500ea043aea27062d62 files/gs7.07.1-ijs.patch 401
+MD5 8c6a3d7e8897b4297ef853dbd89e408b files/gs-fix-gc.patch 5627
+MD5 212a5ece7d789ef9d04e15fd7d36eea3 files/gs-osx-unix-dll.patch 1930
+MD5 acda8ddfde1efeaf451cb28a67dcc773 files/gs7.07.1-krgb.patch.gz 5569
+MD5 b37c0dc9f85205da6e8675d4a8bfd21a files/ghostscript-7.07-gsublookuptable.patch 3808
+MD5 16ff6a37a0a334e97f712d8ed530ec6c files/gs7.07.1-cjk.diff 7264
+MD5 291c8895063b8ecee12b68d45a705ab4 files/gs7.05-gdevhl12.c.bz2 7406
+MD5 343b6a60e15e35d0c5f825b4f361fd29 files/gs7.05.6-cjk.diff.bz2 3287
+MD5 3d1cdf07dabc4a05bde9a2dc6f7da2de files/gs7.07.1-fontconfig-rh.patch.bz2 6121
MD5 6807c3b6025d5b09e8eb6349769162d1 files/digest-ghostscript-7.05.6-r2 212
+MD5 b7ca313a24a8adf4c527c0a097354f60 files/digest-ghostscript-7.07.1-r9 212
+MD5 b7ca313a24a8adf4c527c0a097354f60 files/digest-ghostscript-7.07.1-r7 212
+MD5 b7ca313a24a8adf4c527c0a097354f60 files/digest-ghostscript-7.07.1-r8 212
+MD5 d3f26c93b9fb75b509c375cbf841da9a files/gs7.05.6-tempfile.patch 2763
+MD5 06fe485954243190f4f0f4d8e1542f92 files/gs7.07.1-cjk.diff.bz2 3055
+MD5 51736590c7ec64f9029fa9524e1ab50c files/gs7.07.1-destdir.patch 12261
+MD5 0cb94835c5d49c5eeeba6e11b2cd65ed files/gs7.07.1-fontconfig-rh.patch.2.bz2 6113
+MD5 370d4bcd16d8acd03190ba84e2f61a41 files/gs7.07.1-ijsdestdir.patch 1418
+MD5 92fa24960f2c7802749ce6908aeaf60d files/gs7.07.1-nogtk2.patch 1419
+MD5 1d5618d793799f7247d624ced0dea493 files/gs7.07.1-tempfile.patch 3123
+MD5 f834d056ca972c457a2ff3b1e839e562 files/ghostscript-7.07-bigposttable.patch 1257
+MD5 55146a1eafc4ad3a26d99121ae0777fe files/ghostscript-7.07-coverage-glyphcount.patch 3100
+MD5 e0da7576378dc87fa53a16dfd1774789 files/ghostscript-7.07-fix_rename_font_gs_cidfn.ps.patch 1611
+MD5 c73ad916d49df447de59358ffdc495eb files/ghostscript-7.07-fix_cidfontname_Encoding_CIDToGIDMap_DW_W.patch 6462
diff --git a/app-text/ghostscript/files/digest-ghostscript-7.07.1-r9 b/app-text/ghostscript/files/digest-ghostscript-7.07.1-r9
new file mode 100644
index 000000000000..86d2854e2bfc
--- /dev/null
+++ b/app-text/ghostscript/files/digest-ghostscript-7.07.1-r9
@@ -0,0 +1,3 @@
+MD5 d30bf5c09f2c7caa8291f6305cf03044 espgs-7.07.1-source.tar.bz2 5400198
+MD5 a3bf430a7e21cd82401258a2ec3b8afb adobe-cmaps-200204.tar.gz 4360486
+MD5 2fbae60417d42779f6488ab897dcaaf6 acro5-cmaps-2001.tar.gz 631653
diff --git a/app-text/ghostscript/files/ghostscript-7.07-bigposttable.patch b/app-text/ghostscript/files/ghostscript-7.07-bigposttable.patch
new file mode 100644
index 000000000000..bfd670abf4c4
--- /dev/null
+++ b/app-text/ghostscript/files/ghostscript-7.07-bigposttable.patch
@@ -0,0 +1,34 @@
+diff -ruN ghostscript-7.07.orig/lib/gs_ttf.ps ghostscript-7.07/lib/gs_ttf.ps
+--- ghostscript-7.07.orig/lib/gs_ttf.ps 2003-04-12 23:02:38.000000000 +0900
++++ ghostscript-7.07/lib/gs_ttf.ps 2003-07-24 19:00:37.000000000 +0900
+@@ -575,7 +575,7 @@
+ (maxp) 1 index
+ (name) 1 index
+ (OS/2) 1 index
+- (post) 1 index
++ (post) { .readbigtable }
+ (vhea) 1 index
+ % Big tables
+ (glyf) { .readbigtable }
+@@ -918,10 +918,17 @@
+ DEBUG { (fontname ) print fontname = } if
+ % Stack: ... /FontInfo mark key1 value1 ...
+ post null ne {
+- /ItalicAngle post 4 gets32 65536.0 div
+- /isFixedPitch post 12 getu32 0 ne
+- /UnderlinePosition post 8 gets16 upem div
+- /UnderlineThickness post 10 gets16 upem div
++ post type /arraytype eq {
++ % this post table is a big table. /post should be [(...) ...]
++ % data we actually need here should be first one in array.
++ /posttable post 1 get def
++ } {
++ /posttable post def
++ } ifelse
++ /ItalicAngle posttable 4 gets32 65536.0 div
++ /isFixedPitch posttable 12 getu32 0 ne
++ /UnderlinePosition posttable 8 gets16 upem div
++ /UnderlineThickness posttable 10 gets16 upem div
+ } if
+ counttomark 0 ne { .dicttomark } { pop pop } ifelse
+ /XUID [orgXUID 42 curxuid]
diff --git a/app-text/ghostscript/files/ghostscript-7.07-coverage-glyphcount.patch b/app-text/ghostscript/files/ghostscript-7.07-coverage-glyphcount.patch
new file mode 100644
index 000000000000..4c976b467380
--- /dev/null
+++ b/app-text/ghostscript/files/ghostscript-7.07-coverage-glyphcount.patch
@@ -0,0 +1,84 @@
+diff -ruN ghostscript-7.07.orig/lib/gs_ttf.ps ghostscript-7.07/lib/gs_ttf.ps
+--- ghostscript-7.07.orig/lib/gs_ttf.ps 2003-08-04 15:23:15.000000000 +0900
++++ ghostscript-7.07/lib/gs_ttf.ps 2003-08-04 15:22:23.000000000 +0900
+@@ -1104,9 +1104,26 @@
+ % 4 2 Offset Coverage(--)
+ % 6 2 uint16 GlyphCount
+ % 8 2 GlyphID Substitute(vertically oriented glyphs)
+-% -- 2 uint16 SubstFormat
+-% +2 2 uint16 GlyphCount(same as above GlyphCount)
+-% +4 2 GlyphID GlyphArray(horizontally oriented glyphs)
++%
++% [Coverage Format 1, Individual glyph indices]
++% Index Size Type Name of Entry
++% -----------------------------------
++% 0 2 uint16 CoverageFormat (Format identifier-format = 1)
++% 2 2 uint16 GlyphCount (same as above GlyphCount)
++% 4 2 GlyphID GlyphArray (horizontally oriented glyphs)
++%
++% [Coverage Format 2, Range of glyphs
++% Index Size Type Name of Entry
++% -----------------------------------
++% 0 2 uint16 CoverageFormat (Format identifier-format = 2)
++% 2 2 uint16 RangeCount
++% 4 2 struct RangeRecord[RangeCount]
++% [RangeRecord]
++% Index Size Type Name of Entry
++% -----------------------------------
++% 0 2 GlyphID First GlyphID in the range
++% 2 2 GlyphID Last GlyphID in the range
++% 4 2 uint16 Coverage Index of first GlpyhID in range
+ % -----------------------------------
+ % References
+ % 1. http://www.microsoft.com/typography/OTSPEC/gsub.htm
+@@ -1161,10 +1178,13 @@
+ %dup /gsubvog exch gsubost 6 add gsubglc getinterval def
+ %dup /gsubhog exch gsubost gsubocv add 4 add gsubglc getinterval def
+ dup /gsubvog exch gsubost 6 add gsubglc 2 mul getinterval def
+- dup /gsubhog exch gsubost gsubocv add 4 add gsubglc 2 mul getinterval def
++ dup /cvfmt exch gsubost gsubocv add 0 add getu16 def
++ dup /cvglc exch gsubost gsubocv add 2 add getu16 def
++ dup /gsubhog exch gsubost gsubocv add 4 add cvglc 2 mul getinterval def
+ DEBUG {
+ (gsubocv: ) print gsubocv =
+ (gsubglc: ) print gsubglc =
++ (cvfmt: ) print cvfmt =
+
+ (gsubhog->gsubvog ) =
+ 0 2 gsubhog length 2 sub { % for
+@@ -1174,10 +1194,31 @@
+ gsubvog exch getu16 =
+ } for
+ } if
+- /gsubh2v << 0 2 gsubhog length 2 sub {
+- dup gsubhog exch getu16
+- exch gsubvog exch getu16
+- } for >> def
++ cvfmt 1 eq {
++ /gsubh2v << 0 2 gsubhog length 2 sub {
++ dup gsubhog exch getu16
++ exch gsubvog exch getu16
++ } for >> def
++ } {
++ cvfmt 2 eq {
++ /gsubh2v << 0 6 gsubhog length 6 sub {
++ dup 0 add /fgid exch gsubhog exch getu16 def
++ dup 2 add /lgid exch gsubhog exch getu16 def
++ 4 add /cvidx exch gsubhog exch getu16 def
++ DEBUG {
++ (fgid: ) print fgid =
++ (lgid: ) print lgid =
++ (cvidx: ) print cvidx =
++ } if
++ fgid 1 lgid {
++ dup cvidx add fgid sub
++ exch gsubvog exch getu16
++ } for
++ } for >> def
++ } {
++ %(UNKNWON COVERAGE FORMAT.) = flush
++ } ifelse
++ } ifelse
+ } {
+ %(UNKNOWN GSUB FORMAT.) = flush
+ } ifelse
diff --git a/app-text/ghostscript/files/ghostscript-7.07-fix_cidfontname_Encoding_CIDToGIDMap_DW_W.patch b/app-text/ghostscript/files/ghostscript-7.07-fix_cidfontname_Encoding_CIDToGIDMap_DW_W.patch
new file mode 100644
index 000000000000..a5e0771fe00a
--- /dev/null
+++ b/app-text/ghostscript/files/ghostscript-7.07-fix_cidfontname_Encoding_CIDToGIDMap_DW_W.patch
@@ -0,0 +1,194 @@
+--- ./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;
+--- ./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;
+--- ./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) {
+--- ./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 --git a/app-text/ghostscript/files/ghostscript-7.07-fix_rename_font_gs_cidfn.ps.patch b/app-text/ghostscript/files/ghostscript-7.07-fix_rename_font_gs_cidfn.ps.patch
new file mode 100644
index 000000000000..17f8a3da7c19
--- /dev/null
+++ b/app-text/ghostscript/files/ghostscript-7.07-fix_rename_font_gs_cidfn.ps.patch
@@ -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 --git a/app-text/ghostscript/files/ghostscript-7.07-gsublookuptable.patch b/app-text/ghostscript/files/ghostscript-7.07-gsublookuptable.patch
new file mode 100644
index 000000000000..424441b03928
--- /dev/null
+++ b/app-text/ghostscript/files/ghostscript-7.07-gsublookuptable.patch
@@ -0,0 +1,114 @@
+diff -ruN ghostscript-7.07.orig/lib/gs_ttf.ps ghostscript-7.07/lib/gs_ttf.ps
+--- ghostscript-7.07.orig/lib/gs_ttf.ps 2003-07-29 16:51:55.000000000 +0900
++++ ghostscript-7.07/lib/gs_ttf.ps 2003-07-29 17:44:43.000000000 +0900
+@@ -1117,50 +1117,77 @@
+ /gsubh2v null def
+ tabdict /GSUB .knownget { % if
+ dup /gsubver exch 0 getu32 def
+- %dup /gsubosl exch 4 getu16 12 add def
+- %dup /gsubofl exch 6 getu16 12 add def
+- dup /gsuboll exch 8 getu16 12 add def
++ %dup /gsubosl exch 4 getu16 def
++ %dup /gsubofl exch 6 getu16 def
++ dup /gsuboll exch 8 getu16 def
+ DEBUG {
+ (gsubver: ) print gsubver =
+ %(gsubosl: ) print gsubosl =
+ %(gsubofl: ) print gsubofl =
+ (gsuboll: ) print gsuboll =
+ } if
+- dup /gsubfmt exch gsuboll 0 add getu16 def
++ % /gsuboll should be pointed out the LookupList table, but not Lookup table.
++ % so this is wrong:
++ % dup /gsubfmt exch gsuboll 0 add getu16 def
++ dup /gsublc exch gsuboll 0 add getu16 def
+ DEBUG {
+- (gsubfmt: ) print gsubfmt =
++ (gsublc: ) print gsublc =
+ } if
+-% gsubver 16#00010000 eq { % ifelse
+- gsubfmt 2 eq { % ifelse
+- dup /gsubocv exch gsuboll 2 add getu16 def
+- dup /gsubglc exch gsuboll 4 add getu16 def
+- % hacked by suzuki toshiya at 2001/3/6
+- %dup /gsubvog exch gsuboll 6 add gsubglc getinterval def
+- %dup /gsubhog exch gsuboll gsubocv add 4 add gsubglc getinterval def
+- dup /gsubvog exch gsuboll 6 add gsubglc 2 mul getinterval def
+- dup /gsubhog exch gsuboll gsubocv add 4 add gsubglc 2 mul getinterval def
++ gsublc 0 ne {
++ 0 1 gsublc 1 sub {
++ 2 mul /gsubolt exch 2 index exch gsuboll 2 add add getu16 gsuboll add def
++ dup /gsubltype exch gsubolt 0 add getu16 def
++ dup /gsublflag exch gsubolt 2 add getu16 def
++ dup /gsubsubc exch gsubolt 4 add getu16 def
+ DEBUG {
+- (gsubocv: ) print gsubocv =
+- (gsubglc: ) print gsubglc =
+-
+- (gsubhog->gsubvog ) =
+- 0 2 gsubhog length 2 sub { % for
+- dup
+- gsubhog exch getu16 =only
+- (->) =only
+- gsubvog exch getu16 =
++ (gsubolt: ) print gsubolt =
++ (gsubltype: ) print gsubltype =
++ (gsublflag: ) print gsublflag =
++ (gsubsubc: ) print gsubsubc =
++ } if
++ gsubsubc 0 ne {
++ 0 1 gsubsubc 1 sub {
++ 2 mul /gsubost exch 2 index exch gsubolt 6 add add getu16 gsubolt add def
++ dup /substfmt exch gsubost 0 add getu16 def
++ DEBUG {
++ (gsubost: ) print gsubost =
++ (substfmt: ) print substfmt =
++ } if
++% gsubver 16#00010000 eq { % ifelse
++ gsubltype 1 eq substfmt 2 eq and { % ifelse
++ dup /gsubocv exch gsubost 2 add getu16 def
++ dup /gsubglc exch gsubost 4 add getu16 def
++ % hacked by suzuki toshiya at 2001/3/6
++ %dup /gsubvog exch gsubost 6 add gsubglc getinterval def
++ %dup /gsubhog exch gsubost gsubocv add 4 add gsubglc getinterval def
++ dup /gsubvog exch gsubost 6 add gsubglc 2 mul getinterval def
++ dup /gsubhog exch gsubost gsubocv add 4 add gsubglc 2 mul getinterval def
++ DEBUG {
++ (gsubocv: ) print gsubocv =
++ (gsubglc: ) print gsubglc =
++
++ (gsubhog->gsubvog ) =
++ 0 2 gsubhog length 2 sub { % for
++ dup
++ gsubhog exch getu16 =only
++ (->) =only
++ gsubvog exch getu16 =
++ } for
++ } if
++ /gsubh2v << 0 2 gsubhog length 2 sub {
++ dup gsubhog exch getu16
++ exch gsubvog exch getu16
++ } for >> def
++ } {
++ %(UNKNOWN GSUB FORMAT.) = flush
++ } ifelse
++% } {
++% (ILLEGAL GSUB VERSION.) = flush
++% } ifelse
+ } for
+ } if
+- /gsubh2v << 0 2 gsubhog length 2 sub {
+- dup gsubhog exch getu16
+- exch gsubvog exch getu16
+- } for >> def
+- } {
+- %(UNKNOWN GSUB FORMAT.) = flush
+- } ifelse
+-% } {
+-% (ILLEGAL GSUB VERSION.) = flush
+-% } ifelse
++ } for
++ } if
+ pop
+ } if
+ } bind def
diff --git a/app-text/ghostscript/files/gs7.07.1-cjk.diff b/app-text/ghostscript/files/gs7.07.1-cjk.diff
new file mode 100644
index 000000000000..d1a5d93638b9
--- /dev/null
+++ b/app-text/ghostscript/files/gs7.07.1-cjk.diff
@@ -0,0 +1,172 @@
+diff -urN espgs-7.07.1/lib/CIDFnmap espgs-7.07.1.patched/lib/CIDFnmap
+--- espgs-7.07.1/lib/CIDFnmap 2002-04-23 20:58:33.000000000 +0900
++++ espgs-7.07.1.patched/lib/CIDFnmap 2005-04-23 22:27:11.000000000 +0900
+@@ -135,14 +135,14 @@
+ % in particular, you must leave at least one space or tab between each
+ % field in the entry.
+
+-%(CIDFnmap.Ore) .runlibfile
+-%(CIDFnmap.ARP) .runlibfile
+-%(CIDFnmap.Bae) .runlibfile
+-%(CIDFnmap.Koc) .runlibfile
++(CIDFnmap.Ore) .runlibfile
++(CIDFnmap.ARP) .runlibfile
++(CIDFnmap.Bae) .runlibfile
++(CIDFnmap.Koc) .runlibfile
+ %(CIDFnmap.Sol) .runlibfile
+ %(CIDFnmap.Win) .runlibfile
+
+-%(CIDFnmap.CJK) .runlibfile
++(CIDFnmap.CJK) .runlibfile
+
+ % native CIDFontName (BIG5) in traditional Chinese
+ %(CIDFnmap.b5) .runlibfile
+diff -urN espgs-7.07.1/lib/CIDFnmap.CJK espgs-7.07.1.patched/lib/CIDFnmap.CJK
+--- espgs-7.07.1/lib/CIDFnmap.CJK 2002-04-23 20:58:33.000000000 +0900
++++ espgs-7.07.1.patched/lib/CIDFnmap.CJK 2005-04-23 22:28:56.000000000 +0900
+@@ -24,51 +24,51 @@
+ % Fallback aliases for CJK PDF files
+ %
+ %/Adobe-CNS1 /MOESung-Regular ; % CIDFnmap.Ore
+-%/Adobe-CNS1 /ShanHeiSun-Light ; % CIDFnmap.ARP
++/Adobe-CNS1 /ShanHeiSun-Light ; % CIDFnmap.ARP
+ %/Adobe-CNS1 /ming ; % CIDFnmap.Sol
+ %/Adobe-CNS1 /MingLiU ; % CIDFnmap.Win
+ %/Adobe-CNS1 /SimSun-18030-Adobe-CNS1 ; % CIDFnmap.Win
+
+-%/Adobe-GB1 /BousungEG-Light-GB ; % CIDFnmap.ARP
++/Adobe-GB1 /BousungEG-Light-GB ; % CIDFnmap.ARP
+ %/Adobe-GB1 /zycjksun ; % CIDFnmap.Sol
+ %/Adobe-GB1 /SimSun ; % CIDFnmap.Win
+
+ %/Adobe-Japan1 /WadaMin-Regular ; % CIDFnmap.Ore
+ %/Adobe-Japan1 /HG-MinchoL ; % CIDFnmap.Sol
+-%/Adobe-Japan1 /Kochi-Mincho ; % CIDFnmap.Koc
++/Adobe-Japan1 /Kochi-Mincho ; % CIDFnmap.Koc
+ %/Adobe-Japan1 /MS-Mincho ; % CIDFnmap.Win
+
+-%/Adobe-Japan2 /WadaMin-RegularH ; % CIDFnmap.Ore
++/Adobe-Japan2 /WadaMin-RegularH ; % CIDFnmap.Ore
+ %/Adobe-Japan2 /HeiseiMin-W3H ; % CIDFnmap.Sol
+ %/Adobe-Japan2 /MS-Mincho-Adobe-Japan2 ; % CIDFnmap.Win
+
+ %/Adobe-Korea1 /Munhwa-Regular ; % CIDFnmap.Ore
+-%/Adobe-Korea1 /Baekmuk-Batang ; % CIDFnmap.Bae
++/Adobe-Korea1 /Baekmuk-Batang ; % CIDFnmap.Bae
+ %/Adobe-Korea1 /Myeongjo ; % CIDFnmap.Sol
+ %/Adobe-Korea1 /Batang ; % CIDFnmap.Win
+
+ %
+ % Convenient aliases for PS files on Traditional Chinese PostScript printer
+ %
+-%/MSung-Light /MOESung-Regular ; % CIDFnmap.Ore
++/MSung-Light /MOESung-Regular ; % CIDFnmap.Ore
+ %/MSung-Light /SimSun-18030-Adobe-CNS1 ; % CIDFnmap.Win
+-%/MSung-Medium /ShanHeiSun-Light ; % CIDFnmap.ARP
+-%/MHei-Medium /ShanHeiSun-Light ; % CIDFnmap.ARP
++/MSung-Medium /ShanHeiSun-Light ; % CIDFnmap.ARP
++/MHei-Medium /ShanHeiSun-Light ; % CIDFnmap.ARP
+ %/MHei-Medium /hei ; % CIDFnmap.Sol
+-%/MKai-Medium /ZenKai-Medium ; % CIDFnmap.ARP
++/MKai-Medium /ZenKai-Medium ; % CIDFnmap.ARP
+ %/MKai-Medium /kai ; % CIDFnmap.Sol
+
+ %
+ % Convenient aliases for PS files on Simplified Chinese PostScript printer
+ %
+-%/STSong-Light /BousungEG-Light-GB ; % CIDFnmap.ARP
++/STSong-Light /BousungEG-Light-GB ; % CIDFnmap.ARP
+ %/STSong-Light /zycjksun ; % CIDFnmap.Sol
+ %/STSong-Light /SimSun ; % CIDFnmap.Win
+ %/STFangsong-Light /zycjkfangs ; % CIDFnmap.Sol
+ %/STFangsong-Light /SimSun ; % CIDFnmap.Win
+ %/STHeiti-Regular /zycjkhei ; % CIDFnmap.Sol
+ %/STHeiti-Regular /SimHei ; % CIDFnmap.Win
+-%/STKaiti-Regular /GBZenKai-Medium ; % CIDFnmap.ARP
++/STKaiti-Regular /GBZenKai-Medium ; % CIDFnmap.ARP
+ %/STKaiti-Regular /zycjkkai ; % CIDFnmap.Sol
+
+ %
+@@ -76,18 +76,18 @@
+ %
+ %/Ryumin-Light /WadaMin-Regular ; % CIDFnmap.Ore
+ %/Ryumin-Light /HG-MinchoL ; % CIDFnmap.Sol
+-%/Ryumin-Light /Kochi-Mincho ; % CIDFnmap.Koc
++/Ryumin-Light /Kochi-Mincho ; % CIDFnmap.Koc
+ %/Ryumin-Light /MS-Mincho ; % CIDFnmap.Win
+ %/GothicBBB-Medium /WadaGo-Bold ; % CIDFnmap.Ore
+ %/GothicBBB-Medium /HG-GothicB ; % CIDFnmap.Sol
+-%/GothicBBB-Medium /Kochi-Gothic ; % CIDFnmap.Koc
++/GothicBBB-Medium /Kochi-Gothic ; % CIDFnmap.Koc
+ %/GothicBBB-Medium /MS-Gothic ; % CIDFnmap.Win
+ %/HeiseiMin-W3 /MS-Mincho ; % CIDFnmap.Win
+ %/HeiseiKakuGo-W5 /MS-Gothic ; % CIDFnmap.Win
+
+-%/HeiseiMin-W3H /WadaMin-RegularH ; % CIDFnmap.Ore
++/HeiseiMin-W3H /WadaMin-RegularH ; % CIDFnmap.Ore
+ %/HeiseiMin-W3H /MS-Mincho-Adobe-Japan2 ; % CIDFnmap.Win
+-%/HeiseiKakuGo-W5H /WadaMaruGo-RegularH ; % CIDFnmap.Ore
++/HeiseiKakuGo-W5H /WadaMaruGo-RegularH ; % CIDFnmap.Ore
+ %/HeiseiKakuGo-W5H /MS-Gothic-Adobe-Japan2 ; % CIDFnmap.Win
+
+ %/KozMin-Regular /MS-Mincho ; % CIDFnmap.Win
+@@ -97,17 +97,17 @@
+ % Convenient aliases for PS files on Korean PostScript printer
+ %
+ %/HYGoThic-Medium /MunhwaGothic-Regular ; % CIDFnmap.Ore
+-%/HYGoThic-Medium /Baekmuk-Dotum ; % CIDFnmap.Bae
++/HYGoThic-Medium /Baekmuk-Dotum ; % CIDFnmap.Bae
+ %/HYGoThic-Medium /Gothic ; % CIDFnmap.Sol
+ %/HYGoThic-Medium /Dotum ; % CIDFnmap.Win
+ %/HYGungSo-Bold /Gungsuh ; % CIDFnmap.Win
+-%/HYKHeadLine-Bold /Baekmuk-Headline ; % CIDFnmap.Bae
+-%/HYKHeadLine-Medium /Baekmuk-Headline ; % CIDFnmap.Bae
++/HYKHeadLine-Bold /Baekmuk-Headline ; % CIDFnmap.Bae
++/HYKHeadLine-Medium /Baekmuk-Headline ; % CIDFnmap.Bae
+ %/HYSMyeongJo-Medium /Munhwa-Regular ; % CIDFnmap.Ore
+-%/HYSMyeongJo-Medium /Baekmuk-Batang ; % CIDFnmap.Bae
++/HYSMyeongJo-Medium /Baekmuk-Batang ; % CIDFnmap.Bae
+ %/HYSMyeongJo-Medium /Myeongjo ; % CIDFnmap.Sol
+ %/HYSMyeongJo-Medium /Batang ; % CIDFnmap.Win
+-%/HYRGoThic-Medium /Baekmuk-Gulim ; % CIDFnmap.Bae
++/HYRGoThic-Medium /Baekmuk-Gulim ; % CIDFnmap.Bae
+ %/HYRGoThic-Medium /RoundedGothic ; % CIDFnmap.Sol
+ %/HYRGoThic-Medium /Gulim ; % CIDFnmap.Win
+
+diff -urN espgs-7.07.1/lib/CIDFnmap.Koc espgs-7.07.1.patched/lib/CIDFnmap.Koc
+--- espgs-7.07.1/lib/CIDFnmap.Koc 2002-04-23 20:58:33.000000000 +0900
++++ espgs-7.07.1.patched/lib/CIDFnmap.Koc 2005-04-23 22:27:11.000000000 +0900
+@@ -30,8 +30,8 @@
+ % Kochi-Mincho: Public domain, except for NAGA10 bitmap data
+ % Kochi-Gothic: Wada Lab's font license, except for NAGA10 bitmap data
+ %
+-%/Kochi-Mincho (kochi-mincho.ttf) ;
+-%/Kochi-Gothic (kochi-gothic.ttf) ;
++/Kochi-Mincho (kochi-mincho-subst.ttf) ;
++/Kochi-Gothic (kochi-gothic-subst.ttf) ;
+ %
+ % Notice: In CID-keyed space of Kochi-Mincho, although you may find that
+ % CIDs 7611,7613-7625,7629,7630,11847,12041-12043 are incorrectly
+@@ -45,6 +45,6 @@
+ % Kochi-Mincho: Public domain. Designed by Yasuyuki Furukawa.
+ % Kochi-Gothic: Wada Lab's font license.
+ %
+-/Kochi-Mincho (Kochi-Mincho) ;
+-/Kochi-Gothic (Kochi-Gothic) ;
++%/Kochi-Mincho (Kochi-Mincho) ;
++%/Kochi-Gothic (Kochi-Gothic) ;
+
+diff -urN espgs-7.07.1/lib/gs_res.ps.in espgs-7.07.1.patched/lib/gs_res.ps.in
+--- espgs-7.07.1/lib/gs_res.ps.in 2002-10-05 01:35:24.000000000 +0900
++++ espgs-7.07.1.patched/lib/gs_res.ps.in 2005-04-23 22:27:11.000000000 +0900
+@@ -245,8 +245,8 @@
+ /pssystemparams 10 dict readonly def
+ } if
+ pssystemparams begin
+- /FontResourceDir (@datadir@/ghostscript/fonts/) readonly .forcedef % pssys'params is r-o
+- /GenericResourceDir (@datadir@/ghostscript/) readonly .forcedef % pssys'params is r-o
++ /FontResourceDir (@datadir@/ghostscript/Resource/Font/) readonly .forcedef % pssys'params is r-o
++ /GenericResourceDir (@datadir@/ghostscript/Resource/) readonly .forcedef % pssys'params is r-o
+ /GenericResourcePathSep (/) readonly .forcedef % pssys'params is r-o
+ end
+ end
diff --git a/app-text/ghostscript/ghostscript-7.07.1-r9.ebuild b/app-text/ghostscript/ghostscript-7.07.1-r9.ebuild
new file mode 100644
index 000000000000..e51ca9a6ef78
--- /dev/null
+++ b/app-text/ghostscript/ghostscript-7.07.1-r9.ebuild
@@ -0,0 +1,187 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/ghostscript/ghostscript-7.07.1-r9.ebuild,v 1.1 2005/04/23 14:36:34 usata Exp $
+
+inherit flag-o-matic eutils gcc libtool
+
+DESCRIPTION="ESP Ghostscript -- an enhanced version of GNU Ghostscript with better printer support"
+HOMEPAGE="http://www.cups.org/ghostscript.php"
+SRC_URI="mirror://sourceforge/espgs/espgs-${PV}-source.tar.bz2
+ cjk? ( http://www.matsusaka-u.ac.jp/mirror/gs-cjk/adobe-cmaps-200204.tar.gz
+ http://www.matsusaka-u.ac.jp/mirror/gs-cjk/acro5-cmaps-2001.tar.gz )"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~ppc-macos ~s390 ~sparc ~x86"
+IUSE="X cups cjk emacs gtk"
+
+DEP="virtual/libc
+ >=media-libs/jpeg-6b
+ >=media-libs/libpng-1.2.1
+ >=sys-libs/zlib-1.1.4
+ X? ( virtual/x11 )
+ gtk? ( >=x11-libs/gtk+-2.0 )
+ cups? ( net-print/cups )
+ !virtual/ghostscript"
+
+RDEPEND="${DEP}
+ cjk? ( media-fonts/arphicfonts
+ media-fonts/kochi-substitute
+ media-fonts/baekmuk-fonts )
+ media-fonts/gnu-gs-fonts-std"
+
+DEPEND="${DEP}
+ gtk? ( dev-util/pkgconfig )"
+
+# media-libs/fontconfig"
+
+S=${WORKDIR}/espgs-${PV}
+
+PROVIDE="virtual/ghostscript"
+
+src_unpack() {
+ unpack espgs-${PV}-source.tar.bz2
+
+ cd ${S}
+
+ if use ppc-macos; then
+ epatch ${FILESDIR}/gs-osx-unix-dll.patch
+ cp src/unix-gcc.mak Makefile.in
+ sed -i -e "s:SHARE_JPEG=0:SHARE_JPEG=1:" Makefile.in || die
+ sed -i -e "s:SHARE_ZLIB=0:SHARE_ZLIB=1:" Makefile.in || die
+ sed -i -e "s:SHARE_LIBPNG=0:SHARE_LIBPNG=1:" Makefile.in || die
+ sed -i -e "s:usr/local:usr:" Makefile.in || die
+ fi
+
+ if use cjk ; then
+ epatch ${FILESDIR}/gs7.07.1-cjk.diff
+ #this causes gs error; bug #90009
+ #sed -i -e '/;$/s/^%//g' ${S}/lib/CIDFnmap.CJK || die
+
+ epatch ${FILESDIR}/ghostscript-7.07-bigposttable.patch
+ epatch ${FILESDIR}/ghostscript-7.07-gsublookuptable.patch
+ epatch ${FILESDIR}/ghostscript-7.07-coverage-glyphcount.patch
+ epatch ${FILESDIR}/ghostscript-7.07-fix_rename_font_gs_cidfn.ps.patch
+ epatch ${FILESDIR}/ghostscript-7.07-fix_cidfontname_Encoding_CIDToGIDMap_DW_W.patch
+ fi
+
+ # add fontconfig support (this patch is broken)
+ # epatch ${FILESDIR}/gs7.07.1-fontconfig-rh.patch.2.bz2
+
+ # man page patch from absinthe@pobox.com (Dylan Carlson) bug #14150
+ epatch ${FILESDIR}/ghostscript-7.05.6.man.patch
+
+ # ijs fPIC patch
+ epatch ${FILESDIR}/gs${PV}-ijs.patch
+
+ # pxl dash patch
+ epatch ${FILESDIR}/gs7.05.6-gdevpx.patch
+
+ # Makefile.in fixes for DESTDIR support in libijs because
+ # einstall borks on multilib systems -- eradicator
+ epatch ${FILESDIR}/gs${PV}-destdir.patch
+ epatch ${FILESDIR}/gs${PV}-ijsdestdir.patch
+
+ use ppc-macos && epatch ${FILESDIR}/gs-osx-ijs.patch
+
+ # search path fix
+ sed -i -e "s:\$\(gsdatadir\)/lib:/usr/share/ghostscript/7.07/$(get_libdir):"\
+ Makefile.in || die "sed failed"
+ sed -i -e 's:$(gsdir)/fonts:/usr/share/fonts/default/ghostscript/:' \
+ Makefile.in || die "sed failed"
+
+ # insecure tempfile handling
+ epatch ${FILESDIR}/gs${PV}-tempfile.patch
+
+ # krgb support (currently broken)
+ #( cd src; epatch ${FILESDIR}/gs7.07.1-krgb.patch.gz )
+
+ # Fix the garbage collector on ia64 and ppc
+ epatch ${FILESDIR}/gs-fix-gc.patch
+
+ # bug #63435
+ epatch ${FILESDIR}/gs${PV}-ps2ps.patch
+
+ # fix dynamic build
+ echo '#include "png.h"' >> src/png_.h
+
+ # fix for building with gtk2 instead of gtk1
+ if use gtk; then
+ sed -i -e "s:gmodule:gmodule-2.0:" configure.ac
+ sed -i -e "s:glib-config:pkgconfig:" configure.ac
+ sed -i -e "s:gtk-config:pkg-config gtk+-2.0:g" src/unix-dll.mak
+ sed -i -e "s:CFLAGS_SO=-fPIC:CFLAGS_SO=-fPIC -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include:" Makefile.in
+ else
+ epatch ${FILESDIR}/gs${PV}-nogtk2.patch
+ fi
+}
+
+src_compile() {
+ local myconf
+ myconf="--with-ijs --without-gimp-print"
+ use gtk && myconf="${myconf} --with-omni" || myconf="${myconf} --without-omni"
+
+ # bug #56998, only compiled-in fontpath is searched when running
+ # gs -DPARANOIDSAFER out.ps
+ myconf="${myconf} --with-fontconfig --with-fontpath=/usr/share/fonts:/usr/share/fonts/ttf/zh_TW:/usr/share/fonts/ttf/zh_CN:/usr/share/fonts/arphicfonts:/usr/share/fonts/ttf/korean/baekmuk:/usr/share/fonts/baekmuk-fonts:/usr/X11R6/lib/X11/fonts/truetype:/usr/share/fonts/kochi-substitute"
+
+ use X && myconf="${myconf} --with-x" \
+ || myconf="${myconf} --without-x"
+
+ use cups && myconf="${myconf} --enable-cups" \
+ || myconf="${myconf} --disable-cups"
+
+ # -O3 will make ghostscript fail when compiling with gcc 3.4
+ if [ "`gcc-major-version`" -eq "3" ] && [ "`gcc-minor-version`" -eq "4" ]
+ then
+ strip-flags
+ replace-flags -O? -O2
+ fi
+
+ autoconf
+ econf ${myconf} || die "econf failed"
+ emake -j1 || die "make failed"
+ emake so -j1 || die "make failed"
+
+ cd ijs
+ econf || die "econf failed"
+ emake -j1 || die "make failed"
+ cd ..
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "make install failed"
+ make DESTDIR="${D}" soinstall || die "make install failed"
+
+ rm -fr ${D}/usr/share/ghostscript/7.07/doc || die
+ dodoc doc/README doc/COPYING doc/COPYING.LGPL
+ dohtml doc/*.html doc/*.htm
+
+ if use emacs; then
+ insinto /usr/share/emacs/site-lisp
+ doins doc/gsdoc.el
+ fi
+
+ if use cjk ; then
+ dodir /usr/share/ghostscript/Resource
+ dodir /usr/share/ghostscript/Resource/Font
+ dodir /usr/share/ghostscript/Resource/CIDFont
+ cd ${D}/usr/share/ghostscript/Resource
+ unpack adobe-cmaps-200204.tar.gz
+ unpack acro5-cmaps-2001.tar.gz
+ fi
+
+ # Install ijs
+ cd ${S}/ijs
+ dodir /usr/bin /usr/include /usr/$(get_libdir)
+ # This is broken - there are not even a 'install_prefix'
+ # anywhere in ${S}/ijs ...
+ #einstall install_prefix=${D}
+ #einstall
+ #dosed "s:^prefix=.*:prefix=/usr:" /usr/bin/ijs-config
+ make DESTDIR="${D}" install || die
+
+ # bug #83876, collision with gcc
+ rm -f ${D}/usr/share/man/de/man1/ansi2knr.1
+ rm -f ${D}/usr/share/man/man1/ansi2knr.1
+}