📄 t1info.c
字号:
if (minchar.characterWidth == maxchar.characterWidth) Vals->width = minchar.characterWidth * 10; pInfo->maxbounds = maxchar; pInfo->minbounds = minchar; pInfo->ink_maxbounds = maxchar; pInfo->ink_minbounds = minchar; pInfo->maxOverlap = maxlap + -(minchar.leftSideBearing); /* Set the pInfo flags */ /* Properties set by FontComputeInfoAccelerators: pInfo->noOverlap; pInfo->terminalFont; pInfo->constantMetrics; pInfo->constantWidth; pInfo->inkInside; */ FontComputeInfoAccelerators (pInfo);} static voidComputeProps(pInfo, Vals, Filename, sAscent, sDescent) FontInfoPtr pInfo; FontScalablePtr Vals; char *Filename; long *sAscent; long *sDescent;{ int infoint; int infoBBox[4]; int rc; QueryFontLib(Filename, "isFixedPitch", &infoint, &rc); if (!rc) { pInfo->constantWidth = infoint; } QueryFontLib((char *)0, "FontBBox", infoBBox, &rc); if (!rc) { pInfo->fontAscent = (int)((double)infoBBox[3] * Vals->pixel_matrix[3] + (infoBBox[3] > 0 ? 500 : -500)) / 1000; pInfo->fontDescent = -(int)((double)infoBBox[1] * Vals->pixel_matrix[3] + (infoBBox[1] > 0 ? 500 : -500)) / 1000; *sAscent = infoBBox[3]; *sDescent = -infoBBox[1]; }} static voidComputeStdProps(pInfo, Vals, Filename, Fontname, sAscent, sDescent, sWidth) FontInfoPtr pInfo; FontScalablePtr Vals; char *Filename; char *Fontname; long sAscent; long sDescent; long sWidth;{ FontPropPtr pp; int i, nprops; fontProp *fpt; char *is_str; char *ptr1, *ptr2; char *ptr3; char *infostrP; long rc; char scaledName[MAXFONTNAMELEN]; strcpy (scaledName, Fontname); /* Fill in our copy of the fontname from the Vals structure */ FontParseXLFDName (scaledName, Vals, FONT_XLFD_REPLACE_VALUE); /* This form of the properties is used by the X-client; the X-server doesn't care what they are. */ nprops = pInfo->nprops = NPROPS; pInfo->isStringProp = (char *) xalloc(sizeof(char) * nprops); pInfo->props = (FontPropPtr) xalloc(sizeof(FontPropRec) * nprops); if (!pInfo->isStringProp || !pInfo->props) { xfree(pInfo->isStringProp); pInfo->isStringProp = (char *) 0; xfree(pInfo->props); pInfo->props = (FontPropPtr) 0; return; } bzero(pInfo->isStringProp, (sizeof(char) * nprops)); ptr2 = scaledName; for (i = NNAMEPROPS, pp = pInfo->props, fpt = fontNamePropTable, is_str = pInfo->isStringProp; i; i--, pp++, fpt++, is_str++) { if (*ptr2) { ptr1 = ptr2 + 1; if (!(ptr2 = strchr(ptr1, '-'))) ptr2 = strchr(ptr1, '\0'); } pp->name = fpt->atom; switch (fpt->type) { case atom: /* Just copy info from scaledName */ *is_str = TRUE; pp->value = MakeAtom(ptr1, ptr2 - ptr1, TRUE); break; case truncate_atom: *is_str = TRUE; for (ptr3 = ptr1; *ptr3; ptr3++) if (*ptr3 == '[') break; pp->value = MakeAtom(ptr1, ptr3 - ptr1, TRUE); break; case pixel_size: pp->value = (int)(fabs(Vals->pixel_matrix[3]) + .5); break; case point_size: pp->value = (int)(fabs(Vals->point_matrix[3]) * 10.0 + .5); break; case resolution_x: pp->value = Vals->x; break; case resolution_y: pp->value = Vals->y; break; case average_width: pp->value = Vals->width; break; } } for (i = 0, fpt = extraProps; i < NEXTRAPROPS; i++, is_str++, pp++, fpt++) { pp->name = fpt->atom; switch (i) { case FONTPROP: *is_str = TRUE; pp->value = MakeAtom(scaledName, strlen(scaledName), TRUE); break; case COPYRIGHTPROP: *is_str = TRUE; QueryFontLib(Filename, "Notice", &infostrP, &rc); if (rc || !infostrP) { infostrP = "Copyright Notice not available"; } pp->value = MakeAtom(infostrP, strlen(infostrP), TRUE); break; case FACE_NAMEPROP: *is_str = TRUE; QueryFontLib(Filename, "FontName", &infostrP, &rc); if (rc || !infostrP) { infostrP = "(unknown)"; } pp->value = MakeAtom(infostrP, strlen(infostrP), TRUE); break; case RAWPIXELPROP: *is_str = FALSE; pp->value = 1000; break; case RAWPOINTPROP: *is_str = FALSE; pp->value = (long)(72270.0 / (double)Vals->y + .5); break; case RAWASCENTPROP: *is_str = FALSE; pp->value = sAscent; break; case RAWDESCENTPROP: *is_str = FALSE; pp->value = sDescent; break; case RAWWIDTHPROP: *is_str = FALSE; pp->value = sWidth; break; } }} /*ARGSUSED*/intType1GetInfoScalable(fpe, pInfo, entry, fontName, fileName, Vals) FontPathElementPtr fpe; FontInfoPtr pInfo; FontEntryPtr entry; FontNamePtr fontName; char *fileName; FontScalablePtr Vals;{ FontPtr pfont; int flags = 0; long format = 0; /* It doesn't matter what format for just info */ long fmask = 0; int ret; ret = Type1OpenScalable(fpe, &pfont, flags, entry, fileName, Vals, format, fmask); if (ret != Successful) return ret; *pInfo = pfont->info; /* XXX - Set pointers in pfont->info to NULL so they are not freed. */ pfont->info.props = NULL; pfont->info.isStringProp = NULL; Type1CloseFont(pfont); return Successful;} voidT1FillFontInfo(pFont, Vals, Filename, Fontname, sWidth) FontPtr pFont; FontScalablePtr Vals; char *Filename; char *Fontname; long sWidth;{ FontInfoPtr pInfo = &pFont->info; struct type1font *p = (struct type1font *)pFont->fontPrivate; long sAscent, sDescent; /* Scalable 1000-pixel values */ FillHeader(pInfo, Vals); ComputeBounds(pInfo, p->glyphs, Vals); ComputeProps(pInfo, Vals, Filename, &sAscent, &sDescent); ComputeStdProps(pInfo, Vals, Filename, Fontname, sAscent, sDescent, sWidth);} /* Called once, at renderer registration time */voidT1InitStdProps(){ int i; fontProp *t; i = sizeof(fontNamePropTable) / sizeof(fontProp); for (t = fontNamePropTable; i; i--, t++) t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE); i = sizeof(extraProps) / sizeof(fontProp); for (t = extraProps; i; i--, t++) t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -