/*
* pixel_conv is currently used only for converting absolute positions
* to pixel values; although normally it should be
* ((int) ((x) / shrink_factor + (1 << 15) >> 16)),
* the rounding is achieved instead by moving the constant 1 << 15 to
* PAGE_OFFSET in dvi_draw.c.
*/
#define pixel_conv(x) ((int) ((x) / shrink_factor >> 16))
#define pixel_round(x) ((int) ROUNDUP(x, shrink_factor << 16))
#define spell_conv0(n, f) ((long) (n * f))
#define spell_conv(n) spell_conv0(n, dimconv)
struct drawinf { /* this information is saved when using virtual fonts */
struct framedata data;
struct font *fontp;
set_char_proc set_char_p;
struct tn *tn_head;
ubyte *pos, *end;
struct font *virtual;
#ifdef TEXXET
int dir;
#endif
};
EXTERN struct drawinf currinf;
/* entries below with the characters 'dvi' in them are actually stored in
scaled pixel units */
EXTERN int current_page;
EXTERN int total_pages;
EXTERN double dimconv;
EXTERN int n_files_left INIT(32767); /* for LRU closing of fonts */
EXTERN time_t dvi_time; /* last mod. time for dvi file */
EXTERN int page_w, page_h;
/*
* Table of page offsets in DVI file, indexed by page number - 1.
* Initialized in prepare_pages().
*/
EXTERN long *page_offset;
/*
* Mechanism for reducing repeated warning about specials, lost characters, etc.
*/
EXTERN Boolean hush_spec NTINIT(False);
EXTERN Boolean hush_spec_now;
EXTERN Boolean hush_chars NTINIT(False);
/*
* Bitmap structure for raster ops.
*/
struct bitmap {
short w, h; /* width and height in pixels */
short bytes_wide; /* scan-line width in bytes */
char *bits; /* pointer to the bits */
};
/*
* Per-character information.
* There is one of these for each character in a font (raster fonts only).
* All fields are filled in at font definition time,
* except for the bitmap, which is "faulted in"
* when the character is first referenced.
*/
struct glyph {
long addr; /* address of bitmap in font file */
long dvi_adv; /* DVI units to move reference point */
short x, y; /* x and y offset in pixels */
struct bitmap bitmap; /* bitmap for character */
short x2, y2; /* x and y offset in pixels (shrunken bitmap) */
#ifdef GREY
XImage *image2;
char *pixmap2;
#endif
struct bitmap bitmap2; /* shrunken bitmap for character */
};
/*
* Per character information for virtual fonts
*/
struct macro {
ubyte *pos; /* address of first byte of macro */
ubyte *end; /* address of last+1 byte */
long dvi_adv; /* DVI units to move reference point */
Boolean free_me; /* if free(pos) should be called when */
/* freeing space */
};
/*
* The layout of a font information block.
* There is one of these for every loaded font or magnification thereof.
* Duplicates are eliminated: this is necessary because of possible recursion
* in virtual fonts.
*
* Also note the strange units. The design size is in 1/2^20 point
* units (also called micro-points), and the individual character widths
* are in the TFM file in 1/2^20 ems units, i.e., relative to the design size.
*
* We then change the sizes to SPELL units (unshrunk pixel / 2^16).
*/
struct font {
struct font *next; /* link to next font info block */
char *fontname; /* name of font */
float fsize; /* size information (dots per inch) */
int magstepval; /* magstep number * two, or NOMAGSTP */
FILE *file; /* open font file or NULL */
char *filename; /* name of font file */
unsigned short timestamp; /* for LRU management of fonts */
ubyte flags; /* flags byte (see values below) */
ubyte maxchar; /* largest character code */
double dimconv; /* size conversion factor */
set_char_proc set_char_p; /* proc used to set char */
/* these fields are used by (loaded) raster fonts */
read_char_proc read_char; /* function to read bitmap */
struct glyph *glyph;
/* these fields are used by (loaded) virtual fonts */
struct tn *vf_chain; /* list of fonts used by this vf */
struct font *first_font; /* first font defined */
struct macro *macro;
/* I suppose the above could be put into a union, but we */
/* wouldn't save all that much space. */
};
#define FONT_IN_USE 1 /* used for housekeeping */
#define FONT_LOADED 2 /* if font file has been read */
#define FONT_VIRTUAL 4 /* if font is virtual */
struct tn {
struct tn *next; /* link to next TeXnumber info block */
int TeXnumber; /* font number (in DVI file) */
struct font *fontp; /* pointer to the rest of the info */
};
EXTERN struct font *font_head INIT(NULL);
EXTERN struct tn *tn_head INIT(NULL);
EXTERN ubyte maxchar;
EXTERN unsigned short current_timestamp INIT(0);
EXTERN int pixels_per_inch NTINIT(BDPI);
EXTERN int offset_x, offset_y;
EXTERN int unshrunk_paper_w, unshrunk_paper_h;
EXTERN int unshrunk_page_w, unshrunk_page_h;
EXTERN int density NTINIT(40);
EXTERN double specialConv;
struct WindowRec {
Window win;
int shrinkfactor;
int base_x, base_y;
int width, height;
int min_x, max_x, min_y, max_y; /* for pending expose events */
};