Beruflich Dokumente
Kultur Dokumente
Copyright (C) 1992, 1993, 1994, 1995, 1999 Aladdin Enterprises. All rights
reserved.
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
ifelse
} bind def
% Get the protection appropriate for (all the) values in a dictionary.
/getva
{ a_noaccess exch
{ exch pop
dup type dup /stringtype eq 1 index /arraytype eq or
exch /packedarraytype eq or
{ getpa a_readonly and or }
{ pop pop a_all exit }
ifelse
}
forall
} bind def
% Keep track of executeonly and noaccess objects,
% but don't let the protection actually take effect.
.currentglobal
false .setglobal
% so protected can reference local objs
/protected
% do first so // will work
systemdict wcheck { 1500 dict } { 1 dict } ifelse
def
systemdict wcheck not
{ (Warning: you will not be able to convert protected fonts.\n) print
(If you need to convert a protected font, please\n) print
(restart the program and specify the -dWRITESYSTEMDICT switch.\n) print
flush
(%end) .skipeof
}
if
userdict begin
/executeonly
{ dup //protected exch //a_executeonly put readonly
} bind def
/noaccess
{ dup //protected exch //a_noaccess put readonly
} bind def
end
true .setglobal
systemdict begin
/executeonly
{ userdict /executeonly get exec
} bind odef
/noaccess
{ userdict /noaccess get exec
} bind odef
end
%end
.setglobal
% ------ Output utilities ------ %
% By convention, the output file is named cfile.
% Define some utilities for writing the output file.
/wtstring 100 string def
/wb {cfile exch write} bind def
/ws {cfile exch writestring} bind def
/wl {ws (\n) ws} bind def
/Private { 0 wd } def
/CharStrings
{ ({) wl
dup wcdkeys
(static const unsigned char values_[] = {) wl
{ wsn } cdforall
(\t0\n};) wl
(\tcode = \(*pprocs->string_dict_create\)\(i_ctx_p, &) ws wt
(, &keys_, (const char *)str_keys_, \(const char *\)values_\);) wl
(\tif ( code < 0 ) return code;) wl
(}) wl
} bind def
/Metrics
{ ({) wl
dup wcdkeys
(static const ref_(float) values_[] = {) wl
dup { (\t) ws wnums () wl } cdforall
(\t0\n};) wl
(static const unsigned char lengths_[] = {) wl
{ (\t) ws dup isnumber
{ pop 0 }
{ length 1 add }
ifelse wt (,) wl
} cdforall
(\t0\n};) wl
(\tcode = \(*pprocs->num_dict_create\)\(i_ctx_p, &) ws wt
(, &keys_, str_keys_, (const ref *)values_, lengths_\);) wl
(\tif ( code < 0 ) return code;) wl
(}) wl
} bind def
/Metrics2 /Metrics load def
/FDepVector pop
end def
% ------ The main program ------ %
% Construct an inverse dictionary of encodings.
[ /StandardEncoding /ISOLatin1Encoding
/SymbolEncoding /DingbatsEncoding
/KanjiSubEncoding
]
dup length dict begin
{ mark exch dup { .findencoding exch def } stopped cleartomark
} forall
currentdict end /encodingnames exch def
% Invert the StandardEncoding and ISOLatin1Encoding vectors.
512 dict begin
0 1 255 { dup ISOLatin1Encoding exch get exch 256 add def } for
0 1 255 { dup StandardEncoding exch get exch def } for
currentdict end /decoding exch def
/writefont
% cfilename procname -> [writes the current font]
{ (gsf_) exch concatstrings
/fontprocname exch def
% font2cdict
findfont setfont
(FontName is ) print currentfont /FontName get ==only (.\n) print flush
counttomark 1 eq
{
% Construct the procedure name from the file name.
currentfont /FontName get makefontprocname
}
if
writefont
(Done.\n) print flush
}
{ cleartomark
(Usage: font2c fontname cfilename.c [shortname]\n) print
( e.g.: font2c Courier cour.c\n) print flush
mark
}
ifelse
}
if pop