| 1 |
/* |
| 2 |
* TEX Device Driver ver 2.02- |
| 3 |
* copyright(c) 1988,89 by TSG, 1990- by SHIMA |
| 4 |
* 1991 changed by hideki |
| 5 |
* |
| 6 |
* dd.h : common header file |
| 7 |
* |
| 8 |
*/ |
| 9 |
#ifndef INC_DD_H |
| 10 |
#define INC_DD_H |
| 11 |
|
| 12 |
#ifndef __STDIO_H |
| 13 |
#include <stdio.h> |
| 14 |
#endif |
| 15 |
|
| 16 |
/* reduce harmless warning messsages */ |
| 17 |
#if defined(MSVC) && !defined(_WARNING_) |
| 18 |
#define _WARNING_ |
| 19 |
#pragma warning( disable : 4244 4018 4028 4102 4761 4146 4047 4305 4113 4245) |
| 20 |
#endif |
| 21 |
|
| 22 |
#ifdef WIN32 |
| 23 |
#define WIN32G |
| 24 |
#define STR_SEARCH |
| 25 |
#define USE_COLOR |
| 26 |
#define HYPERTEX |
| 27 |
#define PLUG 1 |
| 28 |
#define DOUBLE_PAGE |
| 29 |
#define DVI_ADD |
| 30 |
#define USE_ETF |
| 31 |
#endif |
| 32 |
|
| 33 |
#if defined(WIN32G) || defined(WIN32C) |
| 34 |
#define USE_WINAPI |
| 35 |
#define MAX_KPS_DEPTH 16 |
| 36 |
#elif defined(UNIX) |
| 37 |
#define MAX_KPS_DEPTH 16 |
| 38 |
#endif |
| 39 |
|
| 40 |
#ifdef USE_WINAPI |
| 41 |
#define USE_WINFONT |
| 42 |
#endif |
| 43 |
|
| 44 |
#ifdef NOPS |
| 45 |
#define NOPSFRAG |
| 46 |
#endif |
| 47 |
|
| 48 |
int strlcmp(const char *, const char *); |
| 49 |
|
| 50 |
#ifndef MSVC |
| 51 |
long filelength(int); |
| 52 |
int strcmpi(const char *, const char *); |
| 53 |
#ifndef GCC |
| 54 |
char *stpcpy(char *, const char *); |
| 55 |
#endif |
| 56 |
#endif |
| 57 |
|
| 58 |
#if !defined(GCC1) || defined(UNIX) |
| 59 |
#define GetCh() getch() |
| 60 |
#define KbHit() kbhit() |
| 61 |
#endif |
| 62 |
|
| 63 |
#ifdef UNIX |
| 64 |
#define MAXPATH 256 |
| 65 |
#define MAXDRIVE 1 |
| 66 |
#define MAXDIR 256 |
| 67 |
#define MAXFILE 128 |
| 68 |
#define MAXEXT 128 |
| 69 |
#define O_BINARY 0 |
| 70 |
#endif |
| 71 |
|
| 72 |
#ifndef max |
| 73 |
#define max(a,b) ( (a) > (b) ? (a) : (b) ) |
| 74 |
#define min(a,b) ( (a) < (b) ? (a) : (b) ) |
| 75 |
#endif |
| 76 |
|
| 77 |
/* standard definitons */ |
| 78 |
|
| 79 |
#define uchar unsigned char |
| 80 |
#define uint unsigned int |
| 81 |
#define ulong unsigned long |
| 82 |
typedef void (*void_func_ptr) (); |
| 83 |
typedef int (*int_func_ptr) (); |
| 84 |
typedef int (* COMP)(const void *, const void *); |
| 85 |
|
| 86 |
#if 0 |
| 87 |
/** We do not use them in dviout-util (TeX Live) **/ |
| 88 |
#ifdef FALSE |
| 89 |
#undef FALSE |
| 90 |
#endif |
| 91 |
#ifdef TRUE |
| 92 |
#undef TRUE |
| 93 |
#endif |
| 94 |
#ifdef BOOL |
| 95 |
#undef BOOL |
| 96 |
#endif |
| 97 |
typedef enum{ |
| 98 |
FALSE = 0, |
| 99 |
TRUE = 1 |
| 100 |
} BOOL; |
| 101 |
#endif |
| 102 |
|
| 103 |
#define NOTHING 0 |
| 104 |
#define FAILURE (-1) |
| 105 |
#define NOMORE (-2) |
| 106 |
|
| 107 |
#ifndef SEEK_SET |
| 108 |
#define SEEK_SET 0 |
| 109 |
#define SEEK_CUR 1 |
| 110 |
#define SEEK_END 2 |
| 111 |
#endif |
| 112 |
|
| 113 |
#if defined(LIPS3)||defined(ESCPAGE) |
| 114 |
#define LBP |
| 115 |
#endif |
| 116 |
|
| 117 |
#ifdef LBP |
| 118 |
#define FDOWN |
| 119 |
#else |
| 120 |
#undef JDWN |
| 121 |
#endif |
| 122 |
|
| 123 |
#if !defined(JDWN) && defined(JGAIJI) |
| 124 |
#undef JGAIJI |
| 125 |
#endif |
| 126 |
|
| 127 |
void Free0(void *); |
| 128 |
|
| 129 |
#ifdef WIN32 |
| 130 |
void Free(void *); |
| 131 |
#define get_near_work(x) marea(x) |
| 132 |
#else |
| 133 |
#define Free(x) free(x) |
| 134 |
extern uchar *get_near_work(uint); |
| 135 |
#endif |
| 136 |
|
| 137 |
/* definitons for device driver */ |
| 138 |
|
| 139 |
|
| 140 |
//#ifdef GCC |
| 141 |
#define far |
| 142 |
#define huge |
| 143 |
//#endif |
| 144 |
|
| 145 |
#define BUFFER uchar far |
| 146 |
#define HUGE_BUF uchar huge |
| 147 |
/* Both BUFFER pointer and HUGE_BUF pointer are 32bit-pointer. |
| 148 |
* HUGE_BUF will be used for larger buffers ( correctly speaking, |
| 149 |
* ones which keep more data than 64Kbytes ). |
| 150 |
* And it is noteworthy that the pointers of these types are impossible |
| 151 |
* to express continually ( ex. BUFFER *a, *b ), because they are not |
| 152 |
* "typedef" but "#define." This foolish error is because of 8086CPU, |
| 153 |
* which has only 16bit-pointer, so we must add "far" or "huge" for use of |
| 154 |
* 32bit-pointer. However, "far" and "huge" are permitted to "typedef." |
| 155 |
* How wonderful SEGMENT !! |
| 156 |
*/ |
| 157 |
#ifdef NOFLOAT |
| 158 |
#define SIZE_PARA long |
| 159 |
#else |
| 160 |
#define SIZE_PARA double |
| 161 |
#endif |
| 162 |
/* This device driver calculate units with double. |
| 163 |
*/ |
| 164 |
#define F_SIZE_PARA long |
| 165 |
/* This device driver calculate units with double. |
| 166 |
*/ |
| 167 |
#define PIXEL int |
| 168 |
#define SCALED_PT long |
| 169 |
/* the units of pixel and scaled-point |
| 170 |
*/ |
| 171 |
|
| 172 |
#define HEADER_DEPTH 0xe0000L |
| 173 |
#define FOOTER_DEPTH 0xe0000L |
| 174 |
/* the header depth and the footer depth ( scaled point ) |
| 175 |
*/ |
| 176 |
|
| 177 |
typedef enum { |
| 178 |
UNKNOWN, ONDEMAND, ONDEMAND2, UNRESOLVE, |
| 179 |
PK_FONT, PXL1001, PXL1002, PXL1003, PKD_FONT, JXL, |
| 180 |
SUBTFM, |
| 181 |
#ifdef VFD /* Fonts before JXL should be unscalable */ |
| 182 |
VFD_FONT, |
| 183 |
#endif |
| 184 |
#ifdef TTFONT /* European TrueType fonts (expand by dviout) */ |
| 185 |
CMTTF, |
| 186 |
#endif |
| 187 |
#ifdef USE_WINFONT /* Europian TrueType fonts (WinAPI) */ |
| 188 |
WINTT_FONT, |
| 189 |
#endif |
| 190 |
#ifdef VIRTUALFONT |
| 191 |
VIRTUAL_FONT, |
| 192 |
#endif |
| 193 |
SUBJFM, ROM_FONT, ZS_FONT, |
| 194 |
#ifdef BEZIERFONT |
| 195 |
JG_FONT, |
| 196 |
#endif |
| 197 |
#ifdef TTFONT /* Japanese TrueType fonts (expand by dviout) */ |
| 198 |
TT_FONT, |
| 199 |
#endif |
| 200 |
#ifdef USE_WINFONT /* Japanese TrueType fonts (WinAPI) */ |
| 201 |
WINJTT_FONT, |
| 202 |
#endif |
| 203 |
#ifdef USE_ETF |
| 204 |
ETF_FONT, |
| 205 |
#endif |
| 206 |
JLBP, JIS_FONT, JIS_PK, JIS_PKH, GAIJI |
| 207 |
} FONT_TYPE; |
| 208 |
|
| 209 |
/* FONT_TYPE shows the type of fonts */ |
| 210 |
|
| 211 |
typedef enum { |
| 212 |
HORIZONTAL, VERTICAL |
| 213 |
} PRINT_DIR; |
| 214 |
|
| 215 |
/* Direction at printing, HORIZONTAL normally. |
| 216 |
*/ |
| 217 |
|
| 218 |
typedef enum { |
| 219 |
PreviousPart, NextPart, |
| 220 |
PreviousPage, NextPage, |
| 221 |
NextPageDirection, |
| 222 |
EscapeQuit |
| 223 |
} NEXT_ACTION; |
| 224 |
|
| 225 |
/* These values are returned by device-output module, which says |
| 226 |
* what to do next. |
| 227 |
*/ |
| 228 |
|
| 229 |
#define PREAMBLE struct PREAMBLE_REC far |
| 230 |
/* Information about Preamble of a font-file |
| 231 |
*/ |
| 232 |
struct PREAMBLE_REC { |
| 233 |
PIXEL width, height, pitch_offset, depth_offset; |
| 234 |
/* the size of the character, and the offset for typesetting. |
| 235 |
*/ |
| 236 |
BUFFER *raster; |
| 237 |
/* the pointer of Raster-data buffer |
| 238 |
*/ |
| 239 |
long tfm_width; |
| 240 |
int byte_width; |
| 241 |
/* equal width/8, raised decimal |
| 242 |
*/ |
| 243 |
PIXEL shift_up_ptex, shift_right_ptex; |
| 244 |
/* the offset when lateral-Kanji used (when in pTeX tate mode) |
| 245 |
*/ |
| 246 |
int rotate_ptex; |
| 247 |
/* the flag of rotation (when in pTeX tate mode) |
| 248 |
*/ |
| 249 |
}; |
| 250 |
|
| 251 |
#define CHAR_INFO struct CHAR_INFO_REC far |
| 252 |
/* This buffer is a linked-list one, which keeps pointers of unpacked |
| 253 |
* fonts. |
| 254 |
*/ |
| 255 |
struct CHAR_INFO_REC { |
| 256 |
uint code; |
| 257 |
/* character code |
| 258 |
*/ |
| 259 |
CHAR_INFO *next_char; |
| 260 |
CHAR_INFO *former_char; |
| 261 |
/* needless to say? */ |
| 262 |
struct PREAMBLE_REC pre; |
| 263 |
/* preamble of an unpacked font |
| 264 |
*/ |
| 265 |
}; |
| 266 |
|
| 267 |
#define f_HUGE 0x8000 |
| 268 |
#define f_EMS 0x4000 |
| 269 |
|
| 270 |
#define BUF_INFO struct BUF_INFO_REC |
| 271 |
/* Information about buffers |
| 272 |
*/ |
| 273 |
struct BUF_INFO_REC { |
| 274 |
BUFFER *start; |
| 275 |
BUFFER *current; |
| 276 |
BUFFER *end; |
| 277 |
/* Each means starting, current, and ending pointer of the buffer. |
| 278 |
* Especially, 'end' means 'start+size', so the pointer above ( or |
| 279 |
* which equals )'end' will be out of the buffer. |
| 280 |
*/ |
| 281 |
long size; |
| 282 |
int flush; |
| 283 |
}; |
| 284 |
|
| 285 |
typedef struct { |
| 286 |
long offset; |
| 287 |
int number; |
| 288 |
#ifdef HYPERTEX |
| 289 |
int hyper0; |
| 290 |
#endif |
| 291 |
} |
| 292 |
PAGE_INDEX; |
| 293 |
/* _REC; |
| 294 |
|
| 295 |
#define PAGE_INDEX PAGE_INDEX_REC far |
| 296 |
*/ |
| 297 |
|
| 298 |
/* page index buffer */ |
| 299 |
|
| 300 |
#define DVIFILE_INFO struct DVIFILE_INFO_REC |
| 301 |
/* Information about Preamble of DVI-file. ( to say the truth, this is |
| 302 |
* the same thing as Preamble itself. So, you'd better see |
| 303 |
* "TeX : The Program." ) |
| 304 |
*/ |
| 305 |
struct DVIFILE_INFO_REC { |
| 306 |
FILE *file_ptr; |
| 307 |
char *file_name; |
| 308 |
long post, last_bop; |
| 309 |
long num, den, mag; |
| 310 |
SCALED_PT l, u; |
| 311 |
int stack_depth; |
| 312 |
int total_page; |
| 313 |
}; |
| 314 |
|
| 315 |
#define DIMENSION struct DIMENSION_REC |
| 316 |
/* Information about device-output |
| 317 |
*/ |
| 318 |
|
| 319 |
struct DIMENSION_REC { |
| 320 |
int dpi; |
| 321 |
/* is horizontal dot-per-inch ratio of the device |
| 322 |
*/ |
| 323 |
int DPI; |
| 324 |
/* is vertical dot-per-inch ratio of the device . |
| 325 |
*/ |
| 326 |
PIXEL max_width, max_height; |
| 327 |
/* These tell us the maximum size the device can output. |
| 328 |
* They are represented by pixel-unit. |
| 329 |
*/ |
| 330 |
PIXEL output_width, output_height; |
| 331 |
/* is the final size to be output to the device |
| 332 |
*/ |
| 333 |
PIXEL buf_width, buf_height; |
| 334 |
/* These tell us the maximum size Bitmap-buffer can hold. |
| 335 |
* oriented by text direction |
| 336 |
*/ |
| 337 |
PIXEL text_width, text_height; |
| 338 |
/* These are the maxmum size directed in DVI-file. |
| 339 |
*/ |
| 340 |
int mag; |
| 341 |
/* is the magnification for output. This is the same value as 'mag' in |
| 342 |
* DVI-file ( so equal the one in DVI_INFO ), when no '-mag' & '-half' |
| 343 |
* options directed. |
| 344 |
*/ |
| 345 |
int split; |
| 346 |
/* Our Device-driver divides the text to several parts, if that can't |
| 347 |
* be output at once. 'split' is the number of parts. Then, if 'split' |
| 348 |
* holds '1', Device-driver will put the text at a time. |
| 349 |
*/ |
| 350 |
PRINT_DIR print_direction; |
| 351 |
/* This shows the direction for output, responsing '-V' option. |
| 352 |
* So there is no meaning for PREVIEWER. |
| 353 |
*/ |
| 354 |
SIZE_PARA size_para; |
| 355 |
/* is size-parameter for conversion pixel<-->scaled pt. |
| 356 |
* ( equal "num * den / mag" ) |
| 357 |
*/ |
| 358 |
PIXEL x_offset, y_offset; |
| 359 |
/* the offset of the head of text. These are directed by '-X' and |
| 360 |
* '-Y' options. |
| 361 |
*/ |
| 362 |
PAGE_INDEX *page_index; |
| 363 |
/* the index of file-offset of pages in dvifile |
| 364 |
*/ |
| 365 |
int total_page; |
| 366 |
/* same as 'total_page' in DVI_INFO. |
| 367 |
*/ |
| 368 |
int start_page, end_page; |
| 369 |
/* the starting and the ending page to print. |
| 370 |
*/ |
| 371 |
int max_nombre_page; |
| 372 |
/* the maximal nombre page |
| 373 |
*/ |
| 374 |
int prt_type; |
| 375 |
/* the type of the printer, ESC/P, PC-PR, PC-MN, LIPS3 or Previewer etc |
| 376 |
*/ |
| 377 |
}; |
| 378 |
|
| 379 |
#define NO_PRN_OUT 0x1000 |
| 380 |
|
| 381 |
#define OUTPUT_INFO struct OUTPUT_INFO_REC |
| 382 |
/* Information about output. Interpreting-module and Device-output-module |
| 383 |
* receive the pointer of this. |
| 384 |
*/ |
| 385 |
struct OUTPUT_INFO_REC { |
| 386 |
FILE *dvifile_ptr; |
| 387 |
/* DVI-file pointer |
| 388 |
*/ |
| 389 |
long page_start_offset; |
| 390 |
/* the file-offset at the position the page starts from. |
| 391 |
*/ |
| 392 |
PRINT_DIR print_direction; |
| 393 |
/* equal the one in DIMENSION. |
| 394 |
*/ |
| 395 |
PIXEL h_0, v_0; |
| 396 |
/* the original point for output. |
| 397 |
*/ |
| 398 |
PIXEL width, height; |
| 399 |
/* the size for output.; it is assigned for all the size of the text |
| 400 |
* to be held in the buffer. |
| 401 |
*/ |
| 402 |
int byte_width, byte_height; |
| 403 |
/* equal width/8 and height/8. |
| 404 |
*/ |
| 405 |
int split, page; |
| 406 |
/* the current part and page. |
| 407 |
*/ |
| 408 |
HUGE_BUF *bitmap_ptr; |
| 409 |
/* Bitmap pointer |
| 410 |
*/ |
| 411 |
}; |
| 412 |
|
| 413 |
typedef struct { /* KANJI fonts */ |
| 414 |
int width; /* width by dots (without counting K_DBL) */ |
| 415 |
int height; /* height by dots (without counting K_DBL) */ |
| 416 |
int size; /* size by bytes = (width+7)/8*height */ |
| 417 |
int base; /* number of dots under base line */ |
| 418 |
int fh; /* file handle number */ |
| 419 |
char *name; /* Kanji font file_name */ |
| 420 |
} |
| 421 |
KFONT; |
| 422 |
|
| 423 |
typedef struct { |
| 424 |
int char_type; |
| 425 |
int id; |
| 426 |
long width; /* character width */ |
| 427 |
long height; /* character height(length above the baseline) */ |
| 428 |
long depth; /* character depth (length under the baseline) */ |
| 429 |
long italic; |
| 430 |
long glue; |
| 431 |
long plus; |
| 432 |
long minus; |
| 433 |
} |
| 434 |
JFM_DATA; |
| 435 |
|
| 436 |
#define KFONT_SIZE sizeof(KFONT) |
| 437 |
|
| 438 |
#define FONT_INFO struct FONT_INFO_REC far |
| 439 |
/* Information about fonts. This is linked-list. |
| 440 |
*/ |
| 441 |
union EXT { |
| 442 |
BUFFER *dir; /* PXL1001, PXL1002, PXL1003 |
| 443 |
address of the directory for PXLFONT */ |
| 444 |
KFONT *kdir; /* JLBP, JIS_FONT, JIS_PK, JIS_PKH, GAIJI */ |
| 445 |
int fh; /* JXL, PKD_FONT, VFD_FONT (file handle) */ |
| 446 |
/* ZS_FONT, JG_FONT, TT_FONT (use as ID) */ |
| 447 |
long count; |
| 448 |
#ifdef VIRTUALFONT |
| 449 |
FONT_INFO *local_font; |
| 450 |
#endif |
| 451 |
}; |
| 452 |
|
| 453 |
#define CHAR_ROOT 8 /* should be a power of 2 */ |
| 454 |
#define MAX_NAME_LEN 128 |
| 455 |
|
| 456 |
struct FONT_INFO_REC { /* 4*CHAR_ROOT + 46 = 78 bytes |
| 457 |
+ 4 = 82 bytes (FDOWN) |
| 458 |
+ 6 = 88 bytes (NTTRPL)*/ |
| 459 |
int font_code; |
| 460 |
/* sent from dvi-file, when the font is defined. |
| 461 |
*/ |
| 462 |
FONT_TYPE font_type; |
| 463 |
/* type of font. |
| 464 |
*/ |
| 465 |
FONT_TYPE etf_type; |
| 466 |
/* type of ETF_FONT. |
| 467 |
*/ |
| 468 |
int f_goth; |
| 469 |
/* flag for gothic etc. |
| 470 |
*/ |
| 471 |
char *name; |
| 472 |
/* the file-name of the font. |
| 473 |
*/ |
| 474 |
BUFFER *pk; |
| 475 |
/* the pointer of unpacked data of the font. |
| 476 |
* it is NULL, when data is unloaded or flushed. |
| 477 |
*/ |
| 478 |
CHAR_INFO *char_info[CHAR_ROOT]; |
| 479 |
/* the pointers of the first CHAR_INFO of the font. |
| 480 |
* Also, it is NULL, when data is unloaded or flushed. |
| 481 |
*/ |
| 482 |
FONT_INFO *k_top; |
| 483 |
FONT_INFO *k_next; |
| 484 |
|
| 485 |
F_SIZE_PARA size_para; |
| 486 |
|
| 487 |
F_SIZE_PARA des_para; |
| 488 |
/* design size. |
| 489 |
*/ |
| 490 |
int dpi; |
| 491 |
/* requested dpi |
| 492 |
*/ |
| 493 |
int sdpi; |
| 494 |
/* substituted dpi |
| 495 |
*/ |
| 496 |
char n[MAX_NAME_LEN]; |
| 497 |
/* font name |
| 498 |
*/ |
| 499 |
FONT_INFO *next_font; |
| 500 |
/* equal NULL, when no next font. |
| 501 |
*/ |
| 502 |
FONT_INFO *before_font; |
| 503 |
/* equal NULL, when no former font |
| 504 |
*/ |
| 505 |
FONT_INFO *after_font; |
| 506 |
/* equal NULL, when no after font |
| 507 |
*/ |
| 508 |
int k_width; |
| 509 |
/* normal allowable maximal width of Kanji character by bits |
| 510 |
* counting k_scale |
| 511 |
* in PTeX TATE-KUMI fonts, it shows height of fonts. |
| 512 |
*/ |
| 513 |
int k_height; |
| 514 |
/* normal allowable maximal height of Kanji character by bits |
| 515 |
* counting k_scale |
| 516 |
* in PTeX TATE-KUMI fonts, it shows width of fonts. |
| 517 |
*/ |
| 518 |
int last; |
| 519 |
/* last JIS CODE of Kanji font, |
| 520 |
offset of character packet of Virtual Font |
| 521 |
*/ |
| 522 |
long c; |
| 523 |
/* checksum (id) |
| 524 |
*/ |
| 525 |
union EXT ext; |
| 526 |
|
| 527 |
int texpk_pos; |
| 528 |
|
| 529 |
#ifdef LBP |
| 530 |
int lbp_font_inf; /*0-3bit:フォント番号-80H, |
| 531 |
4,5:bold flag (0:normal, 1:1dot, 2:2dot) |
| 532 |
6:ouline flag 8-15:フォント縦横比(0-200)*/ |
| 533 |
#endif |
| 534 |
#ifdef FDOWN |
| 535 |
uchar *d_flag; |
| 536 |
#endif |
| 537 |
void *vjfm; /* WINTT_FONT or VIRTUAL_FONT */ |
| 538 |
|
| 539 |
#ifndef NO_NTTRPL |
| 540 |
int code_offset; |
| 541 |
int pt_size; |
| 542 |
int family_code; |
| 543 |
#endif |
| 544 |
#ifdef USE_SUBFONT |
| 545 |
int sfd_id; |
| 546 |
#endif |
| 547 |
}; |
| 548 |
|
| 549 |
#ifdef LBP |
| 550 |
#ifdef FDOWN |
| 551 |
typedef struct { /*ダウンロード情報*/ |
| 552 |
int assign_num; /*割当番号*/ |
| 553 |
int maxwidth; /*フォント最大幅*/ |
| 554 |
int maxheight; /*フォント最大高*/ |
| 555 |
int mincharcode; /*最小コード*/ |
| 556 |
int maxcharcode; /*最大コード*/ |
| 557 |
int numoffonts; /*ダウンロードしたフォントの数*/ |
| 558 |
long total_send; /*ダウンロードしたトータルバイト数*/ |
| 559 |
long total_off; /*実サイズを使う場合のバイト数の差*/ |
| 560 |
long total_mem; /*セルサイズで計ったトータルバイト数*/ |
| 561 |
} |
| 562 |
DL_INFO; |
| 563 |
|
| 564 |
struct DJFONT_COUNT { /*和文フォントの文字の出現頻度情報 |
| 565 |
: 8 byte -> should be even size*/ |
| 566 |
unsigned short int code; /*文字コード*/ |
| 567 |
unsigned char font_code; /*フォント番号*/ |
| 568 |
unsigned char count; /*出現回数-1*/ |
| 569 |
unsigned short int after; /*次のノード*/ |
| 570 |
unsigned short int before; /*前のノード*/ |
| 571 |
}; |
| 572 |
|
| 573 |
struct DJFONT_TABLE { /*和文フォントのダウンロードした文字情報: 5 byte*/ |
| 574 |
unsigned short int code; /*元の文字コード*/ |
| 575 |
unsigned char font_code; /*元のフォント番号*/ |
| 576 |
unsigned char new_code; /*ダウンロードで埋め込んだ文字コード*/ |
| 577 |
unsigned char new_font_code; /*ダウンロードで埋め込んだフォント番号*/ |
| 578 |
}; |
| 579 |
|
| 580 |
#define DJFONT struct DJFONT_COUNT |
| 581 |
#define DJTABLE struct DJFONT_TABLE |
| 582 |
|
| 583 |
struct REAL_SIZE { /*文字の左右の空白を削った実ボックスサイズ、左上が原点*/ |
| 584 |
int left; /*最左端のx-座標*/ |
| 585 |
int top; /*最上端のy-座標*/ |
| 586 |
int right; /*最右端のx-座標 + 1*/ |
| 587 |
int bottom; /*最下端のy-座標 + 1*/ |
| 588 |
}; |
| 589 |
|
| 590 |
# endif/*FDOWN*/ |
| 591 |
|
| 592 |
typedef struct { |
| 593 |
void (*init) (void); |
| 594 |
void (*init2) (int, int); |
| 595 |
void (*end) (void); |
| 596 |
void (*set_font) (FONT_INFO *, KFONT *, int, int, int); |
| 597 |
void (*move_cap) (PIXEL, PIXEL); |
| 598 |
void (*move_homepoint) (PIXEL, PIXEL); |
| 599 |
void (*pre_put_char) (FONT_INFO *, PREAMBLE*, uint *, PIXEL *, PIXEL *); |
| 600 |
void (*put_jis_font) (uint); |
| 601 |
void (*put_dl_font) (uint); |
| 602 |
long (*get_dlhsize) (int num); |
| 603 |
void (*pre_download) (FONT_INFO *, DL_INFO *, int, int); |
| 604 |
void (*download_rastor) (FONT_INFO *, DL_INFO *, uint, int); |
| 605 |
void (*post_download) (FONT_INFO *, DL_INFO *); |
| 606 |
void (*drawbox) (PIXEL, PIXEL, PIXEL, PIXEL, int); |
| 607 |
void (*rotate) (int); |
| 608 |
void (*tate_yoko) (int); |
| 609 |
struct LIPS_LFONT *data; |
| 610 |
} LBP_FUNC; |
| 611 |
|
| 612 |
struct LIPS_LFONT { |
| 613 |
char *font_name; |
| 614 |
int no; |
| 615 |
}; |
| 616 |
|
| 617 |
#endif /*LBP*/ |
| 618 |
|
| 619 |
/* extern variables */ |
| 620 |
|
| 621 |
extern BUF_INFO buffers[]; |
| 622 |
|
| 623 |
extern FONT_INFO *first_font_info; |
| 624 |
|
| 625 |
/* the first position of the font-list. |
| 626 |
*/ |
| 627 |
|
| 628 |
#define pk_buf_pointer (&buffers[1]) |
| 629 |
|
| 630 |
/* the buffer for pk-font-data loaded from disk directly. |
| 631 |
*/ |
| 632 |
|
| 633 |
#define raster_buf_pointer (&buffers[0]) |
| 634 |
|
| 635 |
/* the buffer for the raster-data of unpacked fonts. |
| 636 |
*/ |
| 637 |
|
| 638 |
#define bitmap_buf_pointer (&buffers[2]) |
| 639 |
|
| 640 |
/* Virtual VRAM buffer. Interpret-module will draw the figure onto this. |
| 641 |
* This is casted to HUGE_BUF when used. |
| 642 |
*/ |
| 643 |
|
| 644 |
/* Buffer for working in far heap: default size = 0 |
| 645 |
*/ |
| 646 |
|
| 647 |
/* Buffer for working in EMS |
| 648 |
*/ |
| 649 |
|
| 650 |
#ifdef GCC |
| 651 |
#define COMMON_SIZE 0x4000 |
| 652 |
#else |
| 653 |
#define COMMON_SIZE 2560 |
| 654 |
#endif |
| 655 |
extern char common_work[COMMON_SIZE]; |
| 656 |
#define tmp_buf common_work |
| 657 |
|
| 658 |
/* Buffer for working in near heap |
| 659 |
COMMON_SIZE should not be smaller than 2048 |
| 660 |
*/ |
| 661 |
|
| 662 |
extern BUFFER *get_work(uint); |
| 663 |
extern FILE *fopenf(char*, char*); |
| 664 |
|
| 665 |
#define F_GOTH 1 |
| 666 |
#define K_DBL 2 |
| 667 |
#define F_LBP 4 |
| 668 |
#define F_DWN 8 |
| 669 |
#define F_FILL 0x10 |
| 670 |
#define F_SHADOW 0x20 |
| 671 |
#define F_OUTLINE 0x40 |
| 672 |
#define F_GGOTH 0x80 |
| 673 |
#define K_SCALE 0x100 |
| 674 |
#define F_TATE 0x200 |
| 675 |
#define K_SCALE2 0x400 |
| 676 |
#define F_TOPT 0x800 |
| 677 |
#define F_DTATE 0x1000 |
| 678 |
#define F_DYOKO 0x2000 |
| 679 |
|
| 680 |
#define F_ATTR (F_GOTH|F_FILL|F_SHADOW|F_OUTLINE|F_GGOTH) |
| 681 |
|
| 682 |
/* Definition for DVI commands */ |
| 683 |
|
| 684 |
#define SET_CHAR_0 0 |
| 685 |
#define SET1 128 |
| 686 |
#define SET_RULE 132 |
| 687 |
#define PUT1 133 |
| 688 |
#define PUT_RULE 137 |
| 689 |
#define NOP 138 |
| 690 |
#define BOP 139 |
| 691 |
#define EOP 140 |
| 692 |
#define PUSH 141 |
| 693 |
#define POP 142 |
| 694 |
#define RIGHT1 143 |
| 695 |
#define W0 147 |
| 696 |
#define W1 148 |
| 697 |
#define X0 152 |
| 698 |
#define X1 153 |
| 699 |
#define DOWN1 157 |
| 700 |
#define Y0 161 |
| 701 |
#define Y1 162 |
| 702 |
#define Z0 166 |
| 703 |
#define Z1 167 |
| 704 |
#define FNT_NUM_0 171 |
| 705 |
#define FNT1 235 |
| 706 |
#define XXX1 239 |
| 707 |
#define FNT_DEF_1 243 |
| 708 |
#define FNT_DEF_4 246 |
| 709 |
#define PRE 247 |
| 710 |
#define POST 248 |
| 711 |
#define POST_POST 249 |
| 712 |
#define EOFNC 255 /* end of func */ |
| 713 |
|
| 714 |
/* Units for length : mm, inch(in), point(pt), scaled point(sp) and macros |
| 715 |
* for them. |
| 716 |
* by K.Yoshizawa Dec. 26, 1992 |
| 717 |
*/ |
| 718 |
#define ROUND(X) (int)((X)+0.5) /* 浮動小数点数→整数時の四捨五入 */ |
| 719 |
|
| 720 |
#define MM_PER_IN 25.4 /* 1in = 25.4mm */ |
| 721 |
#define PT_PER_IN 72.27 /* 1in = 72.27pt */ |
| 722 |
#define BP_PER_IN 72.0 /* 1in = 72.0pt */ |
| 723 |
|
| 724 |
#define IN_PER_MM (1.0/MM_PER_IN) |
| 725 |
#define PT_PER_MM (PT_PER_IN/MM_PER_IN) |
| 726 |
|
| 727 |
#define PT_PER_BP (PT_PER_IN/BP_PER_IN) |
| 728 |
|
| 729 |
#define MM_PER_PT (MM_PER_IN/PT_PER_IN) |
| 730 |
#define IN_PER_PT (1.0/PT_PER_IN) |
| 731 |
|
| 732 |
#define MM_TO_SP(X) PT_TO_SP(MM_TO_PT(X)) |
| 733 |
#define IN_TO_SP(X) PT_TO_SP(IN_TO_PT(X)) |
| 734 |
#define BP_TO_SP(X) PT_TO_SP(BP_TO_PT(X)) |
| 735 |
#define PT_TO_SP(X) ((SCALED_PT)ROUND((double)(X)*65536.0)) |
| 736 |
|
| 737 |
#define IN_TO_MM(X) ((X)*MM_PER_IN) |
| 738 |
#define PT_TO_MM(X) ((X)*MM_PER_PT) |
| 739 |
#define SP_TO_MM(X) PT_TO_MM(SP_TO_PT(X)) |
| 740 |
|
| 741 |
#define MM_TO_IN(X) ((X)*IN_PER_MM) |
| 742 |
#define PT_TO_IN(X) ((X)*IN_PER_PT) |
| 743 |
#define SP_TO_IN(X) PT_TO_IN(SP_TO_PT(X)) |
| 744 |
|
| 745 |
#define MM_TO_PT(X) ((X)*PT_PER_MM) |
| 746 |
#define IN_TO_PT(X) ((X)*PT_PER_IN) |
| 747 |
#define BP_TO_PT(X) ((X)*PT_PER_BP) |
| 748 |
#define SP_TO_PT(X) ((double)(X)/65536.0) |
| 749 |
|
| 750 |
/* |
| 751 |
* type of machine |
| 752 |
*/ |
| 753 |
#define M_PC98 0 |
| 754 |
#define M_DOSV 1 |
| 755 |
#define M_J31 2 |
| 756 |
|
| 757 |
#define M_DBCS 1 |
| 758 |
|
| 759 |
#define issjis1(x) ((x)>=0x81&&(x)<=0xfc&&((x)<=0x9f||(x)>=0xe0)) |
| 760 |
|
| 761 |
#endif // INC_DD_H |
| 762 |
/* end of file : dd.h */ |