TESTING: Ghostscript-10.01.1 package for slackware64-current (15.0+)
-----------------------------------------------------------------------------------------------------------------------------
SlackBuild diff to official slackware's ghostscript.SlackBuild
|
--- ghostscript.SlackBuild 2023-03-29 14:12:11.035643315 +0900 +++ ghostscript.SlackBuild.new 2023-03-29 14:01:37.743707565 +0900 @@ -73,6 +73,12 @@ tar xvf $CWD/${SRCPREFIX}${PKGNAM}-$VERSION.tar.?z || exit 1 cd ${SRCPREFIX}${PKGNAM}-$VERSION || exit 1 +# Fix bug 706478: pdfwrite: Substituted TTF CIDFont CID handling +# https://bugs.ghostscript.com/show_bug.cgi?id=706478 +# https://bugzilla.redhat.com/show_bug.cgi?id=2178720 +# +zcat $CWD/0002_ghostscript-10.01.1-pdfwrite-Substituted-TTF-CIDFont-CID-hand.patch.gz | patch -p1 --verbose || exit 1 + # Remove unmaintained garbage: rm -rf freetype jpeg lcms2 libpng libtiff png tiff zlib @@ -118,6 +124,7 @@ --with-fontpath=/usr/share/fonts/TTF \ --with-ijs \ --disable-compile-inits \ + --disable-hidden-visibility \ --enable-dynamic \ --with-system-libtiff \ --enable-cups \ |
[code]
|
--- a/psi/zfcid1.c 2023-03-29 21:35:59.577941735 +0900 +++ b/psi/zfcid1.c 2023-03-29 21:34:19.981951840 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2023 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -77,37 +77,56 @@ int gdbytes = pfont->cidata.common.GDBytes; int gnum = 0; const byte *data; - int i, code; + int i, code = -1; ref rcid; ref *prgnum; + ref *p, *fdict = pfont_dict(pfont); - switch (r_type(pcidmap)) { - case t_string: - if (cid >= r_size(pcidmap) / gdbytes) - return_error(gs_error_rangecheck); - data = pcidmap->value.const_bytes + cid * gdbytes; - break; - case t_integer: - return cid + pcidmap->value.intval; - case t_dictionary: - make_int(&rcid, cid); - code = dict_find(pcidmap, &rcid, &prgnum); - if (code <= 0) - return (code < 0 ? code : gs_note_error(gs_error_undefined)); - if (!r_has_type(prgnum, t_integer)) - return_error(gs_error_typecheck); - return prgnum->value.intval; - default: /* array type */ - code = string_array_access_proc(pfont->memory, pcidmap, 1, cid * gdbytes, - gdbytes, NULL, NULL, &data); - - if (code < 0) - return code; - if ( code > 0 ) - return_error(gs_error_invalidfont); + if (r_has_type(fdict, t_dictionary) && dict_find_string(fdict, "Path", &p)) { + ref *Decoding = NULL, *TT_cmap = NULL, *SubstNWP = NULL, src_type, dst_type; + uint c; + + code = dict_find_string(fdict, "Decoding", &Decoding); + if (code > 0) + code = dict_find_string(fdict, "TT_cmap", &TT_cmap); + if (code > 0) + code = dict_find_string(fdict, "SubstNWP", &SubstNWP); + if (code > 0) { + code = cid_to_TT_charcode(pfont->memory, Decoding, TT_cmap, SubstNWP, cid, &c, &src_type, &dst_type); + if (code >= 0) + gnum = c; + } + } + + if (code < 0) { + switch (r_type(pcidmap)) { + case t_string: + if (cid >= r_size(pcidmap) / gdbytes) + return_error(gs_error_rangecheck); + data = pcidmap->value.const_bytes + cid * gdbytes; + break; + case t_integer: + return cid + pcidmap->value.intval; + case t_dictionary: + make_int(&rcid, cid); + code = dict_find(pcidmap, &rcid, &prgnum); + if (code <= 0) + return (code < 0 ? code : gs_note_error(gs_error_undefined)); + if (!r_has_type(prgnum, t_integer)) + return_error(gs_error_typecheck); + return prgnum->value.intval; + default: /* array type */ + code = string_array_access_proc(pfont->memory, pcidmap, 1, cid * gdbytes, + gdbytes, NULL, NULL, &data); + + if (code < 0) + return code; + if ( code > 0 ) + return_error(gs_error_invalidfont); + } + for (i = 0; i < gdbytes; ++i) + gnum = (gnum << 8) + data[i]; } - for (i = 0; i < gdbytes; ++i) - gnum = (gnum << 8) + data[i]; if (gnum >= pfont->data.trueNumGlyphs) return_error(gs_error_invalidfont); return gnum; |
Related Links :
from commitdiff at projects / ghostpdl.git / commitdiff
Bug 706478: pdfwrite: Substituted TTF CIDFont CID handling
-------------------------------------------------
author Chris Liddell <chris.liddell@artifex.com>
Thu, 16 Mar 2023 00:38:29 +0900 (15:38 +0000)
committer Chris Liddell <chris.liddell@artifex.com>
Thu, 16 Mar 2023 02:01:03 +0900 (17:01 +0000)
The PS interpreter callback that handles converting a CID to a TTF GID did
not handle the case of substituted CIDFonts.
It requires looking up the CID on the Decoding (to get a Unicode code point),
and then looking up the code point in the TTF cmap table to get the GID.
The rendering code already handled it.
Thu, 16 Mar 2023 00:38:29 +0900 (15:38 +0000)
committer Chris Liddell <chris.liddell@artifex.com>
Thu, 16 Mar 2023 02:01:03 +0900 (17:01 +0000)
The PS interpreter callback that handles converting a CID to a TTF GID did
not handle the case of substituted CIDFonts.
It requires looking up the CID on the Decoding (to get a Unicode code point),
and then looking up the code point in the TTF cmap table to get the GID.
The rendering code already handled it.
----------------------------------------------------------
TEST pdfwrite
test file : I used gscjk_aj.ps ( /usr/share/ghostscript/10.01.0/examples/cjk/gscjk_aj.ps )
test commands :
Test-1)
gs -dBATCH -dNOPAUSE -sDEVICE=pnggray -sOutputFile=gscjk_aj.png -f gscjk_aj.ps
|
$ gs -dBATCH -dNOPAUSE -sDEVICE=pnggray -sOutputFile=gscjk_aj.png -f gscjk_aj.ps GPL Ghostscript 10.01.0 (2023-03-22) Copyright (C) 2023 Artifex Software, Inc. All rights reserved. This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY: see the file COPYING for details. ------------------------------------------------------------------------ This is a script to test CJK fonts such as CID-keyed fonts. If you have not done CID-keyed fonts installation and definitions at /Resource/CMap and CIDFnmap or /Resource/CIDFont of ghostscript, then this script can't work correctly. For details, please see README at http://www.gyve.org/gs-cjk/supplement. If you throw this script into a printer, it requires PostScript 3 printer and CID-keyed fonts specified in this script. ------------------------------------------------------------------------ Querying operating system for font files... Loading a TT font from /usr/share/fonts/TrueType/ipam.ttf to emulate a CID font ipam ... Done. Loading a TT font from /usr/share/fonts/TrueType/ipag.ttf to emulate a CID font ipag ... Done. Loading NimbusRoman-Regular font from /usr/share/ghostscript/10.01.0/Resource/Font/NimbusRoman-Regular... 7630892 6243202 9666024 3647182 1 done. |
$ display gscjk_aj.png
Test-2)
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=gscjk_aj.pdf -f gscjk_aj.ps
|
$ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=gscjk_aj.pdf -f gscjk_aj.ps GPL Ghostscript 10.01.0 (2023-03-22) Copyright (C) 2023 Artifex Software, Inc. All rights reserved. This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY: see the file COPYING for details. ------------------------------------------------------------------------ This is a script to test CJK fonts such as CID-keyed fonts. If you have not done CID-keyed fonts installation and definitions at /Resource/CMap and CIDFnmap or /Resource/CIDFont of ghostscript, then this script can't work correctly. For details, please see README at http://www.gyve.org/gs-cjk/supplement. If you throw this script into a printer, it requires PostScript 3 printer and CID-keyed fonts specified in this script. ------------------------------------------------------------------------ Querying operating system for font files... Loading a TT font from /usr/share/fonts/TrueType/ipam.ttf to emulate a CID font ipam ... Done. Loading a TT font from /usr/share/fonts/TrueType/ipag.ttf to emulate a CID font ipag ... Done. Loading NimbusRoman-Regular font from /usr/share/ghostscript/10.01.0/Resource/Font/NimbusRoman-Regular... 8210700 6835257 9323984 3301350 1 done. |
$ xpdf gscjk_aj.pdf
(memo)
I'm using IPA TTF fonts for my ghostscript instead of sazanami fonts.
The cidfmap for IPA fonts which I'm using is below.
cidfmap.sample
|
%! % This is a sample map file for CIDFont category. % % The map is a set of records, which must use one of the two formats : % % 1. A substutution of a CIDFont font with another CIDFont : % % /substituted /original ; % % Where 'substituted' is a name being used in a document, % 'original' is a name of an available resource. % % 2. A substutution of a CIDFont font with a True Type font : % % /substituted << /FileType /TrueType /Path (path) /SubfontID 1 /CSI [(ordering) supplement] >> ; % % Where 'substituted' is a name being used in a document, % 'path' is a path to a True Type font file, % 'ordering' is a value of Ordering required for CIDSystemInfo dictionary, % 'supplement' is a value of Supplement required for CIDSystemInfo dictionary. % 'SubfontID' is the index of the desired font in a TTC - ignored if the target is not a TTC. % % The Ordering, and Registry (if present) entries should be PostScript string types % ie enclosed in parentheses, not PostScript name type (initial character '/'). See % gs/doc/Use.htm#CIDFontSubstitution % % Alternatively: % (substituted name) << /FileType /TrueType /Path (path) /SubfontID 1 /CSI [(ordering) supplement] >> ; % % This is where the CIDFont name in the document contains a space character. Using a string instead of a name % allows this work - Ghostscript will internally convert the key string with a space to a name. % % % Examples : % % /ShinGo-Bold /HeiseiKakuGo-W5 ; % /Ryumin-Medium << /FileType /TrueType /Path (H:/AuxFiles/Fonts/BATANG.TTC) /SubfontID 3 /CSI [(Japan1) 2] >> ; % /Ryumin-Medium << /FileType /TrueType /Path (windir) getenv not {(c:/windows)}if (/Fonts/BATANG.TTC)concatstrings /SubfontID 3 /CSI [(Japan1) 2] >> ; % % NOTE: getenv returns a boolean to indicate success of or failure, as well as the value on success. In the example, it uses this % to include a default value should getenv fail. % % (Century Gothic) << /FileType /TrueType /Path (/usr/share/fonts/truetype/fonts-japanese-gothic.ttf) /CSI [(Identity) 1] >> ; % % Note the use of a string to cope with the name containing a space. % %% cidfmap.zh_CN (simplified Chinese ; zh_CN) %% This font will produce better results than the wqy-zenhei.ttc that we use %% to get out-of-the-box output. %% If you install it, uncomment the line below and comment the one below that. %/BousungEG-Light-GB << /FileType /TrueType /Path (uming.ttf) /CSI [(GB1) 4] >> ; /BousungEG-Light-GB << /FileType /TrueType /Path (wqy-zenhei.ttc) /CSI [(GB1) 4] >> ; %% This font will produce better results than the wqy-zenhei.ttc that we use %% to get out-of-the-box output. %% If you install it, uncomment the line below and comment the one below that. %/GBZenKai-Medium << /FileType /TrueType /Path (ukai.ttf) /CSI [(GB1) 4] >> ; /GBZenKai-Medium << /FileType /TrueType /Path (wqy-zenhei.ttc) /CSI [(GB1) 4] >> ; /MSungGBK-Light << /FileType /TrueType /Path (wqy-zenhei.ttc) /CSI [(GB1) 4] >> ; /MSung-Light /MSungGBK-Light ; /MSung-Medium /GBZenKai-Medium ; /MHei-Medium /BousungEG-Light-GB ; /MKai-Medium /GBZenKai-Medium ; /STSong-Light /BousungEG-Light-GB ; /STFangsong-Light /BousungEG-Light-GB ; /STHeiti-Regular /MSungGBK-Light ; /STKaiti-Regular /GBZenKai-Medium ; /Adobe-GB1 /BousungEG-Light-GB ; %% cidfmap.zh_TW (traditional Chinese ; zh_TW) %% To use this example, install the missing uming.ttf and ukai.ttf fonts, and %% uncomment everything in the block below. Also, fix the simplified Chinese %% block as described above for "better output" so that there is no %% interference (or comment the whole block out). %/BousungEG-Light-GB << /FileType /TrueType /Path (uming.ttf) /CSI [(CNS1) 4] >> ; %/ZenKai-Medium << /FileType /TrueType /Path (ukai.ttf) /CSI [(CNS1) 4] >> ; %/ShanHeiSun-Light << /FileType /TrueType /Path (wqy-zenhei.ttc) /CSI [(CNS1) 4] >> ; %/STSong-Light /BousungEG-Light-GB ; %/STKaiti-Regular /ZenKai-Medium-GB ; %/STFangsong-Light /BousungEG-Light ; %/STHeiti-Regular /MHei-Medium ; %/MSung-Light /BousungEG-Light-GB ; %/MSung-Medium /ZenKai-Medium ; %/MHei-Medium /ShanHeiSun-Light ; %/MKai-Medium /ZenKai-Medium ; %/Adobe-CNS1 /BousungEG-Light-GB ; %% cidfmap.ja /ipag << /FileType /TrueType /Path (ipag.ttf) /SubfontID 0 /CSI [ (Japan1) 5 ] >> ; /ipagp << /FileType /TrueType /Path (ipagp.ttf) /SubfontID 0 /CSI [ (Japan1) 5 ] >> ; /ipagui << /FileType /TrueType /Path (ipagui.ttf) /SubfontID 0 /CSI [ (Japan1) 5 ] >> ; /ipam << /FileType /TrueType /Path (ipam.ttf) /SubfontID 0 /CSI [ (Japan1) 5 ] >> ; /ipamp << /FileType /TrueType /Path (ipamp.ttf) /SubfontID 0 /CSI [ (Japan1) 5 ] >> ; /Ryumin-Light /ipam ; /Ryumin-Medium /ipam ; /GothicBBB-Medium /ipag ; /ChuGothicBBB-Medium /GothicBBB-Medium ; /ChuGothicBBB-Medium-Mono /MS-Gothic ; /FutoGoB101-Bold /GothicBBB-Medium ; /FutoMinA101-Bold /Ryumin-Light ; /GothicMB101-Bold /GothicBBB-Medium ; /GothicMB101-hea /GothicBBB-Medium ; /GothicMB101-Ult /GothicBBB-Medium ; /ShinGo-Bold /GothicBBB-Medium ; /ShinGo-Medium /GothicBBB-Medium ; /ShinGo-regular /GothicBBB-Medium ; /MS-Gothic /ipag ; /MS-PGothic /ipagp ; /MSPGothic /ipagp ; /MS-UIGothic /ipagui ; /MSMincho /ipam ; /MS-Mincho /ipam ; /MS-PMincho /ipamp ; /MSPMincho /ipamp ; /HeiseiMin-W3 /Ryumin-Light ; /HeiseiKakuGo-W5 /GothicBBB-Medium ; /Kochi-Mincho /Ryumin-Light ; /Kochi-Gothic /GothicBBB-Medium ; /WadaMin-Regular /ipam ; /WadaMin-RegularH /ipam ; /WadaMin-Bold /ipam ; /WadaGo-Regular /ipag ; /WadaGo-Bold /ipag ; /Adobe-Japan1 /Ryumin-Light ; /Adobe-Japan2 /Ryumin-Light ; %% cidfmap.ko %% To enable Korean printing support, install the fonts shown in the example %% here and uncomment the block below: %/Baekmuk-Batang << /FileType /TrueType /Path (batang.ttf) /CSI [(Korea1) 2] >> ; %/Baekmuk-Batang-Regular /Baekmuk-Batang ; %/Baekmuk-Dotum << /FileType /TrueType /Path (dotum.ttf) /CSI [(Korea1) 2] >> ; %/Baekmuk-Dotum-Regular /Baekmuk-Dotum ; %/Baekmuk-Gulim << /FileType /TrueType /Path (gulim.ttf) /CSI [(Korea1) 2] >> ; %/Baekmuk-Gulim-Regular /Baekmuk-Gulim ; %/Baekmuk-Headline << /FileType /TrueType /Path (hline.ttf) /CSI [(Korea1) 2] >> ; %/Baekmuk-Headline-Regular /Baekmuk-Headline ; %/Adobe-Korea1 /Baekmuk-Batang ; %/BousungEG-Light-GB << /FileType /TrueType /Path (uming.ttf) /CSI [(GB1) 4] >> ; %/GBZenKai-Medium << /FileType /TrueType /Path (ukai.ttf) /CSI [(GB1) 4] >> ; %/MSungGBK-Light /BousungEG-Light-GB ; %/Adobe-GB1 /BousungEG-Light-GB ; %/ZenKai-Medium << /FileType /TrueType /Path (ukai.ttf) /CSI [(CNS1) 4] >> ; %/ShanHeiSun-Light << /FileType /TrueType /Path (uming.ttf) /CSI [(CNS1) 4] >> ; %/Adobe-CNS1 /ShanHeiSun-Light ; |
---
[2023-03-29] 新規
[ ]


![deepl-clip.sh で簡単翻訳 [更新:2025-04-29]](https://resize.blogsys.jp/fc265bdb808435596af7a249f59820084c144620/crop1/120x120_ffffff/https://livedoor.blogimg.jp/jw_slackware/imgs/0/d/0d2fff59-s.png)






