Debian Codegraph @

texk/xdvipsk/xdvipsk-cid.lpro

raw
1 % xdvipsk-cid.lpro - public domain.
2 %
3 % The following defines procedures assumed and used by program "xdvips"
4 % and must be downloaded or sent as a header file for all TeX jobs.
5 % Originated by Arunas Povilaitis, VTEX, 2015.
6 %
7 % PostScript prolog for using resident CID fonts with Identity cmap.
8 %
9 % The calling sequence defining font foo to be resident CID font Bar is
10 % /foo {specials} atsize /Bar ct_cid
11 %where atsize is the desired font size, after magnification, in pixels.
12 %
13 TeXDict begin
14 %
15 %Variables to calculate FontMatrix for slanted or/and extended fonts
16 /ct_slant 0.0 def /ct_extend 1.0 def
17 %
18 %Special instructions to set font to be slanted or/and extended
19 /ct_SlantFont{/ct_slant exch def}def/ct_ExtendFont{/ct_extend exch def}def
20 %
21 %Procedure to remember start point of text which will be stroked to achieve embolden effect
22 /ct_np{/ct_saveX currentpoint/ct_saveY X def}def
23 %
24 %Procedure to stroke text to achieve embolden effect. Parameter - stroke width after magnification, in pixels.
25 /ct_st{setlinewidth false charpath stroke ct_saveX ct_saveY moveto}def
26 %
27 /ct_cid
28 % Copy all procedure parameters
29 { /ct_basefontname exch def
30 /ct_fontsize exch def
31 /ct_special exch def
32 /ct_newfontname dup exch def
33 % Get the dictionary of the resident font on which the new
34 % version will be based
35 /ct_basefontdict ct_basefontname findfont def
36 % Determine how large the new font dictionary for the
37 % font should be
38 /ct_numentries ct_basefontdict maxlength def
39 % Create a dictionary to hold the description for the
40 % new font.
41 /ct_outfontdict ct_numentries dict def
42 % Copy everything but not the FID entry of the resident font
43 ct_basefontdict { exch dup /FID ne { exch ct_outfontdict 3 1 roll put }
44 { pop pop } ifelse } forall
45 % Execute special instructions to set variables for slanted or/and extended font
46 ct_special exec
47 % Construct the matrix to transform the font
48 /ct_mtx [{ct_fontsize ct_extend mul}exec 0.0 {ct_fontsize ct_slant mul}exec {ct_fontsize neg} exec 0.0 0.0] def
49 % Now make the created dictionary into a POSTSCRIPT font
50 [/ct_cid_scaled ct_newfontname ct_outfontdict definefont def
51 % and duplicate /foo so that it can be used both in definefont
52 % and as the name of the macro, which is created first as a
53 % non-executable array so that we can put the new font dictionary
54 % itself inside the macro;
55 /ct_outfontdict_scaled ct_cid_scaled ct_mtx makefont def
56 % Restore slant and extend parameters to default values
57 /ct_slant 0.0 def /ct_extend 1.0 def
58 % this involves a circumlocution to insert the setfont command.
59 ct_outfontdict_scaled /setfont load]
60 % Finally the macro is made executable and given the name /foo.
61 cvx def
62 } def
63 end
64
65 % Identity CMap resource for using with POSTSCRIPT command 'composefont'
66 % to create resident CID font Bar
67 /CIDInit/ProcSet findresource begin
68 12 dict begin
69 begincmap
70 /CIDSystemInfo 3 dict dup begin
71 /Registry(Adobe)def
72 /Ordering(Identity)def
73 /Supplement 0 def
74 end def
75 /CMapName/TeX_Identity-H def
76 /CMapVersion 1.000 def
77 /CMapType 1 def
78 1 begincodespacerange
79 <0000><FFFF>
80 endcodespacerange
81 1 begincidrange
82 <0000><FFFF>0
83 endcidrange
84 endcmap
85 CMapName currentdict /CMap defineresource pop
86 end
87 end