Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 248510 - media-fonts/acroread-asianfonts: not picked up by ghostscript (CRITICAL for Chinese/Japanese/Korean)
Summary: media-fonts/acroread-asianfonts: not picked up by ghostscript (CRITICAL for C...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: CJK Team
URL:
Whiteboard:
Keywords:
Depends on: 249871
Blocks:
  Show dependency tree
 
Reported: 2008-11-24 06:40 UTC by Walter
Modified: 2009-10-10 10:39 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Walter 2008-11-24 06:40:42 UTC
The Asian fonts installed by acroread-asianfonts are inaccessible to Ghostscript, which means that any Ghostscript-based conversion or display tool is unable to display Chinese, Japanese or Korean documents that do not include embedded font information.

Reproducible: Always

Steps to Reproduce:
Attempt to display or convert a PDF document including Chinese, Japanese or Korean text but without embedded font information.

An example file is available here: http://pratyeka.org/file.pdf

For example, try 'gs file.pdf' or 'convert file.pdf file.jpg'.
Actual Results:  
Ghostscript dies with errors about resources not found.

Expected Results:  
Ghostscript properly displays or converts the document.

I'm not sure whether OTF is natively supported by Ghostscript.  If TTF conversion is necessary to make the Adobe OTF files available to Ghostscript, this is possible using the following script for fontforge (emerge fontforge).

    #!/usr/local/bin/fontforge
    # Quick and dirty hack: converts a font to truetype (.ttf)
    Print("Opening "+$1);
    Open($1);
    Print("Saving "+$1:r+".ttf");
    Generate($1:r+".ttf");
    Quit(0); 

Then run: fontforge -script otf2ttf.sh FONTNAME.otf 

Apparently a 'CID font map' file may be necessary to make Ghostscript understand the resulting files, I have been unable to find a way to create this file.

Please note that this is a serious problem for users of CJK documents.  For example, in our case this means we are unable to send Chinese PDF documents as faxes (with Hylafax, which uses Ghostscript) which is a critical issue.

Also note that it is possible to convert such a PDF document to PS using:
 acroread --toPostScript file.pdf
This will create an equivalent file.ps file.

# emerge --info
Portage 2.1.4.4 (default-linux/x86/2007.0, gcc-4.1.1, glibc-2.5-r0, 2.6.23-gentoo-r6 i686)
=================================================================
System uname: 2.6.23-gentoo-r6 i686 AMD Athlon(tm) 64 Processor 3000+
Timestamp of tree: Fri, 21 Nov 2008 02:45:01 +0000
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=k8 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -march=k8 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.channelx.biz/ http://ftp.kaist.ac.kr/pub/gentoo/ http://gentoo.gg3.net/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X acl berkdb bzip2 cgi cli cracklib crypt cups dri encode flac fortran gdbm gif gpm iconv ipv6 isdnlog java jpeg lame mad midi mp3 mudflap mysql ncurses nls nptl nptlonly openmp opentype pam pcre pdf pdo perl png pnm pppd python readline reflection ruby samba session spl sqlite ssl tcpd tiff unicode x86 xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt intel mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

# emerge --search acroread 
Searching...   
[ Results for search key : acroread ]
[ Applications found : 2 ]
 
*  app-text/acroread
      Latest version available: 8.1.3
      Latest version installed: 8.1.3
      Size of files: 748,086 kB
      Homepage:      http://www.adobe.com/products/acrobat/
      Description:   Adobe's PDF reader
      License:       Adobe

*  media-fonts/acroread-asianfonts
      Latest version available: 7.0.8
      Latest version installed: 7.0.8
      Size of files: 40,076 kB
      Homepage:      http://www.adobe.com/products/acrobat/acrrasianfontpack.html
      Description:   Asian font packs for Adobe Acrobat Reader
      License:       Adobe

# emerge --search ghostscript
Searching...   
[ Results for search key : ghostscript ]
[ Applications found : 4 ]
 
*  app-text/ghostscript-esp
      Latest version available: 8.15.4-r1
      Latest version installed: [ Not Installed ]
      Size of files: 14,290 kB
      Homepage:      http://www.cups.org/espgs
      Description:   ESP Ghostscript -- an enhanced version of GPL Ghostscript with better printer support
      License:       GPL-2 LGPL-2 CPL-1.0

*  app-text/ghostscript-gnu [ Masked ]
      Latest version available: 8.60.0-r2
      Latest version installed: [ Not Installed ]
      Size of files: 13,688 kB
      Homepage:      http://www.gnu.org/software/ghostscript/
      Description:   GNU Ghostscript - patched GPL Ghostscript
      License:       GPL-2

*  app-text/ghostscript-gpl
      Latest version available: 8.62
      Latest version installed: 8.62
      Size of files: 20,415 kB
      Homepage:      http://ghostscript.com/
      Description:   GPL Ghostscript - the most current Ghostscript, AFPL, relicensed
      License:       GPL-2 CPL-1.0

*  virtual/ghostscript
      Latest version available: 0
      Latest version installed: 0
      Size of files: 0 kB
      Homepage:      http://www.ghostscript.com
      Description:   Virtual for Ghostscript
      License:       as-is
Comment 1 Rafał Mużyło 2008-11-24 14:58:53 UTC
Is your ghostscript-gpl emerged with cjk useflag ?
Comment 2 Walter 2008-11-24 16:05:37 UTC
Yes, 'cjk' is in the USE flags.  This seems to install some additional fonts, but does not establish relationships with standard Adobe fonts (used on all other platforms for PDFs, also used in acroread and available through portage) OR establish working aliases instead.
Comment 3 Walter 2008-11-28 04:06:45 UTC
Just tried on a friend's workstation - this functionality works on Ubuntu...
Comment 4 Walter 2008-12-09 10:27:24 UTC
Any news?
Comment 5 MATSUU Takuto (RETIRED) gentoo-dev 2008-12-09 11:04:42 UTC
sorry for delay.

I heard that acroread-asianfonts could be used only for Adobe Reader due to the license issue.
Comment 6 Walter 2008-12-09 11:08:05 UTC
It works on Ubuntu?

Maybe they are using some of the free fonts (also available on Gentoo) as substitutes for the standard Acrobat Asian fonts (eg: AdobeSong* for Chinese).

I tried to get this working by manually editing the Ghostscript Fontmap file (and others), but had no success.

Ubuntu has a very complex intermediary font configuration engine that is difficult to directly copy settings from.
Comment 7 MATSUU Takuto (RETIRED) gentoo-dev 2008-12-10 00:21:39 UTC
hmm, the file.pdf works for me.

$ gs file.pdf
GPL Ghostscript 8.63 (2008-08-01)
Copyright (C) 2008 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Substituting CID font resource/Adobe-GB1 for /STSongStd-Light-Acro.
Loading a TT font from /usr/share/fonts/arphicfonts/gbsn00lp.ttf to emulate a CID font BousungEG-Light-GB ... Done.
Substituting CID font resource/Adobe-GB1 for /STSongStd-Light-Acro.
>>showpage, press <return> to continue<<

Comment 8 Walter 2008-12-10 01:12:47 UTC
Great news!  But it won't work for me.

Can you tell me which versions of relevant packages you have installed?

# emerge --search arphic
Searching...   
[ Results for search key : arphic ]
[ Applications found : 1 ]
 
*  media-fonts/arphicfonts
      Latest version available: 0.1.20060928
      Latest version installed: 0.1.20060928
      Size of files: 40,522 kB
      Homepage:      http://www.arphic.com.tw/ http://www.freedesktop.org/wiki/Software_2fCJKUnifonts
      Description:   Chinese TrueType Arphic Fonts
      License:       Arphic

..........

# gs -sDEVICE=pngmono file.pdf 
GPL Ghostscript 8.62 (2008-02-29)
Copyright (C) 2008 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Substituting CID font resource/Adobe-GB1 for /STSongStd-Light-Acro.
Loading a TT font from /usr/share/fonts/arphicfonts/gbsn00lp.ttf to emulate a CID font BousungEG-Light-GB ... Done.
Error: /invalidfont in --.buildcidfont--
Operand stack:
   --nostringval--   --dict:5/14(L)--   F2   20.0   --dict:5/5(L)--   --dict:5/5(L)--   STSongStd-Light-Acro,Bold-GBK-EUC-H   --dict:10/12(ro)(G)--   --nostringval--   --dict:6/6(L)--   --dict:6/6(L)--   Adobe-GB1   CIDFont   true   Adobe-GB1   Adobe-GB1   -1   true   BousungEG-Light-GB   BousungEG-Light-GB   BousungEG-Light-GB   --dict:25/25(G)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1889   1   3   %oparray_pop   1888   1   3   %oparray_pop   1872   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   --nostringval--   %loop_continue   --nostringval--   1840   13   9   %oparray_pop   findresource   %errorexec_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   1848   21   10   %oparray_pop   --nostringval--
Dictionary stack:
   --dict:1145/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --dict:108/127(ro)(G)--   --dict:275/300(ro)(G)--   --dict:22/25(L)--   --dict:4/6(L)--   --dict:25/40(L)--   --dict:20/26(ro)(G)--
Current allocation mode is local
GPL Ghostscript 8.62: Unrecoverable error, exit code 1


So I tried to clean my installation back to the standard portage version...

# emerge -C ghostscript-gpl && emerge ghostscript-gpl
(...snip...)
# emerge -C arphicfonts && emerge arphicfonts
(...snip...)
# gs -sDEVICE=pngmono file.pdf 

No difference... still crashes. :(

I noticed you have ghostscript version 8.63, would this make a difference?
Comment 9 MATSUU Takuto (RETIRED) gentoo-dev 2008-12-10 01:34:44 UTC
ok, I reproduce the issue in another gentoo machine. it is fixed in ghostscript-gpl-8.63.

depends on #249871.
Comment 10 Walter 2008-12-10 01:57:17 UTC
Great news!

But I upgraded and now I get a different error.

# gs -sDEVICE=pngmono file.pdf 
GPL Ghostscript 8.63 (2008-08-01)
Copyright (C) 2008 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Substituting CID font resource/Adobe-GB1 for /STSongStd-Light-Acro.
Loading a TT font from /usr/share/fonts/arphicfonts/gbsn00lpGPL Ghostscript 8.63: **** Could not open the file  .
.ttf to emulate a CID font BousungEG-Light-GB ... Done.
Substituting CID font resource/Adobe-GB1 for /STSongStd-Light-Acro.
Error: /invalidfileaccess in --showpage--
Operand stack:
   --nostringval--   1   true
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1889   1   3   %oparray_pop   1888   1   3   %oparray_pop   1872   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   1761   1   9   %oparray_pop   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1145/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --dict:106/127(ro)(G)--   --dict:275/300(ro)(G)--   --dict:22/25(L)--   --dict:4/6(L)--   --dict:24/40(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.63: Unrecoverable error, exit code 1


# ls /usr/share/fonts/arphicfonts/
bkai00mp.ttf  bsmi00lp.ttf  encodings.dir  fonts.dir  fonts.scale  gbsn00lp.ttf  gkai00mp.ttf  ukai.ttf  uming.ttf
Comment 11 Walter 2008-12-10 02:05:12 UTC
I tried upgrading to media-fonts/arphicfonts-0.2.20080216.1 but no difference.

My eselect fontconfig:

# eselect fontconfig list
Available fontconfig .conf files ( * is enabled ):
  [1]   10-autohint.conf
  [2]   10-no-sub-pixel.conf
  [3]   10-sub-pixel-bgr.conf
  [4]   10-sub-pixel-rgb.conf
  [5]   10-sub-pixel-vbgr.conf
  [6]   10-sub-pixel-vrgb.conf
  [7]   10-unhinted.conf
  [8]   20-fix-globaladvance.conf *
  [9]   20-unhint-small-vera.conf *
  [10]  25-ttf-arphic-ukai-render.conf
  [11]  25-ttf-arphic-uming-bitmaps.conf
  [12]  25-ttf-arphic-uming-render.conf
  [13]  25-unhint-nonlatin.conf
  [14]  30-metric-aliases.conf *
  [15]  30-urw-aliases.conf *
  [16]  35-ttf-arphic-ukai-aliases.conf *
  [17]  35-ttf-arphic-uming-aliases.conf *
  [18]  40-nonlatin.conf *
  [19]  41-ttf-arphic-ukai.conf *
  [20]  41-ttf-arphic-uming.conf *
  [21]  45-latin.conf *
  [22]  49-sansserif.conf *
  [23]  50-user.conf *
  [24]  51-local.conf *
  [25]  60-latin.conf *
  [26]  64-ttf-arphic-uming.conf
  [27]  65-fonts-persian.conf *
  [28]  65-nonlatin.conf *
  [29]  69-unifont.conf *
  [30]  70-no-bitmaps.conf
  [31]  70-yes-bitmaps.conf
  [32]  75-ttf-arphic-ukai-select.conf *
  [33]  80-delicious.conf *
  [34]  90-synthetic.conf *
  [35]  90-ttf-arphic-ukai-embolden.conf *
  [36]  90-ttf-arphic-uming-embolden.conf *
Comment 12 MATSUU Takuto (RETIRED) gentoo-dev 2008-12-10 02:24:44 UTC
OutputFile argument is required for DEVICE=pngmono.

$ gs -sDEVICE=pngmono -sOutputFile=file.png file.pdf
Comment 13 Walter 2008-12-10 03:37:18 UTC
Great!  Works now, thanks a lot!  However, the default font substitution could be improved for our use case:

 Substituting CID font resource/Adobe-GB1 for /STSongStd-Light-Acro.

... this is too light a font for use on faxes.  Could you tell me where
in Gentoo's setup I can change this default to something heavier?
Comment 14 MATSUU Takuto (RETIRED) gentoo-dev 2008-12-10 15:24:44 UTC
(In reply to comment #13)
>  Substituting CID font resource/Adobe-GB1 for /STSongStd-Light-Acro.
> 
> ... this is too light a font for use on faxes.  Could you tell me where
> in Gentoo's setup I can change this default to something heavier?

See /usr/share/ghostscript/8.63/lib/cidfmap
Comment 15 Peter Volkov (RETIRED) gentoo-dev 2009-01-08 11:11:58 UTC
Ok, this is not fonts issue...
Comment 16 Peter Volkov (RETIRED) gentoo-dev 2009-10-10 10:39:01 UTC
Looks like this issue is resolved. Please, reopen if not.