⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vplaux.c

📁 字体缩放显示
💻 C
📖 第 1 页 / 共 2 页
字号:
/* *   vplaux.c * *   This file is part of the ttf2pk package. * *   Copyright 1997-1999, 2000 by *     Frederic Loyer <loyer@ensta.fr> *     Werner Lemberg <wl@gnu.org> */#include <stdio.h>#include <string.h>#include <ctype.h>#include <math.h>#include "ttf2tfm.h"#include "newobj.h"#include "ttfenc.h"#include "texenc.h"#include "tfmaux.h"#include "vplaux.h"#include "errormsg.h"#include "case.h"#undef PI#define PI 3.14159265358979323846264338327     #define vout(s) fprintf(out, s)#define voutln(str)         {fprintf(out, "%s\n", str); vlevout(level);}#define voutln2(f, s)       {fprintf(out, f, s); vlevnlout(level);}#define voutln3(f, a, b)    {fprintf(out, f, a, b); vlevnlout(level);}#define voutln4(f, a, b, c) {fprintf(out, f, a, b, c); vlevnlout(level);}static char vcharbuf[6];static char vnamebuf[100];/* the depth of parenthesis nesting in VPL file being written */static int level;static FILE *out;static voidvlevout(register int l){  while (l--)    vout("   ");}static voidvlevnlout(int level){  vout("\n");  vlevout(level);}static voidvleft(int *levelp){  (*levelp)++;  vout("(");}static voidvright(int *levelp){  (*levelp)--;  voutln(")");}static char *vchar(int c,      char *buf,      Boolean forceoctal){  if (forceoctal == 0 && isalnum(c))    (void)sprintf(buf, "C %c", c);  else    (void)sprintf(buf, "O %o", (unsigned)c);  return buf;}static char *vname(int c,      char *buf,      ttfinfo **array,      Boolean forceoctal){  if (!forceoctal && isalnum(c))    buf[0] = '\0';  else    sprintf(buf, " (comment %s)", array[c]->adobename);  return buf;}/* *   Compute uppercase mapping, when making a small caps font. */voidupmap(Font *fnt){  register ttfinfo *ti, *Ti;  register char *p, *q;  register pcc *np, *nq;  int i, j;  char lwr[50];  for (Ti = fnt->charlist; Ti; Ti = Ti->next)  {    p = Ti->adobename;    if (isupper(*p))    {      q = lwr;      for (; *p; p++)        *q++ = tolower(*p);      *q = '\0';      if (NULL != (ti = findmappedadobe(lwr, fnt->inencptrs)))      {        for (i = ti->outcode; i >= 0; i = fnt->nextout[i])          fnt->uppercase[i] = Ti;        for (i = Ti->outcode; i >= 0; i = fnt->nextout[i])          fnt->lowercase[i] = ti;      }    }  }  /*   *   Note that, contrary to the normal true/false conventions,   *   uppercase[i] is NULL and lowercase[i] is non-NULL when `i' is the   *   ASCII code of an uppercase letter; and vice versa for lowercase    *   letters.   */  if (NULL != (ti = findmappedadobe("germandbls", fnt->inencptrs)))    if (NULL != (Ti = findmappedadobe("S", fnt->inencptrs)))                                                /* we also construct SS */    {      for (i = ti->outcode; i >= 0; i = fnt->nextout[i])        fnt->uppercase[i] = ti;      ti->incode = -1;      ti->width = Ti->width << 1;      ti->llx = Ti->llx;      ti->lly = Ti->lly;      ti->urx = Ti->width + Ti->urx;      ti->ury = Ti->ury;      ti->kerns = Ti->kerns;      np = newpcc();      np->partname = "S";      nq = newpcc();      nq->partname = "S";      nq->xoffset = Ti->width;      np->next = nq;      ti->pccs = np;      ti->constructed = True;    }  for (i = 0; casetable[i].upper; i++)  {    if ((ti = findmappedadobe(casetable[i].lower, fnt->inencptrs)))      for (j = ti->outcode; j >= 0; j = fnt->nextout[j])        fnt->uppercase[j] = findmappedadobe(casetable[i].upper,                                            fnt->inencptrs);  }}/* *   The logic above seems to work well enough, but it leaves useless *   characters like `fi' and `fl' in the font if they were present *   initially, and it omits characters like `dotlessj' if they are *   absent initially. */voidwritevpl(Font *fnt, char makevpl, Boolean forceoctal){  register int i, j, k;  register ttfinfo *ti;  register lig *nlig;  register kern *nkern;  register pcc *npcc;  ttfinfo *asucc, *asub, *api;  ttfptr *kern_eq;  int xoff, yoff;  int bc, ec;  char buf[200];  char header[256];  Boolean unlabeled;  float Slant;  out = fnt->vplout;  header[0] = '\0';  strncat(header, "Created by `", 12);  strncat(header, fnt->titlebuf, 255 - 12 - 1);  strncat(header, "'", 1);  voutln2("(VTITLE %s)", header);  voutln("(COMMENT Please change VTITLE if you edit this file)");  (void)sprintf(buf, "TeX-%s%s%s%s",                fnt->fullname,                (fnt->efactor == 1.0 ? "" : "-E"),                (fnt->slant == 0.0 ? "" : "-S"),                (makevpl == 1 ? "" : "-CSC"));  if (strlen(buf) > 19) /* too long, will retain first 9 and last 10 chars */  {    register char *p, *q;    for (p = &buf[9], q = &buf[strlen(buf)-10]; p < &buf[19];         p++, q++)      *p = *q;    buf[19] = '\0';  }  voutln2("(FAMILY %s)", buf);  {    char tbuf[300];    char *base_encoding = fnt->codingscheme;          if (strcmp(fnt->outencoding->name, base_encoding) == 0)      sprintf(tbuf, "%s", fnt->outencoding->name);    else      sprintf(tbuf, "%s + %s", base_encoding, fnt->outencoding->name);          if (strlen(tbuf) > 39)    {      warning("Coding scheme too long; shortening to 39 characters");      tbuf[39] = '\0';    }    voutln2("(CODINGSCHEME %s)", tbuf);  }  {    long t, sc;    char *s;    int n, pos;    s = header;    n = strlen(s);    t = ((long)n) << 24;    sc = 16;    pos = 18;    voutln(      "(COMMENT The following `HEADER' lines are equivalent to the string)");    voutln2("(COMMENT   \"%s\")", header);    while (n > 0)    {      t |= ((long)(*(unsigned char *)s++)) << sc;      sc -= 8;      if (sc < 0)      {        voutln3("(HEADER D %d O %lo)", pos, t);        t = 0;        sc = 24;        pos++;      }      n--;    }    if (t)      voutln3("(HEADER D %d O %lo)", pos, t);  }  voutln("(DESIGNSIZE R 10.0)");  voutln("(DESIGNUNITS R 1000)");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -