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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
#include "defs.h"
#include "commands.h"
#include "global.h"
#include "set.h"
struct font_entry *hdfontent = NULL;
struct font_entry *curfontent;
extern int replfont(char *n, int s, char *rn, int *rd, int *rs);
/*-->ReadFontDef*/
/**********************************************************************/
/**************************** ReadFontDef ***************************/
/**********************************************************************/
void
readfontdef(k, c, s, d, a, l, n, hdfip)
int k, c, s, d, a, l;
char *n;
struct font_index **hdfip;
{
struct font_index *fi;
fi = NEW(struct font_index, "font_index");
fi->k = k;
fi->next = *hdfip;
*hdfip = fi;
#ifdef DEBUG
if (Debug)
(void)fprintf(stderr, "readfontdef %s k = %d s = %d d = %d",
n, k, s, d);
#endif
fi->fent = get_font_entry(c, s, d, a, l, n);
}
struct font_entry *
get_font_entry(c, s, d, a, l, n)
int c, s, d, a, l;
char *n;
{
struct font_entry *fe;
char rn[STRSIZE];
int rd, rs;
int first_markchar();
void read_null_fontinfo();
if (replfont(n, s, rn, &rd, &rs)) {
#ifdef DEBUG
if (Debug)
(void)fprintf(stderr, " -> %s s = %d d = %d", rn, rs, rd);
#endif
n = rn;
l = strlen(rn);
d = rd;
s = rs;
}
for (fe = hdfontent; fe != NULL; fe = fe->next)
if (strcmp(n, fe->n) == 0 && s == fe->s) {
#ifdef DEBUG
if (Debug)
(void)fprintf(stderr, " [already read]\n");
#endif
return fe;
}
#ifdef DEBUG
if (Debug)
(void)fprintf(stderr, "\n");
#endif
fe = NEW(struct font_entry, "font_entry");
fe->next = hdfontent;
hdfontent = fe;
fe->c = c;
fe->s = s;
fe->d = d;
fe->a = a;
fe->l = l;
(void)strcpy(fe->n, n);
fe->openfile = NO_FILE;
fe->ncdl = -1;
#ifdef STATS
fe->nbpxl = 0;
fe->ncts = 0;
#endif
fe->fnt_markchar = first_markchar;
fe->fnt_readfontinfo = read_null_fontinfo;
return fe;
}
/*
* We postpone the initialization of font info till the char in the font
* is first used. This is because if the font is declared in the virtual
* font, the font may be used only in some chars of vf and the chars may
* not be used in a particular dvi.
*/
int first_markchar(c)
int c;
{
init_fontinfo(curfontent);
FNT_markchar(c);
}
/*-->SetFntNum*/
/**********************************************************************/
/**************************** SetFntNum *****************************/
/**********************************************************************/
void
SetFntNum(k, hdfidx)
int k;
struct font_index *hdfidx;
/* this routine is used to specify the font to be used in printing future
characters */
{
struct font_index *ptr;
for (ptr = hdfidx; (ptr!=NULL) && (ptr->k!=k); )
ptr = ptr->next;
if (ptr == NULL)
Fatal("font %d undefined", k);
setcurfont(ptr->fent);
}
/*
* read_fontinfo
*/
void
read_fontinfo(fe)
struct font_entry *fe;
{
#ifdef DEBUG
if (Debug)
(void)fprintf(stderr, "<%s>\n", fe->n);
#endif
/* most fonts are real fonts */
fe->rvf_setchar = realf_setchar;
fe->rvf_setstring = realf_setstring;
(*(fe->fnt_readfontinfo))(fe);
}
/* operations for null font */
/* ARGSUSED */
int null_markchar(c)
int c;
{
}
void
read_null_fontinfo(fe)
struct font_entry *fe;
{
DEV_FONT null_fontdict();
int null_setchar(), null_setstring();
fe->dev_fontdict = null_fontdict;
fe->dev_setchar = null_setchar;
fe->dev_setstring = null_setstring;
}
/* ARGSUSED */
DEV_FONT
null_fontdict(fe, c)
struct font_entry *fe;
int c;
{
return DEV_NULLFONT;
}
/* ARGSUSED */
int null_setchar(c)
int c;
{
return 0;
}
/* ARGSUSED */
int null_setstring(s, len)
char *s;
int len;
{
return 0;
}
|