tx -afm
% tx -afm -h [-afm options: default none] AFM mode write an Adobe Font Metrics format representation of an abstract font. This is a lightweight implementation that is primarily intended for testing and debugging usage; it departs from the AFM specification in a number of ways: o the metrics data is expressed in the font's character space units which may not be 1000 units/em as required by the specification. The character space units are recorded in UnitPerEm comment in the font metrics section o the character count specified by the StartCharMetrics keyword may be too large if the font has been subset using the -g option For example, the command: tx -afm -a rdr_____.pfb will write an AFM representation of the font file "rdr_____.pfb" to the file "rdr_____.afm".
afdko/afm.h at 01a35dacc9e8d1735b7f752f3232d38c34e6f843 · adobe-type-tools/afdko · GitHub
afdko/absfont_afm.c at 01a35dacc9e8d1735b7f752f3232d38c34e6f843 · adobe-type-tools/afdko · GitHub
/* update top dict's font bounding box with aggregate values */ top->FontBBox[0] = (float)h->font_bbox.left; top->FontBBox[1] = (float)h->font_bbox.bottom; top->FontBBox[2] = (float)h->font_bbox.right; top->FontBBox[3] = (float)h->font_bbox.top;
void abfAFMEndFont(abfAFMCtx h, abfTopDict *top) { time_t seconds_since_epoch = time(NULL); struct tm local_time; char time_text[32]; int c; /* update top dict's font bounding box with aggregate values */ top->FontBBox[0] = (float)h->font_bbox.left; top->FontBBox[1] = (float)h->font_bbox.bottom; top->FontBBox[2] = (float)h->font_bbox.right; top->FontBBox[3] = (float)h->font_bbox.top; if (top->sup.flags & ABF_CID_FONT) fprintf(h->fp, "StartFontMetrics 4.1\n"); else fprintf(h->fp, "StartFontMetrics 2.0\n"); SAFE_LOCALTIME(&seconds_since_epoch, &local_time); fprintf(h->fp, "Comment Copyright %d Adobe Systems Incorporated. " "All Rights Reserved.\n", local_time.tm_year + 1900); SAFE_CTIME(&seconds_since_epoch, time_text); fprintf(h->fp, "Comment Creation Date: %s", time_text); if (top->UniqueID != ABF_UNSET_INT) fprintf(h->fp, "Comment UniqueID %ld\n", top->UniqueID); if (top->sup.UnitsPerEm != 1000) fprintf(h->fp, "Comment UnitsPerEm %ld\n", top->sup.UnitsPerEm); if (top->sup.flags & ABF_CID_FONT) { /* Write header for cid-keyed font */ fprintf(h->fp, "MetricsSets 2\n"); writeString(h, "FontName", &top->cid.CIDFontName); writeString(h, "Weight", &top->Weight); fprintf(h->fp, "FontBBox %g %g %g %g\n", top->FontBBox[0], top->FontBBox[1], top->FontBBox[2], top->FontBBox[3]); fprintf(h->fp, "Version %.3f\n", top->cid.CIDFontVersion); writeString(h, "Notice", &top->Notice); fprintf(h->fp, "CharacterSet %s-%s-%ld\n", top->cid.Registry.ptr, top->cid.Ordering.ptr, top->cid.Supplement); fprintf(h->fp, "Characters %ld\n", top->sup.nGlyphs); fprintf(h->fp, "IsBaseFont true\n"); fprintf(h->fp, "IsCIDFont true\n"); fprintf(h->fp, "StartDirection 2\n"); fprintf(h->fp, "UnderlinePosition %g\n", top->UnderlinePosition); fprintf(h->fp, "UnderlineThickness %g\n", top->UnderlineThickness); fprintf(h->fp, "ItalicAngle %g\n", top->ItalicAngle); fprintf(h->fp, "IsFixedPitch %s\n", top->isFixedPitch ? "true" : "false"); fprintf(h->fp, "EndDirection\n"); fprintf(h->fp, "StartCharMetrics %ld\n", top->sup.nGlyphs); } else { /* Write header for name-keyed font */ writeString(h, "FontName", &top->FDArray.array[0].FontName); writeString(h, "FullName", &top->FullName); writeString(h, "FamilyName", &top->FamilyName); writeString(h, "Weight", &top->Weight); fprintf(h->fp, "ItalicAngle %g\n", top->ItalicAngle); fprintf(h->fp, "IsFixedPitch %s\n", top->isFixedPitch ? "true" : "false"); fprintf(h->fp, "FontBBox %g %g %g %g\n", top->FontBBox[0], top->FontBBox[1], top->FontBBox[2], top->FontBBox[3]); fprintf(h->fp, "UnderlinePosition %g\n", top->UnderlinePosition); fprintf(h->fp, "UnderlineThickness %g\n", top->UnderlineThickness); writeString(h, "Version", &top->version); writeString(h, "Notice", &top->Notice); fprintf(h->fp, "StartCharMetrics %ld\n", top->sup.nGlyphs - 1L); }