~ubuntu-branches/ubuntu/jaunty/ghostscript/jaunty-updates

« back to all changes in this revision

Viewing changes to lib/gs_ciddc.ps

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-01-20 16:40:45 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120164045-lnfhi0n30o5lwhwa
Tags: 8.64.dfsg.1~svn9377-0ubuntu1
* New upstream release (SVN rev 9377)
   o Fixes many bugs concerning PDF rendering, to make the PDF printing
     workflow correctly working.
   o Fixes long-standing bugs in many drivers, like input paper tray and
     duplex options not working for the built-in PCL 4, 5, 5c, 5e, and
     6/XL drivers, PDF input not working for bjc600, bjc800, and cups
     output devices, several options not working and uninitialized
     memory with cups output device.
   o Merged nearly all patches of the Ubuntu and Debian packages upstream.
   o Fixes LP: #317810, LP: #314439, LP: #314018.
* debian/patches/03_libpaper_support.dpatch,
  debian/patches/11_gs-cjk_font_glyph_handling_fix.dpatch,
  debian/patches/12_gs-cjk_vertical_writing_metrics_fix.dpatch,
  debian/patches/13_gs-cjk_cjkps_examples.dpatch,
  debian/patches/20_bbox_segv_fix.dpatch,
  debian/patches/21_brother_7x0_gdi_fix.dpatch,
  debian/patches/22_epsn_margin_workaround.dpatch,
  debian/patches/24_gs_man_fix.dpatch,
  debian/patches/25_toolbin_insecure_tmp_usage_fix.dpatch,
  debian/patches/26_assorted_script_fixes.dpatch,
  debian/patches/29_gs_css_fix.dpatch,
  debian/patches/30_ps2pdf_man_improvement.dpatch,
  debian/patches/31_fix-gc-sigbus.dpatch,
  debian/patches/34_ftbfs-on-hurd-fix.dpatch,
  debian/patches/35_disable_libcairo.dpatch,
  debian/patches/38_pxl-duplex.dpatch,
  debian/patches/39_pxl-resolution.dpatch,
  debian/patches/42_gs-init-ps-delaybind-fix.dpatch,
  debian/patches/45_bjc600-bjc800-pdf-input.dpatch,
  debian/patches/48_cups-output-device-pdf-duplex-uninitialized-memory-fix.dpatch,
  debian/patches/50_lips4-floating-point-exception.dpatch,
  debian/patches/52_cups-device-logging.dpatch,
  debian/patches/55_pcl-input-slot-fix.dpatch,
  debian/patches/57_pxl-input-slot-fix.dpatch,
  debian/patches/60_pxl-cups-driver-pdf.dpatch,
  debian/patches/62_onebitcmyk-pdf.dpatch,
  debian/patches/65_too-big-temp-files-1.dpatch,
  debian/patches/67_too-big-temp-files-2.dpatch,
  debian/patches/70_take-into-account-data-in-stream-buffer-before-refill.dpatch:
  Removed, applied upstream.
* debian/patches/01_docdir_fix_for_debian.dpatch,
  debian/patches/02_gs_man_fix_debian.dpatch,
  debian/patches/01_docdir-fix-for-debian.dpatch,
  debian/patches/02_docdir-fix-for-debian.dpatch: Renamed patches to
  make merging with Debian easier.
* debian/patches/32_improve-handling-of-media-size-changes-from-gv.dpatch, 
  debian/patches/33_bad-params-to-xinitimage-on-large-bitmaps.dpatch:
  regenerated for new source directory structure.
* debian/rules: Corrected paths to remove cidfmap (it is in Resource/Init/
  in GS 8.64) and to install headers (source paths are psi/ and base/ now).
* debian/rules: Remove all fontmaps, as DeFoMa replaces them.
* debian/local/pdftoraster/pdftoraster.c,
  debian/local/pdftoraster/pdftoraster.convs, debian/rules: Removed
  added pdftoraster filter and use the one which comes with Ghostscript.
* debian/ghostscript.links: s/8.63/8.64/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%    Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000 Aladdin Enterprises.  All rights reserved.
2
 
3
 
% This software is provided AS-IS with no warranty, either express or
4
 
% implied.
5
 
6
 
% This software is distributed under license and may not be copied,
7
 
% modified or distributed except as expressly authorized under the terms
8
 
% of the license contained in the file LICENSE in this distribution.
9
 
10
 
% For more information about licensing, please refer to
11
 
% http://www.ghostscript.com/licensing/. For information on
12
 
% commercial licensing, go to http://www.artifex.com/licensing/ or
13
 
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14
 
% San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
 
 
16
 
% $Id: gs_ciddc.ps 7873 2007-04-23 13:27:47Z leonardo $
17
 
% Define Decoding and CIDDecoding resource categories and related procsets.
18
 
 
19
 
languagelevel 2 .setlanguagelevel
20
 
currentglobal true setglobal
21
 
 
22
 
%----------------ParseDecoding procset----------------------------
23
 
 
24
 
/ParseDecoding <<
25
 
 
26
 
/Parse    % <resource_name> <num_tokens> Parse -
27
 
{ dict begin                                  % /ResName
28
 
  0                                           % /ResName nCode
29
 
  { currentfile token not {
30
 
      exit
31
 
    } if                                      % /ResName nCode token
32
 
    dup type /integertype eq {                % /ResName nCode
33
 
       exch pop
34
 
    } {
35
 
      1 index def                             % /ResName nCode
36
 
    } ifelse
37
 
  } loop                                      % /ResName nCode
38
 
  pop                                         % /ResName
39
 
  currentdict end /Decoding                   % /ResName <<inst>> /Decoding
40
 
  defineresource pop
41
 
} bind
42
 
 
43
 
>> /ProcSet defineresource pop
44
 
 
45
 
%----------------Decoding category----------------------------
46
 
 
47
 
/Generic /Category findresource dup length dict copy
48
 
dup /InstanceType /dicttype put
49
 
/Decoding exch /Category defineresource pop
50
 
 
51
 
%----------------ParseCMap_Inverse procset----------------------------
52
 
 
53
 
/ParseCMap_Inverse <<
54
 
  /findresource { pop } bind
55
 
  /defineresource { pop pop } bind
56
 
  /dict {}
57
 
  /def { pop pop } bind
58
 
  /dup null
59
 
  /begin { pop } bind
60
 
  /end {}
61
 
  /currentdict null
62
 
  /CMapName null
63
 
  /usecmap { pop } bind
64
 
  /begincmap {}
65
 
  /endcmap {}
66
 
  /begincodespacerange { pop mark } bind
67
 
  /endcodespacerange { cleartomark } bind
68
 
  /beginnotdefrange { pop mark } bind
69
 
  /endnotdefrange { cleartomark } bind
70
 
  /beginbfchar { pop mark } bind
71
 
  /endbfchar { pop mark } bind
72
 
  /beginbfrange { begincidrange }
73
 
  /endbfrange { endcidrange }
74
 
  /begincidchar { beginbfchar }
75
 
  /endcidchar { endbfchar }
76
 
  /begincidrange { pop mark } bind
77
 
  /endcidrange  { cleartomark } bind
78
 
>>  % Just keep it on stack for a while.
79
 
 
80
 
% Now we define another dict for local binding, than merge it with the previous one :
81
 
dup length 5 add dict begin
82
 
 
83
 
  /.Ranges 40 dict def % Key = CID/256, value = array of 256 integer codes.
84
 
  //.Ranges /CIDCount 0 put
85
 
 
86
 
  /.StringToInt     % <string> .StringToInt <integer>
87
 
  { 0 exch { exch 8 bitshift add } forall
88
 
  } bind def
89
 
 
90
 
  /.SetCouple    % <I> <b> .SetCouple -
91
 
  { exch                                    % b I
92
 
    dup 256 idiv                            % b I I0
93
 
    dup //.Ranges exch known not {
94
 
      dup //.Ranges exch 256 array put
95
 
    } if                                    % b I I0
96
 
    //.Ranges exch get                      % b I [Range]
97
 
    exch 256 mod                            % b [Range] I1
98
 
    2 copy get                              % b [Range] I1 e
99
 
    dup //null ne {
100
 
      % We've got char code duplicates for same CID.
101
 
      dup type /integertype eq {
102
 
        4 3 roll                            % [Range] I1 e b
103
 
        2 array astore put                  %
104
 
      } {
105
 
        dup length 1 add dup dup array dup  % b [Range] I1 D l l D' D'
106
 
        3 2 roll 0 exch getinterval         % b [Range] I1 D l D' D''
107
 
        4 3 roll exch copy pop              % b [Range] I1 l D'
108
 
        dup 3 2 roll 1 sub                  % b [Range] I1 D' D' l-1
109
 
        6 5 roll                            % [Range] I1 D' D' l-1 b
110
 
        put put                             %
111
 
      } ifelse
112
 
    } {
113
 
      pop 3 2 roll put                      %
114
 
    } ifelse
115
 
  } bind def
116
 
 
117
 
  /endcidrange
118
 
  { % Writes the inversed CMap to .Ranges
119
 
    counttomark 3 idiv {                    % (b) (e) I
120
 
      exch .StringToInt                     % (b) I e
121
 
      3 2 roll .StringToInt                 % I e b
122
 
      % Note : this code does't handle multidimentional CID ranges.
123
 
      % fixme : optimize below.
124
 
      dup 3 2 roll exch sub 1 add           % I b d
125
 
      { 2 copy //.SetCouple exec            % I b
126
 
        1 add exch 1 add exch
127
 
      } repeat                              % I b
128
 
      pop                                   % I
129
 
      dup //.Ranges /CIDCount get gt {      % I
130
 
        dup //.Ranges exch /CIDCount exch put
131
 
      } if                                  % I
132
 
      pop
133
 
    } repeat
134
 
    pop % mark
135
 
  } bind def
136
 
 
137
 
  /.GetCIDDecoding         % - .GetCIDDEcoding <dict>
138
 
  { //.Ranges dup length dict copy
139
 
    //.Ranges //.PurgeDict exec
140
 
    //.Ranges /CIDCount 0 put
141
 
  } bind def
142
 
 
143
 
currentdict end
144
 
exch copy % Merge the dicts - see above.
145
 
/ProcSet defineresource pop
146
 
 
147
 
%----------------CIDDecoding category----------------------------
148
 
% Note that we put all instances in global memory - see FindResource.
149
 
 
150
 
/Generic /Category findresource dup length dict copy
151
 
begin
152
 
  /Category /CIDDecoding def
153
 
  /InstanceType /dicttype def
154
 
 
155
 
  /.CMapChooser <<
156
 
    % This lists CMaps to inverse and unite for creating a CIDDecoding.
157
 
    % Choose by FAPIcidfmap.Registry concatenated with TrueType encoding ID.
158
 
    % Font renderer must provide the glyph substitution internally.
159
 
 
160
 
    /CNS1.Big5       [ /ETen-B5-H /ETen-B5-V ]
161
 
    /CNS1.Unicode    [ /UniCNS-UCS2-H /UniCNS-UCS2-V]
162
 
    /GB1.GB2312      [ /GBK-EUC-H /GBK-EUC-V ]
163
 
    /GB1.Unicode     [ /UniGB-UCS2-H /UniGB-UCS2-V ]
164
 
    /Japan1.ShiftJIS [ /90ms-RKSJ-H /90ms-RKSJ-V ]
165
 
    /Japan1.Unicode  [ /UniJIS-UCS2-H  /UniJIS-UCS2-V]
166
 
    /Japan2.ShiftJIS [ /90ms-RKSJ-H /90ms-RKSJ-V ]
167
 
    /Japan2.Unicode  [ /UniHojo-UCS2-H ]
168
 
    /Korea1.Johab    [ /KSC-Johab-V /KSC-Johab-H ]
169
 
    /Korea1.Wansung  [ /KSCms-UHC-V /KSCms-UHC-H ]
170
 
    /Korea1.Unicode  [ /UniKS-UCS2-H /UniKS-UCS2-V ]
171
 
    /Identity.Symbol [ /Identity-H /Identity-V ]
172
 
    /Unicode.Unicode [ /Identity-UTF16-H ]
173
 
  >> def
174
 
 
175
 
  /.MakeInstance    % <name> .MakeInstance <inst>
176
 
  { dup                                              % /Name /Name
177
 
    //.CMapChooser exch .knownget not {
178
 
      (Can't build /) print =string cvs print ( /CIDDecoding resource. See gs_ciddc.ps . ) =
179
 
      /findresource cvx /undefinedresource signalerror
180
 
    } if                                             % /Name [CMaps]
181
 
    exch pop                                         % [CMaps]
182
 
    /CMap /Category findresource                     % [CMaps] <CMapCategory>
183
 
    /ParseCMap_Inverse /ProcSet findresource         % [CMaps] <CMapCategory> <PCI>
184
 
    3 2 roll {                                       % <CMapCategory> <PCI> /CMapName
185
 
      3 2 roll begin                                 % <PCI> /CMapName
186
 
      dup .ResourceFile not {
187
 
        (Can't find CMap ) print =string cvs print ( building a CIDDecoding resource. ) =
188
 
        /findresource cvx /undefinedresource signalerror
189
 
      } if
190
 
      currentdict end exch                           % <PCI> /CMapName <CMapCategory> file
191
 
 
192
 
      3 index begin
193
 
      cvx exec                                       % <PCI> /CMapName <CMapCategory>
194
 
      end
195
 
      exch pop exch                                  % <CMapCategory> <PCI>
196
 
    } forall
197
 
    exch pop begin                                   %
198
 
    .GetCIDDecoding
199
 
    end
200
 
  } bind def
201
 
 
202
 
  /FindResource      % <name> FindResource <dict>
203
 
  { currentglobal exch                               % bGlobal /InstName
204
 
    true setglobal
205
 
    dup //.MakeInstance exec                         % bGlobal /InstName <Inst>
206
 
    DefineResource                                   % bGlobal <Inst>
207
 
    exch setglobal                                   % <Inst>
208
 
  } bind def
209
 
 
210
 
currentdict end
211
 
/CIDDecoding exch /Category defineresource pop
212
 
 
213
 
setglobal
214
 
.setlanguagelevel