1 /* catdvi - get text from DVI files 2 Copyright (C) 1999 Antti-Juhani Kaijanaho <gaia@iki.fi> 3 Copyright (C) 2000-02 Bjoern Brill <brill@fs.math.uni-frankfurt.de> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 /* Files that need some of the internals of page.c exposed should include 21 * this header rather than page.h 22 */ 23 24 #ifndef PAGE2_H 25 #define PAGE2_H 26 27 #include "page.h" 28 29 /* A page is modeled as an ordered doubly-linked list of boxes (x, y, 30 glyph), where the ordering is left-to-right top-to-bottom. */ 31 32 enum box_flag_t { 33 BF_SWIMMING = 1 << 0, 34 /* (x, y) != (left border, baseline). We need to 35 * move this one to the "logically right" place. 36 */ 37 BF_HAS_AXIS = 1 << 1, 38 /* box_t.axis is valid, i.e. we know where the math 39 * axis passes through this box. 40 */ 41 BF_ON_AXIS = 1 << 2, 42 /* This box is centered on the math axis (e.g. the 43 * big operators). Implies BF_SWIMMING. 44 */ 45 BF_RADICAL = 1 << 3, 46 /* This is a radical sign (and hence "hanging down" 47 * from the y coordinate). Implies BF_SWIMMING. 48 */ 49 BF_DIACRITIC = 1 << 4 50 /* This is a diacritical mark. Often its baseline is vertically 51 * displaced against the baseline of the glyph it should accent 52 * because the combination looks better this way). 53 * Implies BF_SWIMMING. 54 */ 55 }; 56 57 struct box_t { 58 sint32 x; 59 sint32 y; 60 sint32 axis; 61 62 sint32 width; 63 sint32 height; 64 sint32 depth; 65 sint32 axis_height; /* The TeX font parameter. <= 0 if unknown. */ 66 67 glyph_t glyph; 68 font_t font; 69 enum box_flag_t flags; 70 }; 71 72 typedef struct list_node_t list_node_t; 73 struct list_node_t { 74 struct box_t b; 75 struct list_node_t * prev; 76 struct list_node_t * next; 77 }; 78 79 /* List support variables. Note that most insertions happen near the 80 previous insertion, so it's beneficial to keep a pointer to the 81 last inserted node. */ 82 extern struct list_node_t * list_head; 83 extern struct list_node_t * list_tail; 84 extern struct list_node_t * list_latest; /* Node that was inserted last. */ 85 86 87 /* normalize placement of combining diacritics */ 88 void page_adjust_diacritics(void); 89 90 /* normalize placement of big operators etc. */ 91 void page_adjust_texmext(void); 92 93 /* normalize placement of radicals */ 94 void page_adjust_radicals(void); 95 96 #endif /* PAGE2_H */ 97