summaryrefslogtreecommitdiff
path: root/dviware/catdvi/page2.h
blob: deb39c6c7274afbca48d9b8e44d9f30615e08375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* catdvi - get text from DVI files
   Copyright (C) 1999 Antti-Juhani Kaijanaho <gaia@iki.fi>
   Copyright (C) 2000-02 Bjoern Brill <brill@fs.math.uni-frankfurt.de>

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/* Files that need some of the internals of page.c exposed should include
 * this header rather than page.h
 */

#ifndef PAGE2_H
#define PAGE2_H

#include "page.h"

/* A page is modeled as an ordered doubly-linked list of boxes (x, y,
   glyph), where the ordering is left-to-right top-to-bottom. */

enum box_flag_t {
    BF_SWIMMING =   1 << 0,
    	/* (x, y) != (left border, baseline). We need to
    	 * move this one to the "logically right" place.
	 */
    BF_HAS_AXIS =   1 << 1,
    	/* box_t.axis is valid, i.e. we know where the math
    	 * axis passes through this box.
	 */
    BF_ON_AXIS =    1 << 2,
    	/* This box is centered on the math axis (e.g. the
    	 * big operators). Implies BF_SWIMMING.
    	 */
    BF_RADICAL =    1 << 3,
    	/* This is a radical sign (and hence "hanging down"
    	 * from the y coordinate). Implies BF_SWIMMING.
	 */
    BF_DIACRITIC =  1 << 4 
    	/* This is a diacritical mark. Often its baseline is vertically
	 * displaced against the baseline of the glyph it should accent
    	 * because the combination looks better this way).
	 * Implies BF_SWIMMING.
	 */
};
   
struct box_t {
        sint32 x;
        sint32 y;
	sint32 axis;
	
        sint32 width;
        sint32 height;
	sint32 depth;
	sint32 axis_height; /* The TeX font parameter. <= 0 if unknown. */
	
        glyph_t glyph;
        font_t font;
	enum box_flag_t flags;
};

typedef struct list_node_t list_node_t;
struct list_node_t {
        struct box_t b;
        struct list_node_t * prev;
        struct list_node_t * next;
};

/* List support variables.  Note that most insertions happen near the
   previous insertion, so it's beneficial to keep a pointer to the
   last inserted node. */
extern struct list_node_t * list_head;
extern struct list_node_t * list_tail;
extern struct list_node_t * list_latest; /* Node that was inserted last. */


/* normalize placement of combining diacritics */
void page_adjust_diacritics(void);

/* normalize placement of big operators etc. */
void page_adjust_texmext(void);

/* normalize placement of radicals */
void page_adjust_radicals(void);

#endif /* PAGE2_H */