font_t gdispOpenFont(const char *name) { const struct font **p; for(p = BuiltinFontTable; p < BuiltinFontTable+sizeof(BuiltinFontTable)/sizeof(BuiltinFontTable[0]); p++) { if (matchfont(name, p[0]->name)) return p[0]; } return 0; }
font_t gdispOpenFont(const char *name) { const struct mf_font_list_s *fp; if (!fontList) fontList = mf_get_font_list(); // Try the long names first for(fp = fontList; fp; fp = fp->next) { if (matchfont(name, fp->font->full_name)) return fp->font; } // Try the short names if no long names match for(fp = fontList; fp; fp = fp->next) { if (matchfont(name, fp->font->short_name)) return fp->font; } /* Return default builtin font.. better than nothing. */ return mf_get_font_list()->font; }
/* * String p should be start after the ":" in a font declaration of the form %*FONT: <tfm-name> <scaled-size> <design-size> <2-hex-digits>:<hex-string> * where the sizes are floating-point numbers in units of PostScript points * (TeX's "bp"). We update the data structures for the included font, * charge fontmem for the VM used, and add to delchar if necessary. * Note that the scaled size and the design size are multiplied by mag/1000. * This is needed for the design size to undo the similar factor in conv since * design sizes are not supposed to be affected by magnification. Applying * the magnification factor to the scaled size selects magnified fonts as is * appropriate in the normal case where the included PostScript is scaled by * mag/1000. The definition of `fshow' in finclude.lpro unscales by `DVImag' * to account for this. We cannot change the font scaled size to account for * options like `hscale=' because then the definition of `fshow' would have * to change. */ static void scan1fontcomment(char *p) { char *q, *name, *area; char *scname; /* location in buffer where we got scsize */ integer scsize, dssize; fontdesctype *fptr; real DVIperBP; DVIperBP = actualdpi/(72.0*conv) * (mag/1000.0); p = strtok(p, " "); if (p==NULL) return; area = nextstring; /* tentatively in the string pool */ name = getname(p); q = strtok((char *)0, " "); if (p==NULL || (scsize=(integer)(atof(q)*DVIperBP))==0) { fprintf(stderr, "%s\n",p); error("No scaled size for included font"); nextstring = area; /* remove from string pool */ return; } scname = q; q = strtok((char *)0, " "); if (p==NULL || (dssize=(integer)(atof(q)*DVIperBP))==0) { fprintf(stderr, "%s\n",p); error("No design size for included font"); nextstring = area; return; } q = strtok((char *)0, " "); fptr = matchfont(name, area, scsize, scname); if (!fptr) { fptr = ifontdef(name, area, scsize, dssize, newstring(scname)); (void) preselectfont(fptr); setfamily(fptr); } else { nextstring = area; /* remove from string pool */ (void) preselectfont(fptr); if (fptr->scalename==NULL) { fptr->scalename=newstring(scname); setfamily(fptr); } } includesfonts = 1; fptr->psflag |= THISPAGE; includechars(fptr, q); }
vfontdef P2C(integer, s, int, siz) { register integer i, j, fn ; register fontdesctype *fp ; register fontmaptype *cfnt ; char *nam, *area ; integer cksum, scsize, dssize ; fn = vfbyte() ; while (siz-- > 1) fn = (fn << 8) + vfbyte() ; cfnt = (fontmaptype *)mymalloc((integer)sizeof(fontmaptype)) ; cfnt->fontnum = fn ; cksum = vfquad() ; scsize = scalewidth(s, vfquad()) ; dssize = (integer)(alpha * (real)vfquad()) ; i = vfbyte() ; j = vfbyte() ; if (nextstring + i + j > maxstring) error("! out of string space") ; area = nextstring ; for (; i>0; i--) *nextstring++ = vfbyte() ; *nextstring++ = 0 ; nam = nextstring ; for (; j>0; j--) *nextstring++ = vfbyte() ; *nextstring++ = 0 ; fp = matchfont(nam, area, scsize, (char *)0) ; if (fp) { nextstring = nam ; fp->checksum = cksum ; } else { fp = newfontdesc(cksum, scsize, dssize, nam, area) ; fp->next = fonthead ; fonthead = fp ; } cfnt->desc = fp ; return (cfnt) ; }