% xdvipsk-cid.lpro - public domain. % % The following defines procedures assumed and used by program "xdvips" % and must be downloaded or sent as a header file for all TeX jobs. % Originated by Arunas Povilaitis, VTEX, 2015. % % PostScript prolog for using resident CID fonts with Identity cmap. % % The calling sequence defining font foo to be resident CID font Bar is % /foo {specials} atsize /Bar ct_cid %where atsize is the desired font size, after magnification, in pixels. % TeXDict begin % %Variables to calculate FontMatrix for slanted or/and extended fonts /ct_slant 0.0 def /ct_extend 1.0 def % %Special instructions to set font to be slanted or/and extended /ct_SlantFont{/ct_slant exch def}def/ct_ExtendFont{/ct_extend exch def}def % %Procedure to remember start point of text which will be stroked to achieve embolden effect /ct_np{/ct_saveX currentpoint/ct_saveY X def}def % %Procedure to stroke text to achieve embolden effect. Parameter - stroke width after magnification, in pixels. /ct_st{setlinewidth false charpath stroke ct_saveX ct_saveY moveto}def % /ct_cid % Copy all procedure parameters { /ct_basefontname exch def /ct_fontsize exch def /ct_special exch def /ct_newfontname dup exch def % Get the dictionary of the resident font on which the new % version will be based /ct_basefontdict ct_basefontname findfont def % Determine how large the new font dictionary for the % font should be /ct_numentries ct_basefontdict maxlength def % Create a dictionary to hold the description for the % new font. /ct_outfontdict ct_numentries dict def % Copy everything but not the FID entry of the resident font ct_basefontdict { exch dup /FID ne { exch ct_outfontdict 3 1 roll put } { pop pop } ifelse } forall % Execute special instructions to set variables for slanted or/and extended font ct_special exec % Construct the matrix to transform the font /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 % Now make the created dictionary into a POSTSCRIPT font [/ct_cid_scaled ct_newfontname ct_outfontdict definefont def % and duplicate /foo so that it can be used both in definefont % and as the name of the macro, which is created first as a % non-executable array so that we can put the new font dictionary % itself inside the macro; /ct_outfontdict_scaled ct_cid_scaled ct_mtx makefont def % Restore slant and extend parameters to default values /ct_slant 0.0 def /ct_extend 1.0 def % this involves a circumlocution to insert the setfont command. ct_outfontdict_scaled /setfont load] % Finally the macro is made executable and given the name /foo. cvx def } def end % Identity CMap resource for using with POSTSCRIPT command 'composefont' % to create resident CID font Bar /CIDInit/ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo 3 dict dup begin /Registry(Adobe)def /Ordering(Identity)def /Supplement 0 def end def /CMapName/TeX_Identity-H def /CMapVersion 1.000 def /CMapType 1 def 1 begincodespacerange <0000> endcodespacerange 1 begincidrange <0000>0 endcidrange endcmap CMapName currentdict /CMap defineresource pop end end