diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/beebe/src/reldfont.h |
Initial commit
Diffstat (limited to 'dviware/beebe/src/reldfont.h')
-rw-r--r-- | dviware/beebe/src/reldfont.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/dviware/beebe/src/reldfont.h b/dviware/beebe/src/reldfont.h new file mode 100644 index 0000000000..7fdcad8580 --- /dev/null +++ b/dviware/beebe/src/reldfont.h @@ -0,0 +1,97 @@ +/* -*-C-*- reldfont.h */ +/*-->reldfont*/ +/**********************************************************************/ +/****************************** reldfont ******************************/ +/**********************************************************************/ + +void +reldfont(tfontptr) /* load (or reload) font parameters */ +struct font_entry *tfontptr; +{ + register UNSIGN16 the_char; /* loop index */ + int err_code; + register struct char_entry *tcharptr;/* temporary char_entry pointer */ + + tfontptr->font_mag = (UNSIGN32)((actfact( + MAGSIZE((float)tfontptr->s/(float)tfontptr->d)) * + ((float)runmag/(float)STDMAG) * + +#if USEGLOBALMAG + actfact(mag) * +#endif + + (float)RESOLUTION * 5.0) + 0.5); + + tfontptr->designsize = (UNSIGN32)0L; + tfontptr->hppp = (UNSIGN32)0L; + tfontptr->vppp = (UNSIGN32)0L; + tfontptr->min_m = (INT32)0L; + tfontptr->max_m = (INT32)0L; + tfontptr->min_n = (INT32)0L; + tfontptr->max_n = (INT32)0L; + + for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++) + { + tcharptr = &(tfontptr->ch[the_char]); + tcharptr->dx = (INT32)0L; + tcharptr->dy = (INT32)0L; + tcharptr->hp = (COORDINATE)0; + tcharptr->fontrp = -1L; + tcharptr->pxlw = (UNSIGN16)0; + tcharptr->rasters = (UNSIGN32*)NULL; + tcharptr->refcount = 0; + tcharptr->tfmw = 0L; + tcharptr->wp = (COORDINATE)0; + tcharptr->xoffp = (COORDINATE)0; + tcharptr->yoffp = (COORDINATE)0; + } + + if (tfontptr != pfontptr) + (void)openfont(tfontptr->n); + + if (fontfp == (FILE *)NULL) /* have empty font with zero metrics */ + return; + + for (;;) /* fake one-trip loop */ + { /* test for font types PK, GF, and PXL in order of preference */ + (void)REWIND(fontfp); /* position to beginning-of-file */ + if ( ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)PKPRE) && + ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)PKID) ) + { + tfontptr->font_type = (BYTE)FT_PK; + tfontptr->charxx = (void(*)())charpk; + err_code = readpk(); + break; + } + + (void)REWIND(fontfp); /* position to beginning-of-file */ + if ( ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)GFPRE) && + ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)GFID) ) + { + tfontptr->font_type = (BYTE)FT_GF; + tfontptr->charxx = (void(*)())chargf; + err_code = readgf(); + break; + } + + (void)REWIND(fontfp); /* position to beginning-of-file */ + if (nosignex(fontfp,(BYTE)4) == (UNSIGN32)PXLID) + { + tfontptr->font_type = (BYTE)FT_PXL; + tfontptr->charxx = (void(*)())charpxl; + err_code = readpxl(); + break; + } + + err_code = (int)EOF; + break; + } /* end one-trip loop */ + + if (err_code) + { + (void)sprintf(message, + "reldfont(): Font file [%s] is not a valid GF, PK, or PXL file", + tfontptr->name); + (void)fatal(message); + } +} |