| 1 |
/* |
| 2 |
* Copyright (c) 1990-2013 Paul Vojta and the xdvik development team |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 |
* of this software and associated documentation files (the "Software"), to |
| 6 |
* deal in the Software without restriction, including without limitation the |
| 7 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 8 |
* sell copies of the Software, and to permit persons to whom the Software is |
| 9 |
* furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice shall be included in |
| 12 |
* all copies or substantial portions of the Software. |
| 13 |
* |
| 14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 |
* PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM, |
| 18 |
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
* |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef DVI_DRAW_H_ |
| 25 |
#define DVI_DRAW_H_ |
| 26 |
|
| 27 |
#include "xdvi.h" |
| 28 |
|
| 29 |
|
| 30 |
extern void prescan(FILE *fp); |
| 31 |
|
| 32 |
|
| 33 |
/* forward declarations */ |
| 34 |
struct font; |
| 35 |
struct tn; |
| 36 |
|
| 37 |
/* this information is saved when using virtual fonts */ |
| 38 |
struct drawinf { |
| 39 |
struct framedata data; |
| 40 |
struct font *fontp; |
| 41 |
set_char_proc set_char_p; |
| 42 |
unsigned long tn_table_len; |
| 43 |
struct font **tn_table; |
| 44 |
struct tn *tn_head; |
| 45 |
ubyte *pos, *end; /* pointers to a scan buffer defined in dvi-draw.c */ |
| 46 |
struct font *virtual; |
| 47 |
#ifdef TEXXET |
| 48 |
int dir; |
| 49 |
#endif |
| 50 |
}; |
| 51 |
|
| 52 |
struct src_parsed_special { |
| 53 |
int line; |
| 54 |
int col; |
| 55 |
char *filename; |
| 56 |
size_t filename_len; |
| 57 |
}; |
| 58 |
extern void src_parse(const char *str, int str_len, struct src_parsed_special *parsed); |
| 59 |
|
| 60 |
/* |
| 61 |
* pixel_conv is currently used only for converting absolute positions |
| 62 |
* to pixel values; although normally it should be |
| 63 |
* |
| 64 |
* ((int) ((x) / currwin.shrinkfactor + (1 << 15) >> 16)), |
| 65 |
* |
| 66 |
* the rounding is achieved instead by moving the constant 1 << 15 to |
| 67 |
* PAGE_OFFSET in dvi-draw.c. |
| 68 |
*/ |
| 69 |
|
| 70 |
#define pixel_conv(x) ((int) ((x) / currwin.shrinkfactor >> 16)) |
| 71 |
#define pixel_round(x) ((int) ROUNDUP(x, currwin.shrinkfactor << 16)) |
| 72 |
|
| 73 |
/* entries below with the characters 'dvi' in them are actually stored in |
| 74 |
scaled pixel units */ |
| 75 |
|
| 76 |
#define DVI_H currinf.data.dvi_h |
| 77 |
#define PXL_H pixel_conv(currinf.data.dvi_h) |
| 78 |
#define DVI_V currinf.data.dvi_v |
| 79 |
#define PXL_V currinf.data.pxl_v |
| 80 |
#define WW currinf.data.w |
| 81 |
#define XX currinf.data.x |
| 82 |
#define YY currinf.data.y |
| 83 |
#define ZZ currinf.data.z |
| 84 |
|
| 85 |
extern void draw_page(void); |
| 86 |
extern void source_reverse_search(int, int, wide_bool); |
| 87 |
extern void source_special_show(wide_bool); |
| 88 |
extern void source_forward_search(const char *); |
| 89 |
|
| 90 |
extern void anchor_search(const char *str); |
| 91 |
|
| 92 |
|
| 93 |
/* |
| 94 |
this is needed by any program that wants to use spcl_scan, |
| 95 |
since the buffer is supposed to be of that length. |
| 96 |
*/ |
| 97 |
#ifndef DVI_BUFFER_LEN |
| 98 |
#define DVI_BUFFER_LEN 2048 |
| 99 |
#endif |
| 100 |
|
| 101 |
extern void open_font_file(struct font *fontp); |
| 102 |
extern long text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch); |
| 103 |
extern Boolean spcl_scan(Boolean(*spcl_proc) (char *str, int str_len, void *data), void *data, Boolean return_if_found, FILE *fp); |
| 104 |
|
| 105 |
extern void geom_scan_part(long(*char_proc)(FILE *, struct scan_info *, wide_ubyte), |
| 106 |
FILE *fp, struct scan_info *info, struct frame *min_frame, double current_dimconv); |
| 107 |
|
| 108 |
extern void geom_scan(long(*char_proc)(FILE *, struct scan_info *, wide_ubyte), |
| 109 |
FILE *fp, struct scan_info *info, int pageno); |
| 110 |
|
| 111 |
extern off_t save_file_status(FILE *fp, struct drawinf *currinf_save, ubyte *maxchar_save); |
| 112 |
extern void reinit_text_scan(void); |
| 113 |
extern void restore_file_status(FILE *fp, struct drawinf currinf_save, ubyte maxchar_save, off_t pos_save); |
| 114 |
|
| 115 |
void htex_do_special(const char *str, size_t len); |
| 116 |
|
| 117 |
extern setcharRetvalT set_char( |
| 118 |
#ifdef TEXXET |
| 119 |
wide_ubyte cmd, |
| 120 |
#endif |
| 121 |
wide_ubyte ch); |
| 122 |
extern setcharRetvalT load_n_set_char( |
| 123 |
#ifdef TEXXET |
| 124 |
wide_ubyte cmd, |
| 125 |
#endif |
| 126 |
wide_ubyte ch); |
| 127 |
extern setcharRetvalT set_vf_char( |
| 128 |
#ifdef TEXXET |
| 129 |
wide_ubyte cmd, |
| 130 |
#endif |
| 131 |
wide_ubyte ch); |
| 132 |
|
| 133 |
extern setcharRetvalT set_ft_char( |
| 134 |
#if TEXXET |
| 135 |
wide_ubyte cmd, |
| 136 |
#endif |
| 137 |
wide_ubyte ch); |
| 138 |
|
| 139 |
#ifdef GREY |
| 140 |
void init_plane_masks(void); |
| 141 |
#endif |
| 142 |
|
| 143 |
#if COLOR |
| 144 |
struct rgb; /* forward declaration */ |
| 145 |
|
| 146 |
Pixel alloc_color(const struct rgb *, Pixel); |
| 147 |
void do_color_change(void); |
| 148 |
#elif GREY |
| 149 |
void init_pix(void); |
| 150 |
#endif |
| 151 |
|
| 152 |
void dvi_fmt_error(const char *message, ...); |
| 153 |
|
| 154 |
#endif /* DVI_DRAW_H_ */ |