| 1 |
% Copyright (C) 2001-2023 Artifex Software, Inc. |
| 2 |
% All Rights Reserved. |
| 3 |
% |
| 4 |
% This software is provided AS-IS with no warranty, either express or |
| 5 |
% implied. |
| 6 |
% |
| 7 |
% This software is distributed under license and may not be copied, |
| 8 |
% modified or distributed except as expressly authorized under the terms |
| 9 |
% of the license contained in the file LICENSE in this distribution. |
| 10 |
% |
| 11 |
% Refer to licensing information at http://www.artifex.com or contact |
| 12 |
% Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, |
| 13 |
% CA 94129, USA, for further information. |
| 14 |
% |
| 15 |
|
| 16 |
% Type 42 font support code. |
| 17 |
|
| 18 |
% Here are the BuildChar and BuildGlyph implementation for Type 42 fonts. |
| 19 |
% The names %Type42BuildChar and %Type42BuildGlyph are known to the |
| 20 |
% interpreter. The real work is done in an operator: |
| 21 |
% <font> <code|name> <name> <glyphindex> .type42execchar - |
| 22 |
|
| 23 |
/.type42build % <font> <code|name> <name> .type42build - |
| 24 |
{ 2 index begin |
| 25 |
dup CharStrings exch .knownget not |
| 26 |
{ 2 copy eq { exch pop /.notdef exch } if |
| 27 |
QUIET not |
| 28 |
{ (Substituting .notdef for ) print |
| 29 |
=string cvs print ( in the font ) print |
| 30 |
1 index /FontName get = flush |
| 31 |
} |
| 32 |
{ pop } |
| 33 |
ifelse |
| 34 |
/.notdef CharStrings /.notdef get |
| 35 |
} if |
| 36 |
end .type42execchar |
| 37 |
} bind def |
| 38 |
(%Type42BuildChar) cvn % <font> <code> %Type42BuildChar - |
| 39 |
{ 1 index /Encoding get 1 index get //.type42build exec |
| 40 |
} bind executeonly def |
| 41 |
(%Type42BuildGlyph) cvn % <font> <name> %Type42BuildGlyph - |
| 42 |
{ dup //.type42build exec |
| 43 |
} .internalbind def |
| 44 |
|
| 45 |
currentdict /.type42build .undef |
| 46 |
|
| 47 |
% Register the font type for definefont. |
| 48 |
buildfontdict 42 |
| 49 |
{ % check for bogus sfnts -- this happens in Genoa FTS 421-01.ps |
| 50 |
dup /sfnts get 0 get length 14 lt { % smallest valid sfnts is 14 bytes |
| 51 |
% HACK: Add a BuildGlyph and make this a Type 3 font instead |
| 52 |
dup /FontType 3 put |
| 53 |
dup /BuildGlyph { |
| 54 |
1 index /CharStrings get exch 2 copy known not { pop /.notdef } if get exec |
| 55 |
} bind put |
| 56 |
//.buildfont3 exec |
| 57 |
} { |
| 58 |
systemdict /.buildfont42 get exec |
| 59 |
} ifelse |
| 60 |
} .internalbind |
| 61 |
put |