#include <DviFile.h>
Public Types | |
enum | DviUnits { unit_BAD, unit_pt, unit_pc, unit_in, unit_bp, unit_cm, unit_mm, unit_dd, unit_cc, unit_sp, unit_pixels, unit_dvi } |
Units of length. More... | |
Public Member Functions | |
DviFile (string &s, int resolution=0, double magmag=1.0, bool read_postamble=true, bool seekable=true) throw (DviError) | |
Constructs a new DviFile object. | |
~DviFile () | |
bool | eof () |
Indicates whether we are at the end of the DVI file. | |
DviFileEvent * | getEvent () |
Gets an event from the DVI file. | |
DviFileEvent * | getEndOfPage () |
Skips to the end of the page. | |
int | currH (DviUnits units=unit_pixels) const throw (DviError) |
Obtains the current horizontal position. | |
int | currV (DviUnits units=unit_pixels) const throw (DviError) |
Obtains the current vertical position. | |
int | hSize () |
Obtains the `width of the widest page'. | |
int | vSize () |
Obtains the `height plus depth of the tallest page'. | |
double | magnification () const |
Return the net magnification factor for the DVI file. | |
int | pt2px (double npt) const |
Converts a length in points to one in pixels, using the current magnifications and any other relevant parameters. | |
const string * | filename () const |
Gets the name of this DVI file. | |
const PkFont * | getFallbackFont (const PkFont *desired) |
Returns a fallback font, for use when a requested font is not available. | |
bool | haveReadPostamble () const |
Reports whether the DVI file postamble was read when this file was opened. | |
const FontSet * | getFontSet () const |
Obtains a representation of the set of fonts contained in this DVI file. | |
Static Public Member Functions | |
DviUnits | unitType (string unitString) |
Convert a string to a unit. | |
string | unitString (DviUnits unit) |
Gets the string representation of a DVI unit. | |
double | convertFromScaledPoints (int sp, DviUnits units, DviFile *dvif=0) throw (DviError) |
Convert a TeX scaled point to another unit. | |
double | convertToScaledPoints (double length, DviUnits units, DviFile *dvif=0) throw (DviError) |
Convert a length to TeX scaled points. | |
double | convertUnits (double length, DviUnits from_units, DviUnits to_units, DviFile *dvif=0) throw (DviError) |
Convert a length from one set of units to another. | |
verbosities | verbosity (const verbosities level) |
Sets the verbosity of this module. |
See the DVI Driver standard [driv-std] for details of the parameters here.
[driv-std] Level-0 DVI Driver Standard, available on-line on CTAN, in the directory dviware/driv-standard.
|
Units of length. Used in currH and currV, and other conversions are available through method convertFromScaledPoints.
|
|
Constructs a new Once the DVI file has been opened in this way, its contents can be processed in an event-based fashion, by repeatedly calling getEvent and handling the returned object.
The DVI file may be specified as "-", in which case the DVI file will be read from After the DVI file has been opened using this constructor, the preamble may or may not be read (this may be specified in future versions). If you need to ensure that the preamble is read (for example if you wish to call convertUnits), then you should call getEvent once to retrieve the DviFilePreamble event which it returns the first time it is called.
|
|
|
|
Convert a TeX scaled point to another unit. It is possible to convert to pixel units with this method; however it is generally better to either get pixel positions directly (through currH or currV for example). The conversions to DVIunits and pixels are not universal, but are instead dependent on a particular DVI file; if you wish to convert to either of these units, you must supply a reference to a DVI file. If not, and argument here is ignored, and may be zero (the default).
|
|
Convert a length to TeX scaled points. The conversions from DVIunits and pixels are not universal, but are instead dependent on a particular DVI file; if you wish to convert from either of these units, you must supply a reference to a DVI file. If not, and argument here is ignored, and may be zero (the default).
|
|
Convert a length from one set of units to another. The conversions to DVIunits and pixels are not universal, but are instead dependent on a particular DVI file; if you wish to convert to either of these units, you must supply a reference to a DVI file. If not, and argument here is ignored, and may be zero (the default).
|
|
Obtains the current horizontal position. The position can be reported in any of unit_pixels, unit_dvi or unit_sp; it is an error to call this function with any other of the defined units. The conversion to pixel units includes any drift correction, and is correctly rounded. Scaled points are calculated as DVI units times the overall magnification (that is, we ignore the general case of DVI files with odd preamble scalings).
|
|
Obtains the current vertical position. See currH, to which this is precisely analogous. |
|
Indicates whether we are at the end of the DVI file. This is true if the underlying file is closed, or if we have read all the pages and getEvent has returned a DviFilePostamble event.
|
|
Gets the name of this DVI file.
|
|
Skips to the end of the page. This reads the DVI file at high speed until it finds the next end-of-page event, which it returns, leaving the DVI file positioned appropriately. If there are in fact no more pages -- if the last end-of-page event has already been returned -- then return either a DviFilePostamble event or zero, just like getEvent.
|
|
Gets an event from the DVI file. This is the routine which does most of the actual work. It scans through the file reading opcodes. Most of these it handles itself, but certain ones it handles by returning an event to the calling routine.
The first event this method will return is the DviFilePreamble event, and the last one is a DviFilePostamble event, after which The events which can be returned are all of the subclasses of DviFileEvent, qv. When you are finished with the returned event, you should release it by a call to the event's release method, after which you should make no further reference to it.
|
|
Returns a fallback font, for use when a requested font is not available. The font returned depends on whether the DVI postamble was read or not, on what fonts have already been seen in the file, and on the font desired. This flexibility will not, however, stray beyond the liberty given by section 4.4, `Missing fonts', in the DVI standard.
|
|
Obtains a representation of the set of fonts contained in this DVI file.
If the postamble was read, then the
|
|
Reports whether the DVI file postamble was read when this file was opened. This affects the semantics of such methods as getFontSet. Note that this only reports whether the postamble was read at the start of processing, and it does not become true when the postamble is discovered at the end; it is not an end-of-file indicator. For that, see the eof method.
|
|
Obtains the `width of the widest page'.
This is either the value obtained from the postamble of the DVI file, if that was read, or else the maximum value of the horizontal position (as returned by
|
|
Return the net magnification factor for the DVI file.
|
|
Converts a length in points to one in pixels, using the current magnifications and any other relevant parameters.
|
|
Gets the string representation of a DVI unit.
|
|
Convert a string to a unit.
|
|
Sets the verbosity of this module.
|
|
Obtains the `height plus depth of the tallest page'.
This is either the value obtained from the postamble of the DVI file, if that was read, or else the maximum value of the vertical position (as returned by
|