File: rfset.c

package info (click to toggle)
dvi2dvi 2.0alpha-12
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 928 kB
  • sloc: ansic: 6,645; makefile: 96; sh: 8
file content (75 lines) | stat: -rw-r--r-- 1,442 bytes parent folder | download | duplicates (2)
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
/*
 * setchar for real font (non-virtual font)
 */

#include	"defs.h"
#include	"commands.h"
#include	"dconv.h"
#include	"global.h"
#include	"set.h"
#include	"dvi.h"

void
realf_setchar(fe, c, Move)
struct font_entry *fe;
int c;
BOOLEAN Move;
{
    int cw;
    DEV_FONT devf;

    devf = fe->dev_fontdict(fe, c);

    if (devf != DEV_NULLFONT) {	/* ignore missing fonts */
	chmove = Move;
	dev_setfont(devf);
	dev_setposn(h, v);
	cw = fe->dev_setchar(fe, c);
	if (Move)
	    *move += cw;
    } else
	dev_setposn(h, v);

#ifdef STATS
    Stnc += 1;
    fe->ncts += 1;
#endif
}

#define	STRLEN		256
void
realf_setstring(fe, firstch)	/* read and set a consecutive string of chars */
struct font_entry *fe;
int firstch;
{
    char s[STRLEN];
    char *sp;
    int c, len;
    DEV_FONT devf;

    /* read entire string of chars */
    /* ensure that all characters are loaded, */
    devf = fe->dev_fontdict(fe, firstch);
    for (c = firstch, sp = s, len = 0;
	 c >= SETC_000 && c <= SETC_127 && len < STRLEN; len++) {
	if (devf != fe->dev_fontdict(fe, c))
	    break;
	*sp++ = c;
	c = DC_getcommand();
    }
    DC_backupone();

    /* NULL's are valid chars, so cant use for string termination */
    if (devf != DEV_NULLFONT) {	/* ignore missing fonts */
	chmove = TRUE;
	dev_setfont(devf);
	dev_setposn(h, v);
	*move += fe->dev_setstring(fe, s, len);
    } else
	dev_setposn(h, v);

#ifdef STATS
    Stnc += len;
    fe->ncts += len;
#endif
}