1. currentfont
Get current font dictionary from graphics state.
1.3. Description
currentfont returns the current font dictionary in the graphics state. Normally, this is the font most recently established by setfont or selectfont.
However, when executed inside a font’s BuildGlyph or BuildChar procedure or a procedure invoked by cshow, currentfont returns the currently selected base font (descendant of a composite font).
1.5. Examples
1.5.1. Querying Current Font
/Helvetica findfont 12 scalefont setfont
currentfont
% Returns the scaled Helvetica font dictionary
1.5.2. Saving and Restoring Font
% Save current font
currentfont /savedFont exch def
% Change font for temporary use
/Times-Roman findfont 10 scalefont setfont
100 100 moveto (Times text) show
% Restore original font
savedFont setfont
100 80 moveto (Original font) show
1.7. Behavior with Composite Fonts
When currentfont is called during font construction:
In BuildGlyph/BuildChar procedures: : Returns the base font selected by the composite font machinery
In cshow procedure:
: Returns the base font for the current character
Normal context:
: Returns the top-level font set by setfont
To get the top-level composite font from within these procedures, use rootfont instead.
1.8. Font Dictionary Contents
The returned font dictionary typically contains:
% Example font dictionary structure
<<
/FontType 1
/FontName /Helvetica
/FontMatrix [0.001 0 0 0.001 0 0]
/FontBBox [-166 -225 1000 931]
/Encoding StandardEncoding
/PaintType 0
/CharStrings <CharStrings dictionary>
/FID <fontID>
>>