vplaux.c

来自「字体缩放显示」· C语言 代码 · 共 572 行 · 第 1/2 页

C
572
字号
  voutln("(COMMENT DESIGNSIZE (1 em) IS IN POINTS)");  voutln("(COMMENT OTHER DIMENSIONS ARE MULTIPLES OF DESIGNSIZE/1000)");#if 0  /* Let vptovf compute the checksum. */  voutln2("(CHECKSUM O %lo)", cksum ^ 0xFFFFFFFF);#endif  if (fnt->boundarychar >= 0)    voutln2("(BOUNDARYCHAR O %lo)", (unsigned long)fnt->boundarychar);  vleft(&level);  voutln("FONTDIMEN");  Slant = fnt->slant - fnt->efactor * tan(fnt->italicangle * (PI / 180.0));  if (Slant)    voutln2("(SLANT R %f)", Slant);  voutln2("(SPACE D %d)", fnt->fontspace);  if (!fnt->fixedpitch)  {    voutln2("(STRETCH D %d)", transform(200, 0, fnt->efactor, fnt->slant));    voutln2("(SHRINK D %d)", transform(100, 0, fnt->efactor, fnt->slant));  }  voutln2("(XHEIGHT D %d)", fnt->xheight);  voutln2("(QUAD D %d)", transform(1000, 0, fnt->efactor, fnt->slant));  voutln2("(EXTRASPACE D %d)",          fnt->fixedpitch ? fnt->fontspace :                            transform(111, 0, fnt->efactor, fnt->slant));  vright(&level);  vleft(&level);  voutln("MAPFONT D 0");  voutln2("(FONTNAME %s)", fnt->fullname);#if 0  voutln2("(FONTCHECKSUM O %lo)", (unsigned long)cksum);#endif  vright(&level);  if (makevpl > 1)  {    vleft(&level);    voutln("MAPFONT D 1");    voutln2("(FONTNAME %s)", fnt->fullname);    voutln2("(FONTAT D %d)", (int)(1000.0 * fnt->capheight + 0.5));#if 0    voutln2("(FONTCHECKSUM O %lo)", (unsigned long)cksum);#endif    vright(&level);  }  for (i = 0; i <= 0xFF && fnt->outencptrs[i] == NULL; i++)    ;  bc = i;  for (i = 0xFF; i >= 0 && fnt->outencptrs[i] == NULL; i--)    ;  ec = i;  vleft(&level);  voutln("LIGTABLE");  ti = findadobe("||", fnt->charlist);  unlabeled = True;  for (nlig = ti->ligs; nlig; nlig = nlig->next)    if (NULL != (asucc = findmappedadobe(nlig->succ, fnt->inencptrs)))    {      if (NULL != (asub = findmappedadobe(nlig->sub, fnt->inencptrs)))        if (asucc->outcode >= 0)          if (asub->outcode >= 0)          {            if (unlabeled)            {               voutln("(LABEL BOUNDARYCHAR)");               unlabeled = False;            }            for (j = asucc->outcode; j >= 0; j = fnt->nextout[j])              voutln4("(%s %s O %o)", vplligops[nlig->op],                      vchar(j, vcharbuf, forceoctal),                      (unsigned)asub->outcode);          }    }  if (!unlabeled)    voutln("(STOP)");  for (i = bc; i <= ec; i++)    if ((ti = fnt->outencptrs[i]) && ti->outcode == i)    {      unlabeled = True;      if (fnt->uppercase[i] == NULL)                                /* omit ligatures from smallcap lowercase */        for (nlig = ti->ligs; nlig; nlig = nlig->next)          if ((((NULL != (asucc = findmappedadobe(nlig->succ, fnt->inencptrs)))                && (asucc->outcode >= 0))               || ((strcmp(nlig->succ, "||") == 0)                   && (fnt->boundarychar >= 0)))              && (NULL != (asub = findmappedadobe(nlig->sub, fnt->inencptrs)))              && (asub->outcode >= 0))          {            if (unlabeled)            {              for (j = ti->outcode; j >= 0; j = fnt->nextout[j])                voutln3("(LABEL %s)%s",                        vchar(j, vcharbuf, forceoctal),                        vname(j, vnamebuf,                              fnt->outencptrs, forceoctal));              unlabeled = False;            }            if (asucc != NULL)              for (j = asucc->outcode; j >= 0; j = fnt->nextout[j])              {                voutln4("(%s %s O %o)", vplligops[nlig->op],                        vchar(j, vcharbuf, forceoctal),                        (unsigned)asub->outcode);                if (nlig->boundleft)                  break;              }            else /* boundary char */            {              voutln4("(%s %s O %o)", vplligops[nlig->op],                      vchar(fnt->boundarychar, vcharbuf, forceoctal),                      (unsigned)asub->outcode);            }          }       for (nkern = (fnt->uppercase[i] ? fnt->uppercase[i]->kerns : ti->kerns);           nkern; nkern=nkern->next)        if (NULL != (asucc = findmappedadobe(nkern->succ, fnt->inencptrs)))          for (j = asucc->outcode; j >= 0; j = fnt->nextout[j])          {            if (fnt->uppercase[j] == NULL)            {              if (unlabeled)              {                for (k = ti->outcode; k >= 0; k = fnt->nextout[k])                  voutln3("(LABEL %s)%s",                          vchar(k, vcharbuf, forceoctal),                          vname(k, vnamebuf, fnt->outencptrs, forceoctal));                unlabeled = False;              }              /*               *   If other characters have the same kerns as this               *   one, output the label here.  This makes the TFM               *   file much smaller than if we output all the               *   kerns again under a different label.               */              for (kern_eq = ti->kern_equivs; kern_eq;                   kern_eq = kern_eq->next)              {                k = kern_eq->ch->outcode;                if (k >= 0 && k <= 0xFF)                  voutln3("(LABEL %s)%s",                          vchar(k, vcharbuf, forceoctal),                          vname(k, vnamebuf, fnt->outencptrs, forceoctal));              }              ti->kern_equivs = NULL;   /* Only output those labels once. */              if (fnt->uppercase[i])              {                if (fnt->lowercase[j])                {                  for (k = fnt->lowercase[j]->outcode; k >= 0;                       k = fnt->nextout[k])                    voutln4("(KRN %s R %.1f)%s",                            vchar(k, vcharbuf, forceoctal),                            fnt->capheight * nkern->delta,                            vname(k, vnamebuf, fnt->outencptrs, forceoctal));                }                else                  voutln4("(KRN %s R %.1f)%s",                          vchar(j, vcharbuf, forceoctal),                          fnt->capheight * nkern->delta,                          vname(j, vnamebuf, fnt->outencptrs, forceoctal));              }              else              {                voutln4("(KRN %s R %d)%s",                        vchar(j, vcharbuf, forceoctal),                        nkern->delta,                        vname(j, vnamebuf, fnt->outencptrs, forceoctal));                if (fnt->lowercase[j])                  for (k = fnt->lowercase[j]->outcode; k >= 0;                       k = fnt->nextout[k])                    voutln4("(KRN %s R %.1f)%s",                            vchar(k, vcharbuf, forceoctal),                            fnt->capheight * nkern->delta,                            vname(k, vnamebuf, fnt->outencptrs, forceoctal));              }            }          }          if (!unlabeled)            voutln("(STOP)");    }  vright(&level);  for (i = bc; i <= ec; i++)    if (NULL != (ti = fnt->outencptrs[i]))    {      vleft(&level);      fprintf(out, "CHARACTER %s%s\n   ",                   vchar(i, vcharbuf, forceoctal),                   vname(i, vnamebuf, fnt->outencptrs, forceoctal));      if (fnt->uppercase[i])      {        ti = fnt->uppercase[i];        voutln2("(CHARWD R %.1f)", fnt->capheight * (ti->width));        if (ti->ury)          voutln2("(CHARHT R %.1f)", fnt->capheight * ti->ury);        if (ti->lly)          voutln2("(CHARDP R %.1f)", -fnt->capheight * ti->lly);        if (ti->urx > ti->width)          voutln2("(CHARIC R %.1f)", fnt->capheight * (ti->urx - ti->width));      }      else      {        voutln2("(CHARWD R %d)", ti->width);        if (ti->ury)          voutln2("(CHARHT R %d)", ti->ury);        if (ti->lly)          voutln2("(CHARDP R %d)", -ti->lly);        if (ti->urx > ti->width)          voutln2("(CHARIC R %d)", ti->urx - ti->width);      }       if (ti->incode != i || fnt->uppercase[i] || ti->constructed)      {        vleft(&level);        voutln("MAP");        if (fnt->uppercase[i])          voutln("(SELECTFONT D 1)");        if (ti->pccs && (ti->incode < 0 || ti->constructed))        {          xoff = 0;          yoff = 0;          for (npcc = ti->pccs; npcc; npcc = npcc->next)            if (NULL != (api = findmappedadobe(npcc->partname,                                               fnt->inencptrs)))              if (api->outcode >= 0)              {                if (npcc->xoffset != xoff)                {                  if (fnt->uppercase[i])                  {                    voutln2("(MOVERIGHT R %.1f)",                            fnt->capheight * (npcc->xoffset - xoff));                  }                  else                    voutln2("(MOVERIGHT R %d)", npcc->xoffset - xoff);                  xoff = npcc->xoffset;                }                if (npcc->yoffset != yoff)                {                  if (fnt->uppercase[i])                  {                    voutln2("(MOVEUP R %.1f)",                            fnt->capheight * (npcc->yoffset - yoff));                  }                  else                    voutln2("(MOVEUP R %d)", npcc->yoffset - yoff);                  yoff = npcc->yoffset;                }                voutln2("(SETCHAR O %o)", (unsigned)api->incode);                xoff += fnt->outencptrs[api->outcode]->width;              }        }        else          voutln2("(SETCHAR O %o)", (unsigned)ti->incode);          vright(&level);      }      vright(&level);    }    if (level)      oops("I forgot to match the parentheses.");}/* end */

⌨️ 快捷键说明

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