File: rfset.c

package info (click to toggle)
dvi2ps 3.0a1-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,392 kB
  • ctags: 1,750
  • sloc: ansic: 11,699; sh: 277; makefile: 235
file content (72 lines) | stat: -rw-r--r-- 1,410 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
/*
 * setchar for real font (non-virtual font)
 */

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

void
realf_setchar(c, Move)
int c;
BOOLEAN Move;
{
    register int cw;
    DEV_FONT devf;

    devf = DEV_fontdict(curfontent, c);

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

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

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

    /* read entire string of chars */
    /* ensure that all characters are loaded, */
    devf = DEV_fontdict(curfontent, firstch);
    for (c = firstch, sp = s, len = 0;
	 c >= SETC_000 && c <= SETC_127 && len < STRLEN; len++) {
	if (devf != DEV_fontdict(curfontent, 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 += DEV_setstring(s, len);
    } else
	dev_setposn(h, v);

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