File: dvifont.c

package info (click to toggle)
dvi2dvi 2.0alpha-9.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 412 kB
  • ctags: 1,163
  • sloc: ansic: 6,401; makefile: 127; sh: 8
file content (83 lines) | stat: -rw-r--r-- 1,326 bytes parent folder | download | duplicates (9)
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
#include	"defs.h"
#include	"commands.h"
#include	"global.h"
#include	"dvi.h"

void
init_dvi_fontinfo(fe)
struct font_entry *fe;
{
    int	null_markchar();
    void read_dvi_fontinfo();

    fe->fnt_type = FT_DVI;
    /*fe->base_fe->fnt_use = FU_USED;*/
    fe->fnt_markchar = null_markchar;
    fe->fnt_readfontinfo = read_dvi_fontinfo;
}

void
read_dvi_fontinfo(fe)
struct font_entry *fe;
{
    DEV_FONT dvi_fontdict();
    int dvi_setchar(), dvi_setstring();

    fe->dev_fontdict = dvi_fontdict;
    fe->dev_setchar = dvi_setchar;
    fe->dev_setstring = dvi_setstring;
}

/* ARGSUSED */
DEV_FONT
dvi_fontdict(fe, c)
struct font_entry *fe;
int c;
{
    return fe->base_fe;
}

dvichar(c)
unsigned int c;
{
    byte b[sizeof(int)];
    int n;

    if (chmove) {
	if (c <= SETC_127) {
	    putbyte(outfp, c);
	    dvipos++;
	} else {
	    n = uinttob(b, c);
	    putbyte(outfp, SET1+n-1);
	    putbytes(outfp, b, n);
	    dvipos += n+1;
	}
    } else {
	n = uinttob(b, c);
	putbyte(outfp, PUT1+n-1);
	putbytes(outfp, b, n);
	dvipos += n+1;
    }
}

dvi_setchar(fe, c)
struct font_entry *fe;
unsigned int c;
{
    begin_string();
    dvichar(c);
}

dvi_setstring(fe, s, len)
struct font_entry *fe;
byte *s;
int len;
{
    int i;

    begin_string();
    for (i = 0; i < len; i++, s++)
	putbyte(outfp, *s);
    dvipos += len;
}