Merge lp:~stefanor/ubuntu/maverick/ghostscript/defoma-removal into lp:ubuntu/maverick/ghostscript
- Maverick (10.10)
- defoma-removal
- Merge into maverick
Proposed by
Stefano Rivera
Status: | Merged |
---|---|
Merge reported by: | James Westby |
Merged at revision: | not available |
Proposed branch: | lp:~stefanor/ubuntu/maverick/ghostscript/defoma-removal |
Merge into: | lp:ubuntu/maverick/ghostscript |
Diff against target: |
1202 lines (+63/-1013) 11 files modified
debian/changelog (+8/-0) debian/control (+1/-2) debian/dirs (+4/-3) debian/ghostscript.links (+1/-1) debian/ghostscript.postinst (+9/-15) debian/ghostscript.postrm (+0/-44) debian/ghostscript.preinst (+9/-2) debian/ghostscript.prerm (+5/-9) debian/gs.defoma (+0/-930) debian/rules (+6/-7) debian/update-gsfontmap (+20/-0) |
To merge this branch: | bzr merge lp:~stefanor/ubuntu/maverick/ghostscript/defoma-removal |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Sponsors | Pending | ||
Ubuntu branches | Pending | ||
Review via email: mp+25850@code.launchpad.net |
Commit message
Description of the change
Ghostscript is missing a defoma removal patch. The accompanying patch in gsfonts made it into Ubuntu already.
Without this, albatross FTBFS
To post a comment you must log in.
- 70. By Stefano Rivera
-
Merge Debian's defoma-removal patch from Deb Bug #582113
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2010-04-29 09:43:23 +0000 | |||
3 | +++ debian/changelog 2010-05-23 18:44:26 +0000 | |||
4 | @@ -1,3 +1,11 @@ | |||
5 | 1 | ghostscript (8.71.dfsg.1-0ubuntu5.2) maverick; urgency=low | ||
6 | 2 | |||
7 | 3 | * Merge changes from 8.71~dfsg2-1.1 (LP: #584597): | ||
8 | 4 | - Drop defoma. | ||
9 | 5 | - Add update-gsfontmap to provide cidfmap and Fontmap. | ||
10 | 6 | |||
11 | 7 | -- Stefano Rivera <stefano@rivera.za.net> Sun, 23 May 2010 18:13:43 +0200 | ||
12 | 8 | |||
13 | 1 | ghostscript (8.71.dfsg.1-0ubuntu5.1) lucid-proposed; urgency=low | 9 | ghostscript (8.71.dfsg.1-0ubuntu5.1) lucid-proposed; urgency=low |
14 | 2 | 10 | ||
15 | 3 | * debian/patches/pdf-interpreter-segfault-fixes.dpatch, | 11 | * debian/patches/pdf-interpreter-segfault-fixes.dpatch, |
16 | 4 | 12 | ||
17 | === modified file 'debian/control' | |||
18 | --- debian/control 2010-02-11 11:31:23 +0000 | |||
19 | +++ debian/control 2010-05-23 18:44:26 +0000 | |||
20 | @@ -15,9 +15,8 @@ | |||
21 | 15 | Conflicts: gs (<< 8.63), gs-esp (<< 8.63), gs-gpl (<< 8.63), gs-afpl (<< 8.63), gs-aladdin (<< 8.63), gs-cjk-resource (<< 1.20010910-1), gs-pdfencrypt (<< 7.00), gs-common (<< 8.63), ghostscript-fonts | 15 | Conflicts: gs (<< 8.63), gs-esp (<< 8.63), gs-gpl (<< 8.63), gs-afpl (<< 8.63), gs-aladdin (<< 8.63), gs-cjk-resource (<< 1.20010910-1), gs-pdfencrypt (<< 7.00), gs-common (<< 8.63), ghostscript-fonts |
22 | 16 | Replaces: gs (<< 8.63), gs-esp (<< 8.63), gs-gpl (<< 8.63), gs-afpl (<< 8.63), gs-aladdin (<< 8.63), gs-pdfencrypt (<< 7.00), gs-common (<< 8.63), ghostscript-fonts | 16 | Replaces: gs (<< 8.63), gs-esp (<< 8.63), gs-gpl (<< 8.63), gs-afpl (<< 8.63), gs-aladdin (<< 8.63), gs-pdfencrypt (<< 7.00), gs-common (<< 8.63), ghostscript-fonts |
23 | 17 | Provides: gs-pdfencrypt, postscript-viewer, gs-common | 17 | Provides: gs-pdfencrypt, postscript-viewer, gs-common |
24 | 18 | Recommends: psfontmgr | ||
25 | 19 | Suggests: ghostscript-cups, ghostscript-x, hpijs | 18 | Suggests: ghostscript-cups, ghostscript-x, hpijs |
27 | 20 | Depends: ${shlibs:Depends}, gsfonts (>= 6.0-1), defoma, debconf | debconf-2.0, debianutils (>= 1.6), libgs8 (= ${binary:Version}), ${misc:Depends} | 19 | Depends: ${shlibs:Depends}, gsfonts (>= 6.0-1), debconf | debconf-2.0, debianutils (>= 1.6), libgs8 (= ${binary:Version}), ${misc:Depends} |
28 | 21 | Description: The GPL Ghostscript PostScript/PDF interpreter | 20 | Description: The GPL Ghostscript PostScript/PDF interpreter |
29 | 22 | Ghostscript is used for PostScript/PDF preview and printing. Usually as | 21 | Ghostscript is used for PostScript/PDF preview and printing. Usually as |
30 | 23 | a back-end to a program such as ghostview, it can display PostScript and PDF | 22 | a back-end to a program such as ghostview, it can display PostScript and PDF |
31 | 24 | 23 | ||
32 | === modified file 'debian/dirs' | |||
33 | --- debian/dirs 2007-05-21 13:00:21 +0000 | |||
34 | +++ debian/dirs 2010-05-23 18:44:26 +0000 | |||
35 | @@ -1,5 +1,6 @@ | |||
36 | 1 | usr/bin | 1 | usr/bin |
37 | 2 | usr/share/defoma/scripts | 2 | usr/share/defoma/scripts |
41 | 3 | etc/defoma/config | 3 | etc/ghostscript/cidfmap.d |
42 | 4 | var/lib/defoma/gs.d/dirs/fonts | 4 | etc/ghostscript/fontmap.d |
43 | 5 | var/lib/defoma/gs.d/dirs/CMap | 5 | var/lib/ghostscript/CMap |
44 | 6 | var/lib/ghostscript/fonts | ||
45 | 6 | 7 | ||
46 | === modified file 'debian/ghostscript.links' | |||
47 | --- debian/ghostscript.links 2010-02-11 11:31:23 +0000 | |||
48 | +++ debian/ghostscript.links 2010-05-23 18:44:26 +0000 | |||
49 | @@ -1,4 +1,4 @@ | |||
51 | 1 | var/lib/defoma/gs.d/dirs/CMap usr/share/ghostscript/8.71/Resource/CMap | 1 | var/lib/ghostscript/CMap usr/share/ghostscript/8.71/Resource/CMap |
52 | 2 | var/lib/defoma/gs.d/dirs/CMap usr/share/ghostscript/CMap | 2 | var/lib/defoma/gs.d/dirs/CMap usr/share/ghostscript/CMap |
53 | 3 | usr/bin/ps2ascii usr/bin/ps2txt | 3 | usr/bin/ps2ascii usr/bin/ps2txt |
54 | 4 | usr/share/man/de/man1/ps2ps.1.gz usr/share/man/de/man1/eps2eps.1.gz | 4 | usr/share/man/de/man1/ps2ps.1.gz usr/share/man/de/man1/eps2eps.1.gz |
55 | 5 | 5 | ||
56 | === modified file 'debian/ghostscript.postinst' | |||
57 | --- debian/ghostscript.postinst 2009-05-18 23:19:49 +0000 | |||
58 | +++ debian/ghostscript.postinst 2010-05-23 18:44:26 +0000 | |||
59 | @@ -19,21 +19,15 @@ | |||
60 | 19 | 19 | ||
61 | 20 | case "$1" in | 20 | case "$1" in |
62 | 21 | configure) | 21 | configure) |
78 | 22 | # /usr/bin/ps2pdf is now controlled by update-alternatives | 22 | # /usr/bin/ps2pdf is now controlled by update-alternatives |
79 | 23 | update-alternatives --install /usr/bin/ps2pdf \ | 23 | update-alternatives --install /usr/bin/ps2pdf \ |
80 | 24 | ps2pdf /usr/bin/ps2pdf14 50 | 24 | ps2pdf /usr/bin/ps2pdf14 50 |
81 | 25 | update-alternatives --install /usr/bin/ps2pdf \ | 25 | update-alternatives --install /usr/bin/ps2pdf \ |
82 | 26 | ps2pdf /usr/bin/ps2pdf12 30 | 26 | ps2pdf /usr/bin/ps2pdf12 30 |
83 | 27 | update-alternatives --install /usr/bin/ps2pdf \ | 27 | update-alternatives --install /usr/bin/ps2pdf \ |
84 | 28 | ps2pdf /usr/bin/ps2pdf13 40 | 28 | ps2pdf /usr/bin/ps2pdf13 40 |
85 | 29 | 29 | ||
86 | 30 | # Make sure the substitution file for Ghostscript exists | 30 | update-gsfontmap |
72 | 31 | if ! defoma-subst check-rule ghostscript; then | ||
73 | 32 | defoma-subst new-rule ghostscript | ||
74 | 33 | fi | ||
75 | 34 | |||
76 | 35 | defoma-app -t update gs | ||
77 | 36 | |||
87 | 37 | ;; | 31 | ;; |
88 | 38 | 32 | ||
89 | 39 | abort-upgrade|abort-remove|abort-deconfigure) | 33 | abort-upgrade|abort-remove|abort-deconfigure) |
90 | 40 | 34 | ||
91 | === removed file 'debian/ghostscript.postrm' | |||
92 | --- debian/ghostscript.postrm 2007-05-21 13:00:21 +0000 | |||
93 | +++ debian/ghostscript.postrm 1970-01-01 00:00:00 +0000 | |||
94 | @@ -1,44 +0,0 @@ | |||
95 | 1 | #! /bin/sh | ||
96 | 2 | # postrm script for ghostscript | ||
97 | 3 | # | ||
98 | 4 | # see: dh_installdeb(1) | ||
99 | 5 | |||
100 | 6 | set -e | ||
101 | 7 | |||
102 | 8 | # summary of how this script can be called: | ||
103 | 9 | # * <postrm> `remove' | ||
104 | 10 | # * <postrm> `purge' | ||
105 | 11 | # * <old-postrm> `upgrade' <new-version> | ||
106 | 12 | # * <new-postrm> `failed-upgrade' <old-version> | ||
107 | 13 | # * <new-postrm> `abort-install' | ||
108 | 14 | # * <new-postrm> `abort-install' <old-version> | ||
109 | 15 | # * <new-postrm> `abort-upgrade' <old-version> | ||
110 | 16 | # * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version> | ||
111 | 17 | # for details, see http://www.debian.org/doc/debian-policy/ or | ||
112 | 18 | # the debian-policy package | ||
113 | 19 | |||
114 | 20 | |||
115 | 21 | case "$1" in | ||
116 | 22 | remove) | ||
117 | 23 | # Remove defoma directory | ||
118 | 24 | rm -rf /var/lib/defoma/gs.d | ||
119 | 25 | ;; | ||
120 | 26 | purge) | ||
121 | 27 | # Remove defoma-related files | ||
122 | 28 | rm -f /etc/defoma/ghostscript.subst-rule | ||
123 | 29 | rm -f /etc/defoma/ghostscript.subst-rule~ | ||
124 | 30 | ;; | ||
125 | 31 | upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) | ||
126 | 32 | ;; | ||
127 | 33 | *) | ||
128 | 34 | echo "postrm called with unknown argument \`$1'" >&2 | ||
129 | 35 | exit 1 | ||
130 | 36 | |||
131 | 37 | esac | ||
132 | 38 | |||
133 | 39 | # dh_installdeb will replace this with shell code automatically | ||
134 | 40 | # generated by other debhelper scripts. | ||
135 | 41 | |||
136 | 42 | #DEBHELPER# | ||
137 | 43 | |||
138 | 44 | exit 0 | ||
139 | 45 | 0 | ||
140 | === modified file 'debian/ghostscript.preinst' | |||
141 | --- debian/ghostscript.preinst 2009-01-05 12:21:45 +0000 | |||
142 | +++ debian/ghostscript.preinst 2010-05-23 18:44:26 +0000 | |||
143 | @@ -17,13 +17,20 @@ | |||
144 | 17 | 17 | ||
145 | 18 | case "$1" in | 18 | case "$1" in |
146 | 19 | install|upgrade) | 19 | install|upgrade) |
149 | 20 | # Do away with update-alternative for /usr/bin/gs, we have one | 20 | # Do away with update-alternative for /usr/bin/gs, we have one |
150 | 21 | # grand unified Ghostscript now! | 21 | # grand unified Ghostscript now! |
151 | 22 | if dpkg --compare-versions "$2" lt-nl "8.63.dfsg.1-1"; then | 22 | if dpkg --compare-versions "$2" lt-nl "8.63.dfsg.1-1"; then |
152 | 23 | update-alternatives --remove-all gs || true | 23 | update-alternatives --remove-all gs || true |
153 | 24 | update-alternatives --remove-all gs.1 || true | 24 | update-alternatives --remove-all gs.1 || true |
154 | 25 | fi | 25 | fi |
155 | 26 | 26 | ||
156 | 27 | # Remove obsolete defoma files | ||
157 | 28 | if dpkg --compare-versions "$2" lt-nl "8.71~dfsg1.0ubuntu5.1"; then | ||
158 | 29 | rm -rf /var/lib/defoma/gs.d | ||
159 | 30 | rm -f /etc/defoma/ghostscript.subst-rule | ||
160 | 31 | rm -f /etc/defoma/ghostscript.subst-rule~ | ||
161 | 32 | rm -f /var/lib/defoma/ghostscript.subst-cache | ||
162 | 33 | fi | ||
163 | 27 | ;; | 34 | ;; |
164 | 28 | 35 | ||
165 | 29 | abort-upgrade) | 36 | abort-upgrade) |
166 | 30 | 37 | ||
167 | === modified file 'debian/ghostscript.prerm' | |||
168 | --- debian/ghostscript.prerm 2007-05-22 21:38:21 +0000 | |||
169 | +++ debian/ghostscript.prerm 2010-05-23 18:44:26 +0000 | |||
170 | @@ -20,16 +20,12 @@ | |||
171 | 20 | case "$1" in | 20 | case "$1" in |
172 | 21 | remove) | 21 | remove) |
173 | 22 | # install-info --quiet --remove /usr/info/ghostscript.info.gz | 22 | # install-info --quiet --remove /usr/info/ghostscript.info.gz |
179 | 23 | if type defoma-app >/dev/null 2>&1; then | 23 | rm -f /var/lib/ghostscript/fonts/cidfmap \ |
180 | 24 | defoma-app -t purge gs | 24 | /var/lib/ghostscript/fonts/Fontmap |
181 | 25 | fi | 25 | update-alternatives --remove-all ps2pdf |
182 | 26 | update-alternatives --remove-all ps2pdf | 26 | ;; |
178 | 27 | ;; | ||
183 | 28 | upgrade) | 27 | upgrade) |
188 | 29 | if type defoma-app >/dev/null 2>&1; then | 28 | update-alternatives --remove-all ps2pdf |
185 | 30 | defoma-app -t clean gs | ||
186 | 31 | update-alternatives --remove-all ps2pdf | ||
187 | 32 | fi | ||
189 | 33 | ;; | 29 | ;; |
190 | 34 | deconfigure) | 30 | deconfigure) |
191 | 35 | # install-info --quiet --remove /usr/info/ghostscript.info.gz | 31 | # install-info --quiet --remove /usr/info/ghostscript.info.gz |
192 | 36 | 32 | ||
193 | === removed file 'debian/gs.defoma' | |||
194 | --- debian/gs.defoma 2007-05-21 13:00:21 +0000 | |||
195 | +++ debian/gs.defoma 1970-01-01 00:00:00 +0000 | |||
196 | @@ -1,930 +0,0 @@ | |||
197 | 1 | # | ||
198 | 2 | # gs.defoma: Defoma support for Ghostscripts | ||
199 | 3 | # | ||
200 | 4 | |||
201 | 5 | @ACCEPT_CATEGORIES = qw(type1 type3 gsfontderivative truetype cid | ||
202 | 6 | cmap psprint); | ||
203 | 7 | |||
204 | 8 | package gs; | ||
205 | 9 | use strict; | ||
206 | 10 | use POSIX; | ||
207 | 11 | |||
208 | 12 | use vars qw($DEFOMA_TEST_DIR $ROOTDIR); | ||
209 | 13 | |||
210 | 14 | use Debian::Defoma::Common; | ||
211 | 15 | use Debian::Defoma::Font; | ||
212 | 16 | use Debian::Defoma::Id; | ||
213 | 17 | use Debian::Defoma::Subst; | ||
214 | 18 | import Debian::Defoma::Font; | ||
215 | 19 | import Debian::Defoma::Id; | ||
216 | 20 | import Debian::Defoma::Subst; | ||
217 | 21 | import Debian::Defoma::Common; | ||
218 | 22 | |||
219 | 23 | my $Id; | ||
220 | 24 | my $IdCmap; | ||
221 | 25 | my $Sb1; | ||
222 | 26 | my $Sb2; | ||
223 | 27 | |||
224 | 28 | my $PkgDir = "$ROOTDIR/gs.d"; | ||
225 | 29 | my $CidDir = "$PkgDir/dirs/CIDFont"; | ||
226 | 30 | my $CMapDir = "$PkgDir/dirs/CMap"; | ||
227 | 31 | my $TTCidDir = "$PkgDir/dirs/TTCIDFont"; | ||
228 | 32 | my $FontDir = "$PkgDir/dirs/fonts"; | ||
229 | 33 | my $FontMap = "$FontDir/Fontmap"; # F | ||
230 | 34 | my $CIDFontMap = "$FontDir/CIDFnmap"; # FF | ||
231 | 35 | my $Subst4psprint = 0; | ||
232 | 36 | # For Ghostscript 8 or later | ||
233 | 37 | my $FAPIfmap = "$FontDir/FAPIfontmap"; # FFF | ||
234 | 38 | my $Cidfmap = "$FontDir/cidfmap"; # FFFF | ||
235 | 39 | |||
236 | 40 | sub init { | ||
237 | 41 | unless ($Id) { | ||
238 | 42 | $Id = defoma_id_open_cache(); | ||
239 | 43 | } | ||
240 | 44 | unless ($IdCmap) { | ||
241 | 45 | $IdCmap = defoma_id_open_cache('cmap'); | ||
242 | 46 | } | ||
243 | 47 | unless ($Sb1) { | ||
244 | 48 | $Sb1 = defoma_subst_open(rulename => 'psprint', threshold => 50, | ||
245 | 49 | idobject => $Id, private => 1); | ||
246 | 50 | } | ||
247 | 51 | unless ($Sb2) { | ||
248 | 52 | $Sb2 = defoma_subst_open(rulename => 'ghostscript', threshold => 30, | ||
249 | 53 | idobject => $Id); | ||
250 | 54 | } | ||
251 | 55 | |||
252 | 56 | return 0; | ||
253 | 57 | } | ||
254 | 58 | |||
255 | 59 | sub term { | ||
256 | 60 | my @list; | ||
257 | 61 | my $i; | ||
258 | 62 | |||
259 | 63 | if ($Id) { | ||
260 | 64 | if (open(F, '>' . $FontMap) && open(FF, '>' . $CIDFontMap) && | ||
261 | 65 | open(FFF, '>' . $FAPIfmap) && open(FFFF, '>' . $Cidfmap)) { | ||
262 | 66 | @list = defoma_id_get_font($Id, 'installed'); | ||
263 | 67 | |||
264 | 68 | foreach $i (@list) { | ||
265 | 69 | next if ($Id->{2}->[$i] ne 'SrI'); | ||
266 | 70 | my $c = $Id->{4}->[$i]; | ||
267 | 71 | my $f; | ||
268 | 72 | my @h; | ||
269 | 73 | my $cmap; | ||
270 | 74 | my @cmaplist; | ||
271 | 75 | my $j; | ||
272 | 76 | my @ch; | ||
273 | 77 | my %hh; | ||
274 | 78 | |||
275 | 79 | if ($c =~ /^(type1|type3|gsfontderivative)$/) { | ||
276 | 80 | $f = $Id->{1}->[$i]; | ||
277 | 81 | $f =~ s/^.*\///; | ||
278 | 82 | # | ||
279 | 83 | # Spit out $FontDir/Fontmap | ||
280 | 84 | # | ||
281 | 85 | print F '/', $Id->{0}->[$i], ' (', $f, ") ;\n"; | ||
282 | 86 | } elsif ($c =~ /^truetype$/) { | ||
283 | 87 | $f = $Id->{1}->[$i]; | ||
284 | 88 | # | ||
285 | 89 | # Spit out $FontDir/FAPIfontmap | ||
286 | 90 | # | ||
287 | 91 | # FIXME: need to support the sub font id for the collection. | ||
288 | 92 | print FFF '/', $Id->{0}->[$i], ' << /Path (', $f, ') /FontType 1 /FAPI /FreeType /SubfontId ', '0' , " >> ;\n" | ||
289 | 93 | } elsif ($c =~ /^(truetype-cjk|cid)$/) { | ||
290 | 94 | $f = $Id->{1}->[$i]; | ||
291 | 95 | @h = split(/ +/, $Id->{7}->[$i]); | ||
292 | 96 | # | ||
293 | 97 | # Spit out $FontDir/CIDFnmap | ||
294 | 98 | # | ||
295 | 99 | print FF '/', $Id->{0}->[$i], ' (', $f, ') '; | ||
296 | 100 | if ($c eq 'truetype-cjk') { | ||
297 | 101 | print FF '/', $h[0], '-', $h[1], '-', $h[2]; | ||
298 | 102 | } | ||
299 | 103 | print FF " ;\n"; | ||
300 | 104 | # For Ghostscript 8 or later | ||
301 | 105 | if ($c eq 'truetype-cjk') { | ||
302 | 106 | my @hints = defoma_id_get_hints( $Id, $i ); | ||
303 | 107 | my $cidsupplement; | ||
304 | 108 | while (@hints) { | ||
305 | 109 | my $var = shift @hints; | ||
306 | 110 | if ($var eq "--CIDSupplement") { | ||
307 | 111 | $cidsupplement = shift @hints; | ||
308 | 112 | last; | ||
309 | 113 | } | ||
310 | 114 | } | ||
311 | 115 | unless (defined $cidsupplement) { | ||
312 | 116 | print STDERR "No CIDSupplement specified for $Id->{0}->[$i], defaulting to 0.\n"; | ||
313 | 117 | $cidsupplement = 0; | ||
314 | 118 | } | ||
315 | 119 | # | ||
316 | 120 | # Spit out $FontDir/cidfmap | ||
317 | 121 | # | ||
318 | 122 | # FIXME: need to support the sub font id for the collection. | ||
319 | 123 | print FFFF '/', $Id->{0}->[$i], ' << /FileType /TrueType /Path (', $f, ') /SubfontID ', '0', ' /CSI [(', $h[6], ') ', $cidsupplement, "] >> ;\n"; | ||
320 | 124 | } | ||
321 | 125 | } | ||
322 | 126 | } | ||
323 | 127 | |||
324 | 128 | @list = defoma_id_get_font($Id, 'installed'); | ||
325 | 129 | |||
326 | 130 | foreach $i (@list) { | ||
327 | 131 | next if ($Id->{2}->[$i] !~ /^.[aS]/); | ||
328 | 132 | |||
329 | 133 | my $c = $Id->{4}->[$i]; | ||
330 | 134 | # | ||
331 | 135 | # Spit out aliases | ||
332 | 136 | # | ||
333 | 137 | if ($c =~ /^(truetype|type1|type3|gsfontderivative)$/) { | ||
334 | 138 | print F '/', $Id->{0}->[$i], ' /', $Id->{5}->[$i], " ; \n"; | ||
335 | 139 | print FFF '/', $Id->{0}->[$i], ' /', $Id->{5}->[$i], " ; \n"; | ||
336 | 140 | } elsif ($c =~ /^(truetype-cjk|cid)$/) { | ||
337 | 141 | print FF '/', $Id->{0}->[$i], ' /', $Id->{5}->[$i], " ;\n"; | ||
338 | 142 | print FFFF '/', $Id->{0}->[$i], ' /', $Id->{5}->[$i], " ;\n"; | ||
339 | 143 | } | ||
340 | 144 | |||
341 | 145 | } | ||
342 | 146 | |||
343 | 147 | close F; | ||
344 | 148 | close FF; | ||
345 | 149 | close FFF; | ||
346 | 150 | close FFFF; | ||
347 | 151 | unlink($FontMap) unless(-s $FontMap); | ||
348 | 152 | unlink($CIDFontMap) unless(-s $CIDFontMap); | ||
349 | 153 | unlink($FAPIfmap) unless(-s $FAPIfmap); | ||
350 | 154 | unlink($Cidfmap) unless(-s $Cidfmap); | ||
351 | 155 | } | ||
352 | 156 | |||
353 | 157 | defoma_id_close_cache($Id); | ||
354 | 158 | $Id = 0; | ||
355 | 159 | } | ||
356 | 160 | if ($IdCmap) { | ||
357 | 161 | defoma_id_close_cache($IdCmap); | ||
358 | 162 | $IdCmap = 0; | ||
359 | 163 | } | ||
360 | 164 | if ($Sb1) { | ||
361 | 165 | defoma_subst_close($Sb1); | ||
362 | 166 | $Sb1 = 0; | ||
363 | 167 | } | ||
364 | 168 | if ($Sb2) { | ||
365 | 169 | defoma_subst_close($Sb2); | ||
366 | 170 | $Sb2 = 0; | ||
367 | 171 | } | ||
368 | 172 | |||
369 | 173 | return 0; | ||
370 | 174 | } | ||
371 | 175 | |||
372 | 176 | sub create_symlink { | ||
373 | 177 | my $font = shift; | ||
374 | 178 | my $dir = shift || $FontDir; | ||
375 | 179 | |||
376 | 180 | if ($font =~ /^(.*)\/(.+)$/) { | ||
377 | 181 | my $fontpath = $1; | ||
378 | 182 | my $fontfile = $2; | ||
379 | 183 | my $newfile = $dir . '/' . $fontfile; | ||
380 | 184 | |||
381 | 185 | return 1 if (-e $newfile); | ||
382 | 186 | |||
383 | 187 | symlink($font, $newfile) || return 1; | ||
384 | 188 | } else { | ||
385 | 189 | return 1; | ||
386 | 190 | } | ||
387 | 191 | |||
388 | 192 | return 0; | ||
389 | 193 | } | ||
390 | 194 | |||
391 | 195 | sub remove_symlink { | ||
392 | 196 | my $font = shift; | ||
393 | 197 | my $dir = shift || $FontDir; | ||
394 | 198 | |||
395 | 199 | if ($font =~ /^(.*)\/(.+)$/) { | ||
396 | 200 | my $fontpath = $1; | ||
397 | 201 | my $fontfile = $2; | ||
398 | 202 | my $newfile = $dir . '/' . $fontfile; | ||
399 | 203 | |||
400 | 204 | return 1 unless (-l $newfile); | ||
401 | 205 | |||
402 | 206 | unlink($newfile); | ||
403 | 207 | } else { | ||
404 | 208 | return 1; | ||
405 | 209 | } | ||
406 | 210 | |||
407 | 211 | return 0; | ||
408 | 212 | } | ||
409 | 213 | |||
410 | 214 | sub register_ps { | ||
411 | 215 | my $id = shift; | ||
412 | 216 | |||
413 | 217 | defoma_font_register('postscript', '<gs>/' . $id, @_); | ||
414 | 218 | } | ||
415 | 219 | |||
416 | 220 | sub unregister_ps { | ||
417 | 221 | my $id = shift; | ||
418 | 222 | |||
419 | 223 | if (defoma_font_if_register('postscript', '<gs>/' . $id)) { | ||
420 | 224 | defoma_font_unregister('postscript', '<gs>/' . $id); | ||
421 | 225 | } | ||
422 | 226 | } | ||
423 | 227 | |||
424 | 228 | sub t1_register { | ||
425 | 229 | my $type = shift; | ||
426 | 230 | my $font = shift; | ||
427 | 231 | my $h = parse_hints_start(@_); | ||
428 | 232 | |||
429 | 233 | my $fontname = $h->{FontName}; | ||
430 | 234 | return 1 unless ($fontname); | ||
431 | 235 | $fontname =~ s/ .*//; | ||
432 | 236 | |||
433 | 237 | my $priority = $h->{Priority} || 0; | ||
434 | 238 | |||
435 | 239 | my %add; | ||
436 | 240 | $add{hints} = join(' ', @_); | ||
437 | 241 | |||
438 | 242 | if ($type eq 'gsfontderivative') { | ||
439 | 243 | my $ofont = $h->{'GSF-OriginFont'}; | ||
440 | 244 | my $oid = $h->{'GSF-OriginID'}; | ||
441 | 245 | |||
442 | 246 | if ($ofont && $oid) { | ||
443 | 247 | $add{depend} = $ofont.' '.$oid; | ||
444 | 248 | } else { | ||
445 | 249 | return 2; | ||
446 | 250 | } | ||
447 | 251 | } | ||
448 | 252 | |||
449 | 253 | return 3 if (create_symlink($font)); | ||
450 | 254 | |||
451 | 255 | defoma_id_register($Id, type => 'real', font => $font, id => $fontname, | ||
452 | 256 | priority => $priority, %add); | ||
453 | 257 | |||
454 | 258 | my @alias = ($h->{Alias}) ? split(/ +/, $h->{Alias}) : (); | ||
455 | 259 | my $i; | ||
456 | 260 | |||
457 | 261 | foreach $i (@alias) { | ||
458 | 262 | defoma_id_register($Id, type => 'alias', font => $font, id => $i, | ||
459 | 263 | priority => $priority, origin => $fontname); | ||
460 | 264 | } | ||
461 | 265 | |||
462 | 266 | defoma_subst_register($Sb1, $font, $fontname); | ||
463 | 267 | defoma_subst_register($Sb2, $font, $fontname); | ||
464 | 268 | |||
465 | 269 | return 0; | ||
466 | 270 | } | ||
467 | 271 | |||
468 | 272 | sub t1_unregister { | ||
469 | 273 | my $font = shift; | ||
470 | 274 | |||
471 | 275 | defoma_subst_unregister($Sb1, $font); | ||
472 | 276 | defoma_subst_unregister($Sb2, $font); | ||
473 | 277 | defoma_id_unregister($Id, type => 'alias', font => $font); | ||
474 | 278 | defoma_id_unregister($Id, type => 'real', font => $font); | ||
475 | 279 | |||
476 | 280 | remove_symlink($font); | ||
477 | 281 | |||
478 | 282 | return 0; | ||
479 | 283 | } | ||
480 | 284 | |||
481 | 285 | sub t1_install { | ||
482 | 286 | my $type = shift; | ||
483 | 287 | my $font = shift; | ||
484 | 288 | my $id = shift; | ||
485 | 289 | my $depfont = shift; | ||
486 | 290 | my $depid = shift; | ||
487 | 291 | my @add = (); | ||
488 | 292 | |||
489 | 293 | if ($type eq 'real') { | ||
490 | 294 | return 0 if (grep($_ eq '--Alias', @_)); | ||
491 | 295 | |||
492 | 296 | $add[0] = '--RealName'; | ||
493 | 297 | } | ||
494 | 298 | |||
495 | 299 | register_ps($id, @_, @add); | ||
496 | 300 | |||
497 | 301 | return 0; | ||
498 | 302 | } | ||
499 | 303 | |||
500 | 304 | sub t1_remove { | ||
501 | 305 | my $type = shift; | ||
502 | 306 | my $font = shift; | ||
503 | 307 | my $id = shift; | ||
504 | 308 | my $depfont = shift; | ||
505 | 309 | my $depid = shift; | ||
506 | 310 | |||
507 | 311 | unregister_ps($id); | ||
508 | 312 | |||
509 | 313 | return 0; | ||
510 | 314 | } | ||
511 | 315 | |||
512 | 316 | sub type1 { | ||
513 | 317 | my $com = shift; | ||
514 | 318 | |||
515 | 319 | if ($com eq 'register') { | ||
516 | 320 | return t1_register('type1', @_); | ||
517 | 321 | } elsif ($com eq 'unregister') { | ||
518 | 322 | return t1_unregister(@_); | ||
519 | 323 | } elsif ($com =~ /^do-install-(.*)$/) { | ||
520 | 324 | return t1_install($1, @_); | ||
521 | 325 | } elsif ($com =~ /^do-remove-(.*)$/) { | ||
522 | 326 | return t1_remove($1, @_); | ||
523 | 327 | } elsif ($com eq 'init') { | ||
524 | 328 | return init(); | ||
525 | 329 | } elsif ($com eq 'term') { | ||
526 | 330 | return term(); | ||
527 | 331 | } | ||
528 | 332 | |||
529 | 333 | return 0; | ||
530 | 334 | } | ||
531 | 335 | |||
532 | 336 | sub type3 { | ||
533 | 337 | return type1(@_); | ||
534 | 338 | } | ||
535 | 339 | |||
536 | 340 | sub gsfontderivative { | ||
537 | 341 | my $com = shift; | ||
538 | 342 | |||
539 | 343 | if ($com eq 'register') { | ||
540 | 344 | return t1_register('gsfontderivative', @_); | ||
541 | 345 | } else { | ||
542 | 346 | return type1($com, @_); | ||
543 | 347 | } | ||
544 | 348 | } | ||
545 | 349 | |||
546 | 350 | sub tt_register_cjk { | ||
547 | 351 | my %addstr = ('Japanese' => '-Ja', | ||
548 | 352 | 'Korean' => '-Ko', | ||
549 | 353 | 'Chinese-China' => '-GB', | ||
550 | 354 | 'Chinese-Taiwan' => '-CNS'); | ||
551 | 355 | my %ordering = ('Japanese' => 'Japan1', | ||
552 | 356 | 'Korean' => 'Korea1', | ||
553 | 357 | 'Chinese-China' => 'GB1', | ||
554 | 358 | 'Chinese-Taiwan' => 'CNS1'); | ||
555 | 359 | my %coding = ('Unicode' => 'Unicode', | ||
556 | 360 | 'BIG5' => 'Big5', | ||
557 | 361 | 'ShiftJIS' => 'ShiftJIS', | ||
558 | 362 | 'WanSung' => 'WanSung', | ||
559 | 363 | 'Johab' => 'Johab'); | ||
560 | 364 | |||
561 | 365 | my $cnt = shift; | ||
562 | 366 | my $loc = shift; | ||
563 | 367 | my $font = shift; | ||
564 | 368 | my $fontname = shift; | ||
565 | 369 | my $alias = shift; | ||
566 | 370 | my $charset = shift; | ||
567 | 371 | my $encoding = shift; | ||
568 | 372 | my $priority = shift; | ||
569 | 373 | |||
570 | 374 | return $cnt unless (exists($addstr{$loc}) && exists($ordering{$loc}) && | ||
571 | 375 | exists($coding{$encoding})); | ||
572 | 376 | my $ord = $ordering{$loc}; | ||
573 | 377 | my $enc = $coding{$encoding}; | ||
574 | 378 | |||
575 | 379 | my $add = ''; | ||
576 | 380 | $add = $addstr{$loc} if ($cnt > 0); | ||
577 | 381 | |||
578 | 382 | my @hints = ('Adobe', $ord, $enc, | ||
579 | 383 | '--CIDRegistry', 'Adobe', '--CIDOrdering', $ord); | ||
580 | 384 | |||
581 | 385 | defoma_id_register($Id, type => 'real', font => $font, | ||
582 | 386 | id => $fontname . $add, priority => $priority, | ||
583 | 387 | category => 'truetype-cjk', | ||
584 | 388 | hints => join(' ', @hints, @_)); | ||
585 | 389 | |||
586 | 390 | foreach my $i (@{$alias}) { | ||
587 | 391 | defoma_id_register($Id, type => 'alias', font => $font, | ||
588 | 392 | id => $i . $add, priority => $priority, | ||
589 | 393 | category => 'truetype-cjk', | ||
590 | 394 | origin => $fontname . $add); | ||
591 | 395 | } | ||
592 | 396 | |||
593 | 397 | defoma_subst_register($Sb1, $font, $fontname . $add); | ||
594 | 398 | defoma_subst_register($Sb2, $font, $fontname . $add); | ||
595 | 399 | |||
596 | 400 | $cnt++; | ||
597 | 401 | return $cnt unless ($charset =~ /JISX0212/ && $loc eq 'Japanese' && | ||
598 | 402 | $encoding eq 'Unicode'); | ||
599 | 403 | |||
600 | 404 | $add = '-JaH'; | ||
601 | 405 | @hints = ('Adobe', 'Japan2', 'Unicode', | ||
602 | 406 | '--CIDRegistry', 'Adobe', '--CIDOrdering', 'Japan2'); | ||
603 | 407 | |||
604 | 408 | defoma_id_register($Id, type => 'real', font => $font, | ||
605 | 409 | id => $fontname . $add, priority => $priority, | ||
606 | 410 | category => 'truetype-cjk', | ||
607 | 411 | hints => join(' ', @hints, @_)); | ||
608 | 412 | |||
609 | 413 | foreach my $i (@{$alias}) { | ||
610 | 414 | defoma_id_register($Id, type => 'alias', font => $font, | ||
611 | 415 | id => $i . $add, priority => $priority, | ||
612 | 416 | category => 'truetype-cjk', | ||
613 | 417 | origin => $fontname . $add); | ||
614 | 418 | } | ||
615 | 419 | |||
616 | 420 | defoma_subst_register($Sb1, $font, $fontname . $add); | ||
617 | 421 | defoma_subst_register($Sb2, $font, $fontname . $add); | ||
618 | 422 | |||
619 | 423 | $cnt++; | ||
620 | 424 | return $cnt; | ||
621 | 425 | } | ||
622 | 426 | |||
623 | 427 | sub tt_register { | ||
624 | 428 | my $font = shift; | ||
625 | 429 | my $h = parse_hints_start(@_); | ||
626 | 430 | my $i; | ||
627 | 431 | |||
628 | 432 | my $fontname = $h->{FontName}; | ||
629 | 433 | my $location = $h->{Location}; | ||
630 | 434 | my $encoding = $h->{Encoding}; | ||
631 | 435 | my $priority = $h->{Priority} || 0; | ||
632 | 436 | my $charset = $h->{Charset}; | ||
633 | 437 | |||
634 | 438 | return 1 unless ($fontname && $location && $encoding); | ||
635 | 439 | $fontname =~ s/ .*//; | ||
636 | 440 | my @alias = ($h->{Alias}) ? split(/ +/, $h->{Alias}) : (); | ||
637 | 441 | |||
638 | 442 | return 2 if (create_symlink($font)); | ||
639 | 443 | |||
640 | 444 | parse_hints_cut($h, 'Encoding', 'Location', 'FontName'); | ||
641 | 445 | my @hints; | ||
642 | 446 | |||
643 | 447 | if ($location !~ /Japanese|Korean|Chinese/) { | ||
644 | 448 | @hints = parse_hints_build($h); | ||
645 | 449 | |||
646 | 450 | defoma_id_register($Id, type => 'real', font => $font, id => $fontname, | ||
647 | 451 | priority => $priority, hints => join(' ', @hints)); | ||
648 | 452 | |||
649 | 453 | foreach $i (@alias) { | ||
650 | 454 | defoma_id_register($Id, type => 'alias', font => $font, id => $i, | ||
651 | 455 | priority => $priority, origin => $fontname); | ||
652 | 456 | } | ||
653 | 457 | |||
654 | 458 | defoma_subst_register($Sb1, $font, $fontname); | ||
655 | 459 | defoma_subst_register($Sb2, $font, $fontname); | ||
656 | 460 | } else { | ||
657 | 461 | parse_hints_cut($h, 'Charset'); | ||
658 | 462 | @hints = parse_hints_build($h); | ||
659 | 463 | |||
660 | 464 | my $loc; | ||
661 | 465 | my @locs = split(/ /, $location); | ||
662 | 466 | my $cnt = 0; | ||
663 | 467 | |||
664 | 468 | foreach $loc (@locs) { | ||
665 | 469 | $cnt = tt_register_cjk($cnt, $loc, $font, $fontname, \@alias, | ||
666 | 470 | $charset, $encoding, $priority, @hints); | ||
667 | 471 | } | ||
668 | 472 | } | ||
669 | 473 | |||
670 | 474 | return 0; | ||
671 | 475 | } | ||
672 | 476 | |||
673 | 477 | sub tt_unregister { | ||
674 | 478 | my $font = shift; | ||
675 | 479 | |||
676 | 480 | defoma_subst_unregister($Sb1, $font); | ||
677 | 481 | defoma_subst_unregister($Sb2, $font); | ||
678 | 482 | defoma_id_unregister($Id, type => 'alias', font => $font); | ||
679 | 483 | defoma_id_unregister($Id, type => 'real', font => $font); | ||
680 | 484 | |||
681 | 485 | remove_symlink($font); | ||
682 | 486 | |||
683 | 487 | return 0; | ||
684 | 488 | } | ||
685 | 489 | |||
686 | 490 | sub tt_install { | ||
687 | 491 | my $type = shift; | ||
688 | 492 | my $font = shift; | ||
689 | 493 | my $id = shift; | ||
690 | 494 | my $depfont = shift; | ||
691 | 495 | my $depid = shift; | ||
692 | 496 | |||
693 | 497 | my @add = (); | ||
694 | 498 | |||
695 | 499 | $add[0] = '--RealName' if ($type eq 'real'); | ||
696 | 500 | |||
697 | 501 | register_ps($id, @_, @add); | ||
698 | 502 | |||
699 | 503 | return 0; | ||
700 | 504 | } | ||
701 | 505 | |||
702 | 506 | sub tt_remove { | ||
703 | 507 | my $type = shift; | ||
704 | 508 | my $font = shift; | ||
705 | 509 | my $id = shift; | ||
706 | 510 | my $depfont = shift; | ||
707 | 511 | my $depid = shift; | ||
708 | 512 | |||
709 | 513 | unregister_ps($id); | ||
710 | 514 | |||
711 | 515 | return 0; | ||
712 | 516 | } | ||
713 | 517 | |||
714 | 518 | sub truetype { | ||
715 | 519 | my $com = shift; | ||
716 | 520 | |||
717 | 521 | if ($com eq 'register') { | ||
718 | 522 | return tt_register(@_); | ||
719 | 523 | } elsif ($com eq 'unregister') { | ||
720 | 524 | return tt_unregister(@_); | ||
721 | 525 | } elsif ($com =~ /^do-install-(.*)$/) { | ||
722 | 526 | return tt_install($1, @_); | ||
723 | 527 | } elsif ($com =~ /^do-remove-(.*)$/) { | ||
724 | 528 | return tt_remove($1, @_); | ||
725 | 529 | } elsif ($com eq 'init') { | ||
726 | 530 | return init(); | ||
727 | 531 | } elsif ($com eq 'term') { | ||
728 | 532 | return term(); | ||
729 | 533 | } | ||
730 | 534 | |||
731 | 535 | return 0; | ||
732 | 536 | } | ||
733 | 537 | |||
734 | 538 | sub truetype_cjk { | ||
735 | 539 | my $com = shift; | ||
736 | 540 | |||
737 | 541 | if ($com =~ /^do-install-(.*)$/) { | ||
738 | 542 | return cid_install($1, @_); | ||
739 | 543 | } elsif ($com =~ /^do-remove-(.*)$/) { | ||
740 | 544 | return cid_remove($1, @_); | ||
741 | 545 | } elsif ($com eq 'init') { | ||
742 | 546 | return init(); | ||
743 | 547 | } elsif ($com eq 'term') { | ||
744 | 548 | return term(); | ||
745 | 549 | } | ||
746 | 550 | |||
747 | 551 | return 0; | ||
748 | 552 | } | ||
749 | 553 | |||
750 | 554 | sub cid_register { | ||
751 | 555 | my $type = shift; | ||
752 | 556 | my $font = shift; | ||
753 | 557 | my $h = parse_hints_start(@_); | ||
754 | 558 | |||
755 | 559 | my $fontname = $h->{FontName}; | ||
756 | 560 | my $registry = $h->{CIDRegistry}; | ||
757 | 561 | my $ordering = $h->{CIDOrdering}; | ||
758 | 562 | my $priority = $h->{Priority} || 0; | ||
759 | 563 | |||
760 | 564 | return 1 unless($fontname && $registry && $ordering); | ||
761 | 565 | $fontname =~ s/ .*//; | ||
762 | 566 | $registry =~ s/ .*//; | ||
763 | 567 | $ordering =~ s/ .*//; | ||
764 | 568 | my @alias = ($h->{Alias}) ? split(/ +/, $h->{Alias}) : (); | ||
765 | 569 | |||
766 | 570 | return 2 if (create_symlink($font)); | ||
767 | 571 | |||
768 | 572 | parse_hints_cut($h, 'PSCharset', 'PSEncoding', 'Charset', 'Encoding'); | ||
769 | 573 | my @hints = parse_hints_build($h); | ||
770 | 574 | @hints = ($registry, $ordering, '.', @hints); | ||
771 | 575 | |||
772 | 576 | defoma_id_register($Id, type => 'real', font => $font, | ||
773 | 577 | id => $fontname, priority => $priority, | ||
774 | 578 | category => $type, hints => join(' ', @hints)); | ||
775 | 579 | |||
776 | 580 | my $i; | ||
777 | 581 | foreach $i (@alias) { | ||
778 | 582 | defoma_id_register($Id, type => 'alias', font => $font, id => $i, | ||
779 | 583 | priority => $priority, origin => $fontname, | ||
780 | 584 | category => $type); | ||
781 | 585 | } | ||
782 | 586 | |||
783 | 587 | defoma_subst_register($Sb1, $font, $fontname); | ||
784 | 588 | defoma_subst_register($Sb2, $font, $fontname); | ||
785 | 589 | |||
786 | 590 | return 0; | ||
787 | 591 | } | ||
788 | 592 | |||
789 | 593 | sub cid_unregister { | ||
790 | 594 | my $font = shift; | ||
791 | 595 | |||
792 | 596 | defoma_subst_unregister($Sb1, $font); | ||
793 | 597 | defoma_subst_unregister($Sb2, $font); | ||
794 | 598 | defoma_id_unregister($Id, type => 'alias', font => $font); | ||
795 | 599 | defoma_id_unregister($Id, type => 'real', font => $font); | ||
796 | 600 | |||
797 | 601 | remove_symlink($font); | ||
798 | 602 | |||
799 | 603 | return 0; | ||
800 | 604 | } | ||
801 | 605 | |||
802 | 606 | sub cid_install_all { | ||
803 | 607 | my $type = shift; | ||
804 | 608 | my $id = shift; | ||
805 | 609 | my $registry = shift; | ||
806 | 610 | my $ordering = shift; | ||
807 | 611 | |||
808 | 612 | my @cmaps = defoma_id_get_font($IdCmap, 'installed'); | ||
809 | 613 | foreach my $c (@cmaps) { | ||
810 | 614 | my @chs = split(/ +/, $IdCmap->{7}->[$c]); | ||
811 | 615 | |||
812 | 616 | next if ($chs[0] ne $registry); | ||
813 | 617 | next if ($chs[1] ne $ordering && $chs[1] ne 'Identity'); | ||
814 | 618 | |||
815 | 619 | shift(@chs); | ||
816 | 620 | shift(@chs); | ||
817 | 621 | |||
818 | 622 | my $psname = $id . '-' . $IdCmap->{0}->[$c]; | ||
819 | 623 | |||
820 | 624 | my @add = (); | ||
821 | 625 | $add[0] = '--RealName' if ($type eq 'real'); | ||
822 | 626 | |||
823 | 627 | register_ps($psname, @_, @add, @chs); | ||
824 | 628 | } | ||
825 | 629 | |||
826 | 630 | return 0; | ||
827 | 631 | } | ||
828 | 632 | |||
829 | 633 | sub cid_remove_all { | ||
830 | 634 | my $type = shift; | ||
831 | 635 | my $id = shift; | ||
832 | 636 | my $registry = shift; | ||
833 | 637 | my $ordering = shift; | ||
834 | 638 | |||
835 | 639 | my @cmaps = defoma_id_get_font($IdCmap, 'installed'); | ||
836 | 640 | foreach my $c (@cmaps) { | ||
837 | 641 | my @chs = split(/ +/, $IdCmap->{7}->[$c]); | ||
838 | 642 | |||
839 | 643 | next if ($chs[0] ne $registry); | ||
840 | 644 | next if ($chs[1] ne $ordering && $chs[1] ne 'Identity'); | ||
841 | 645 | |||
842 | 646 | my $psname = $id . '-' . $IdCmap->{0}->[$c]; | ||
843 | 647 | |||
844 | 648 | unregister_ps($psname); | ||
845 | 649 | } | ||
846 | 650 | |||
847 | 651 | return 0; | ||
848 | 652 | } | ||
849 | 653 | |||
850 | 654 | sub cid_install { | ||
851 | 655 | my $type = shift; | ||
852 | 656 | my $font = shift; | ||
853 | 657 | my $id = shift; | ||
854 | 658 | my $depfont = shift; | ||
855 | 659 | my $depid = shift; | ||
856 | 660 | my $registry = shift; | ||
857 | 661 | my $ordering = shift; | ||
858 | 662 | my $encoding = shift; | ||
859 | 663 | |||
860 | 664 | cid_install_all($type, $id, $registry, $ordering, @_); | ||
861 | 665 | |||
862 | 666 | return 0; | ||
863 | 667 | } | ||
864 | 668 | |||
865 | 669 | sub cid_remove { | ||
866 | 670 | my $type = shift; | ||
867 | 671 | my $font = shift; | ||
868 | 672 | my $id = shift; | ||
869 | 673 | my $depfont = shift; | ||
870 | 674 | my $depid = shift; | ||
871 | 675 | my $registry = shift; | ||
872 | 676 | my $ordering = shift; | ||
873 | 677 | my $encoding = shift; | ||
874 | 678 | |||
875 | 679 | cid_remove_all($type, $id, $registry, $ordering); | ||
876 | 680 | |||
877 | 681 | return 0; | ||
878 | 682 | } | ||
879 | 683 | |||
880 | 684 | sub cid { | ||
881 | 685 | my $com = shift; | ||
882 | 686 | |||
883 | 687 | if ($com eq 'register') { | ||
884 | 688 | return cid_register('cid', @_); | ||
885 | 689 | } elsif ($com eq 'unregister') { | ||
886 | 690 | return cid_unregister(@_); | ||
887 | 691 | } elsif ($com =~ /^do-install-(.*)$/) { | ||
888 | 692 | return cid_install($1, @_); | ||
889 | 693 | } elsif ($com =~ /^do-remove-(.*)$/) { | ||
890 | 694 | return cid_remove($1, @_); | ||
891 | 695 | } elsif ($com eq 'init') { | ||
892 | 696 | return init(); | ||
893 | 697 | } elsif ($com eq 'term') { | ||
894 | 698 | return term(); | ||
895 | 699 | } | ||
896 | 700 | |||
897 | 701 | return 0; | ||
898 | 702 | } | ||
899 | 703 | |||
900 | 704 | sub cmap_register { | ||
901 | 705 | my $font = shift; | ||
902 | 706 | |||
903 | 707 | if ($font =~ /\/gs-cjk-resource\//) { | ||
904 | 708 | return 2 if (create_symlink($font, $CMapDir)); | ||
905 | 709 | return 0; | ||
906 | 710 | } | ||
907 | 711 | |||
908 | 712 | my $h = parse_hints_start(@_); | ||
909 | 713 | |||
910 | 714 | my $cmap = $h->{CMapName}; | ||
911 | 715 | my $reg = $h->{CIDRegistry}; | ||
912 | 716 | my $ord = $h->{CIDOrdering}; | ||
913 | 717 | |||
914 | 718 | return 1 unless ($cmap && $reg && $ord); | ||
915 | 719 | $reg =~ s/ .*//; | ||
916 | 720 | $ord =~ s/ .*//; | ||
917 | 721 | $cmap =~ s/ .*//; | ||
918 | 722 | |||
919 | 723 | my @hints = ($reg, $ord, @_); | ||
920 | 724 | |||
921 | 725 | defoma_id_register($IdCmap, type => 'real', font => $font, id => $cmap, | ||
922 | 726 | priority => 0, hints => join(' ', @hints)); | ||
923 | 727 | |||
924 | 728 | return 0; | ||
925 | 729 | } | ||
926 | 730 | |||
927 | 731 | sub cmap_unregister { | ||
928 | 732 | my $font = shift; | ||
929 | 733 | |||
930 | 734 | if ($font =~ /\/gs-cjk-resource\//) { | ||
931 | 735 | remove_symlink($font, $CMapDir); | ||
932 | 736 | return 0; | ||
933 | 737 | } | ||
934 | 738 | |||
935 | 739 | defoma_id_unregister($IdCmap, type => 'real', font => $font); | ||
936 | 740 | |||
937 | 741 | return 0; | ||
938 | 742 | } | ||
939 | 743 | |||
940 | 744 | sub cmap_install { | ||
941 | 745 | my $font = shift; | ||
942 | 746 | my $cmap = shift; | ||
943 | 747 | my $df = shift; | ||
944 | 748 | my $di = shift; | ||
945 | 749 | my $reg = shift; | ||
946 | 750 | my $ord = shift; | ||
947 | 751 | my %hash; | ||
948 | 752 | my @nonreal = (); | ||
949 | 753 | |||
950 | 754 | return 1 if (create_symlink($font, $CMapDir)); | ||
951 | 755 | |||
952 | 756 | my @list = (defoma_id_get_font($Id, 'installed', f4 => 'cid'), | ||
953 | 757 | defoma_id_get_font($Id, 'installed', f4 => 'truetype-cjk')); | ||
954 | 758 | |||
955 | 759 | foreach my $i (@list) { | ||
956 | 760 | my $type = $Id->{2}->[$i]; | ||
957 | 761 | my $id = $Id->{0}->[$i]; | ||
958 | 762 | |||
959 | 763 | if ($type ne 'SrI') { | ||
960 | 764 | push(@nonreal, $i); | ||
961 | 765 | next; | ||
962 | 766 | } | ||
963 | 767 | |||
964 | 768 | my @hints = split(/ +/, $Id->{7}->[$i]); | ||
965 | 769 | |||
966 | 770 | next if ($hints[0] ne $reg); | ||
967 | 771 | next if ($hints[1] ne $ord && $ord ne 'Identity'); | ||
968 | 772 | |||
969 | 773 | $hash{$id} = $i; | ||
970 | 774 | |||
971 | 775 | shift(@hints); | ||
972 | 776 | shift(@hints); | ||
973 | 777 | shift(@hints); | ||
974 | 778 | |||
975 | 779 | my $psname = $id . '-' . $cmap; | ||
976 | 780 | |||
977 | 781 | register_ps($psname, @hints, '--RealName', @_); | ||
978 | 782 | } | ||
979 | 783 | |||
980 | 784 | foreach my $i (@nonreal) { | ||
981 | 785 | my $depid = $Id->{5}->[$i]; | ||
982 | 786 | next unless (exists($hash{$depid})); | ||
983 | 787 | |||
984 | 788 | my @hints = split(/ +/, $Id->{7}->[$hash{$depid}]); | ||
985 | 789 | |||
986 | 790 | next if ($hints[0] ne $reg); | ||
987 | 791 | next if ($hints[1] ne $ord && $ord ne 'Identity'); | ||
988 | 792 | |||
989 | 793 | shift(@hints); | ||
990 | 794 | shift(@hints); | ||
991 | 795 | shift(@hints); | ||
992 | 796 | |||
993 | 797 | my $psname = $Id->{0}->[$i] . '-' . $cmap; | ||
994 | 798 | |||
995 | 799 | register_ps($psname, @hints, @_); | ||
996 | 800 | } | ||
997 | 801 | |||
998 | 802 | return 0; | ||
999 | 803 | } | ||
1000 | 804 | |||
1001 | 805 | sub cmap_remove { | ||
1002 | 806 | my $font = shift; | ||
1003 | 807 | my $cmap = shift; | ||
1004 | 808 | my $df = shift; | ||
1005 | 809 | my $di = shift; | ||
1006 | 810 | my $reg = shift; | ||
1007 | 811 | my $ord = shift; | ||
1008 | 812 | my %hash; | ||
1009 | 813 | |||
1010 | 814 | remove_symlink($font, $CMapDir); | ||
1011 | 815 | |||
1012 | 816 | my @list = (defoma_id_get_font($Id, 'installed', f4 => 'cid'), | ||
1013 | 817 | defoma_id_get_font($Id, 'installed', f4 => 'truetype-cjk')); | ||
1014 | 818 | |||
1015 | 819 | foreach my $i (@list) { | ||
1016 | 820 | my @hints = split(/ +/, $Id->{7}->[$i]); | ||
1017 | 821 | |||
1018 | 822 | if (@hints > 0) { | ||
1019 | 823 | next if ($hints[0] ne $reg); | ||
1020 | 824 | next if ($hints[1] ne $ord && $ord ne 'Identity'); | ||
1021 | 825 | } | ||
1022 | 826 | |||
1023 | 827 | my $psname = $Id->{0}->[$i] . '-' . $cmap; | ||
1024 | 828 | |||
1025 | 829 | unregister_ps($psname); | ||
1026 | 830 | } | ||
1027 | 831 | |||
1028 | 832 | return 0; | ||
1029 | 833 | } | ||
1030 | 834 | |||
1031 | 835 | sub cmap { | ||
1032 | 836 | my $com = shift; | ||
1033 | 837 | |||
1034 | 838 | if ($com eq 'register') { | ||
1035 | 839 | return cmap_register(@_); | ||
1036 | 840 | } elsif ($com eq 'unregister') { | ||
1037 | 841 | return cmap_unregister(@_); | ||
1038 | 842 | } elsif ($com eq 'do-install-real') { | ||
1039 | 843 | return cmap_install(@_); | ||
1040 | 844 | } elsif ($com eq 'do-remove-real') { | ||
1041 | 845 | return cmap_remove(@_); | ||
1042 | 846 | } elsif ($com eq 'init') { | ||
1043 | 847 | return init(); | ||
1044 | 848 | } elsif ($com eq 'term') { | ||
1045 | 849 | return term(); | ||
1046 | 850 | } | ||
1047 | 851 | |||
1048 | 852 | return 0; | ||
1049 | 853 | } | ||
1050 | 854 | |||
1051 | 855 | sub psprint_register { | ||
1052 | 856 | my $font = shift; | ||
1053 | 857 | return 0 unless ($Subst4psprint); | ||
1054 | 858 | return 1 if ($font !~ /(.+)\/(.+)/); | ||
1055 | 859 | |||
1056 | 860 | return 0 if ($1 eq '<gs>'); | ||
1057 | 861 | my $fontname = $2; | ||
1058 | 862 | |||
1059 | 863 | return 2 if ($Sb1->grep_rule('', $fontname)); | ||
1060 | 864 | |||
1061 | 865 | my @hints; | ||
1062 | 866 | my $h = parse_hints_start(@_); | ||
1063 | 867 | my $cset = $h->{PSCharset}; | ||
1064 | 868 | my $enc = $h->{PSEncoding}; | ||
1065 | 869 | |||
1066 | 870 | if ($cset && $enc && $cset =~ /^Adobe-([^-]+).*$/) { | ||
1067 | 871 | my $ord = $1; | ||
1068 | 872 | $fontname =~ s/-$enc$//; | ||
1069 | 873 | |||
1070 | 874 | parse_hints_cut($h, 'PSCharset', 'PSEncoding', 'Charset', 'Encoding', | ||
1071 | 875 | 'Direction'); | ||
1072 | 876 | @hints = parse_hints_build($h); | ||
1073 | 877 | push(@hints, '--CIDRegistry,*', 'Adobe', '--CIDOrdering,*', $ord); | ||
1074 | 878 | } else { | ||
1075 | 879 | @hints = @_; | ||
1076 | 880 | } | ||
1077 | 881 | |||
1078 | 882 | for my $i (@hints) { | ||
1079 | 883 | $i = '--Charset,*' if ($i eq '--Charset'); | ||
1080 | 884 | $i = '--Encoding,*' if ($i eq '--Encoding'); | ||
1081 | 885 | $i = '--Direction,*' if ($i eq '--Direction'); | ||
1082 | 886 | $i = '--Shape,2' if ($i eq '--Shape'); | ||
1083 | 887 | } | ||
1084 | 888 | |||
1085 | 889 | defoma_subst_add_rule($Sb1, $fontname, @hints); | ||
1086 | 890 | |||
1087 | 891 | return 0; | ||
1088 | 892 | } | ||
1089 | 893 | |||
1090 | 894 | sub psprint_unregister { | ||
1091 | 895 | my $font = shift; | ||
1092 | 896 | return 0 if ($font !~ /(.+)\/(.+)/); | ||
1093 | 897 | |||
1094 | 898 | return 0 if ($1 eq '<gs>'); | ||
1095 | 899 | my $fontname = $2; | ||
1096 | 900 | |||
1097 | 901 | my $h = parse_hints_start(@_); | ||
1098 | 902 | my $cset = $h->{PSCharset}; | ||
1099 | 903 | my $enc = $h->{PSEncoding}; | ||
1100 | 904 | |||
1101 | 905 | if ($cset && $enc && $cset =~ /^Adobe-.*$/) { | ||
1102 | 906 | $fontname =~ s/-$enc$//; | ||
1103 | 907 | } | ||
1104 | 908 | |||
1105 | 909 | defoma_subst_remove_rule($Sb1, $fontname); | ||
1106 | 910 | |||
1107 | 911 | return 0; | ||
1108 | 912 | } | ||
1109 | 913 | |||
1110 | 914 | sub psprint { | ||
1111 | 915 | my $com = shift; | ||
1112 | 916 | |||
1113 | 917 | if ($com eq 'register') { | ||
1114 | 918 | return psprint_register(@_); | ||
1115 | 919 | } elsif ($com eq 'unregister') { | ||
1116 | 920 | return psprint_unregister(@_); | ||
1117 | 921 | } elsif ($com eq 'init') { | ||
1118 | 922 | return init(); | ||
1119 | 923 | } elsif ($com eq 'term') { | ||
1120 | 924 | return term(); | ||
1121 | 925 | } | ||
1122 | 926 | |||
1123 | 927 | return 0; | ||
1124 | 928 | } | ||
1125 | 929 | |||
1126 | 930 | 1; | ||
1127 | 931 | 0 | ||
1128 | === modified file 'debian/rules' | |||
1129 | --- debian/rules 2009-09-18 15:37:23 +0000 | |||
1130 | +++ debian/rules 2010-05-23 18:44:26 +0000 | |||
1131 | @@ -27,7 +27,7 @@ | |||
1132 | 27 | --with-ijs --with-jbig2dec --with-jasper --with-x --disable-gtk \ | 27 | --with-ijs --with-jbig2dec --with-jasper --with-x --disable-gtk \ |
1133 | 28 | --enable-dynamic --with-omni --enable-cups --disable-compile-inits \ | 28 | --enable-dynamic --with-omni --enable-cups --disable-compile-inits \ |
1134 | 29 | --disable-cairo --with-drivers=ALL \ | 29 | --disable-cairo --with-drivers=ALL \ |
1136 | 30 | --with-fontpath=/var/lib/defoma/gs.d/dirs/fonts:/usr/share/cups/fonts:/usr/share/ghostscript/fonts:/usr/local/lib/ghostscript/fonts:/usr/share/fonts | 30 | --with-fontpath=/var/lib/ghostscript/fonts:/usr/share/cups/fonts:/usr/share/ghostscript/fonts:/usr/local/lib/ghostscript/fonts:/usr/share/fonts |
1137 | 31 | DEB_MAKE_BUILD_TARGET := STDDIRS $(FT_OPTS) | 31 | DEB_MAKE_BUILD_TARGET := STDDIRS $(FT_OPTS) |
1138 | 32 | DEB_MAKE_INSTALL_TARGET := soinstall install-shared install-cups install-contrib-extras \ | 32 | DEB_MAKE_INSTALL_TARGET := soinstall install-shared install-cups install-contrib-extras \ |
1139 | 33 | DESTDIR=$(CURDIR)/debian/ghostscript \ | 33 | DESTDIR=$(CURDIR)/debian/ghostscript \ |
1140 | @@ -52,7 +52,7 @@ | |||
1141 | 52 | -cd jasper && $(MAKE) distclean | 52 | -cd jasper && $(MAKE) distclean |
1142 | 53 | [ ! -f Makefile ] || $(MAKE) soclean | 53 | [ ! -f Makefile ] || $(MAKE) soclean |
1143 | 54 | [ ! -f Makefile ] || $(MAKE) distclean | 54 | [ ! -f Makefile ] || $(MAKE) distclean |
1145 | 55 | # These are somehow left... | 55 | # These are somehow left... |
1146 | 56 | -rm -rf sobin soobj cups/pstopxl cups/pstoraster | 56 | -rm -rf sobin soobj cups/pstopxl cups/pstoraster |
1147 | 57 | 57 | ||
1148 | 58 | build/ghostscript:: | 58 | build/ghostscript:: |
1149 | @@ -76,9 +76,6 @@ | |||
1150 | 76 | rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/ghostscript/etc/cups | 76 | rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/ghostscript/etc/cups |
1151 | 77 | rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/ghostscript/etc | 77 | rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/ghostscript/etc |
1152 | 78 | 78 | ||
1153 | 79 | # Install Defoma script | ||
1154 | 80 | install -m 644 $(CURDIR)/debian/gs.defoma $(CURDIR)/debian/ghostscript/usr/share/defoma/scripts | ||
1155 | 81 | |||
1156 | 82 | # Remove some of the scripts | 79 | # Remove some of the scripts |
1157 | 83 | rm $(CURDIR)/debian/ghostscript/usr/bin/unix-lpr.sh $(CURDIR)/debian/ghostscript/usr/bin/lprsetup.sh $(CURDIR)/debian/ghostscript/usr/bin/pv.sh $(CURDIR)/debian/ghostscript/usr/bin/fixmswrd.pl | 80 | rm $(CURDIR)/debian/ghostscript/usr/bin/unix-lpr.sh $(CURDIR)/debian/ghostscript/usr/bin/lprsetup.sh $(CURDIR)/debian/ghostscript/usr/bin/pv.sh $(CURDIR)/debian/ghostscript/usr/bin/fixmswrd.pl |
1158 | 84 | 81 | ||
1159 | @@ -89,14 +86,16 @@ | |||
1160 | 89 | rm -f $(CURDIR)/debian/ghostscript/usr/bin/gsx | 86 | rm -f $(CURDIR)/debian/ghostscript/usr/bin/gsx |
1161 | 90 | 87 | ||
1162 | 91 | # Do not include the shipped Fontmaps, since Fontmaps will be | 88 | # Do not include the shipped Fontmaps, since Fontmaps will be |
1165 | 92 | # automatically generated by Defoma. | 89 | # automatically generated by update-gsfontmap. |
1166 | 93 | # You may find them in /var/lib/defoma/gs.d/dirs/fonts/ | 90 | # You may find them in /var/lib/ghostscript/fonts/ |
1167 | 94 | GSVERSION=`ls -1 $(CURDIR)/debian/ghostscript/usr/share/ghostscript/ | head -1`; \ | 91 | GSVERSION=`ls -1 $(CURDIR)/debian/ghostscript/usr/share/ghostscript/ | head -1`; \ |
1168 | 95 | rm -f $(CURDIR)/debian/ghostscript/usr/share/ghostscript/$$GSVERSION/Resource/Init/Fontmap*; \ | 92 | rm -f $(CURDIR)/debian/ghostscript/usr/share/ghostscript/$$GSVERSION/Resource/Init/Fontmap*; \ |
1169 | 96 | rm -f $(CURDIR)/debian/ghostscript/usr/share/ghostscript/$$GSVERSION/Resource/Init/cidfmap | 93 | rm -f $(CURDIR)/debian/ghostscript/usr/share/ghostscript/$$GSVERSION/Resource/Init/cidfmap |
1170 | 97 | 94 | ||
1171 | 98 | # Rename /usr/bin/gsc, to not conflict with gambc | 95 | # Rename /usr/bin/gsc, to not conflict with gambc |
1172 | 99 | mv $(CURDIR)/debian/ghostscript/usr/bin/gsc $(CURDIR)/debian/ghostscript/usr/bin/gs | 96 | mv $(CURDIR)/debian/ghostscript/usr/bin/gsc $(CURDIR)/debian/ghostscript/usr/bin/gs |
1173 | 97 | mkdir -p $(CURDIR)/debian/ghostscript/usr/sbin/ | ||
1174 | 98 | install -m 755 debian/update-gsfontmap $(CURDIR)/debian/ghostscript/usr/sbin/ | ||
1175 | 100 | 99 | ||
1176 | 101 | # Some convenience links | 100 | # Some convenience links |
1177 | 102 | ln -s /usr/bin/gs $(CURDIR)/debian/ghostscript/usr/bin/ghostscript | 101 | ln -s /usr/bin/gs $(CURDIR)/debian/ghostscript/usr/bin/ghostscript |
1178 | 103 | 102 | ||
1179 | === added file 'debian/update-gsfontmap' | |||
1180 | --- debian/update-gsfontmap 1970-01-01 00:00:00 +0000 | |||
1181 | +++ debian/update-gsfontmap 2010-05-23 18:44:26 +0000 | |||
1182 | @@ -0,0 +1,20 @@ | |||
1183 | 1 | #!/bin/sh | ||
1184 | 2 | # update-gsfontmap | ||
1185 | 3 | # Copyright 2010 Kenshi Muto <kmuto@debian.org> | ||
1186 | 4 | # License: GPL | ||
1187 | 5 | |||
1188 | 6 | CIDFMAP=/var/lib/ghostscript/fonts/cidfmap | ||
1189 | 7 | FONTMAP=/var/lib/ghostscript/fonts/Fontmap | ||
1190 | 8 | CIDFDIR=/etc/ghostscript/cidfmap.d/ | ||
1191 | 9 | FONTMDIR=/etc/ghostscript/fontmap.d/ | ||
1192 | 10 | |||
1193 | 11 | rm -f $CIDFMAP $FONTMAP | ||
1194 | 12 | touch $CIDFMAP $FONTMAP | ||
1195 | 13 | |||
1196 | 14 | for i in $CIDFDIR/*.conf; do | ||
1197 | 15 | cat $i >> $CIDFMAP | ||
1198 | 16 | done 2>/dev/null | ||
1199 | 17 | |||
1200 | 18 | for i in $FONTMDIR/*.conf; do | ||
1201 | 19 | cat $i >> $FONTMAP | ||
1202 | 20 | done 2>/dev/null |