private void Putheader()
{
outp.Write("StartFontMetrics 2.0\n");
if (copyright.Length > 0)
outp.Write("Comment " + copyright + '\n');
outp.Write("FontName ");
inp.Seek(fontname);
String fname = ReadString();
outp.Write(fname);
outp.Write("\nEncodingScheme ");
if (charset != 0)
outp.Write("FontSpecific\n");
else
outp.Write("AdobeStandardEncoding\n");
/*
* The .pfm is missing full name, so construct from font name by
* changing the hyphen to a space. This actually works inp a lot
* of cases.
*/
outp.Write("FullName " + fname.Replace('-', ' '));
if (face != 0) {
inp.Seek(face);
outp.Write("\nFamilyName " + ReadString());
}
outp.Write("\nWeight ");
if (weight > 475 || fname.ToLower(System.Globalization.CultureInfo.InvariantCulture).IndexOf("bold") >= 0)
outp.Write("Bold");
else if ((weight < 325 && weight != 0) || fname.ToLower(System.Globalization.CultureInfo.InvariantCulture).IndexOf("light") >= 0)
outp.Write("Light");
else if (fname.ToLower(System.Globalization.CultureInfo.InvariantCulture).IndexOf("black") >= 0)
outp.Write("Black");
else
outp.Write("Medium");
outp.Write("\nItalicAngle ");
if (italic != 0 || fname.ToLower(System.Globalization.CultureInfo.InvariantCulture).IndexOf("italic") >= 0)
outp.Write("-12.00");
/* this is a typical value; something else may work better for a
specific font */
else
outp.Write("0");
/*
* The mono flag inp the pfm actually indicates whether there is a
* table of font widths, not if they are all the same.
*/
outp.Write("\nIsFixedPitch ");
if ((kind & 1) == 0 || /* Flag for mono */
avgwidth == maxwidth ) { /* Avg width = max width */
outp.Write("true");
isMono = true;
}
else {
outp.Write("false");
isMono = false;
}
/*
* The font bounding box is lost, but try to reconstruct it.
* Much of this is just guess work. The bounding box is required inp
* the .afm, but is not used by the PM font installer.
*/
outp.Write("\nFontBBox");
if (isMono)
Outval(-20); /* Just guess at left bounds */
else
Outval(-100);
Outval(-(descender+5)); /* Descender is given as positive value */
Outval(maxwidth+10);
Outval(ascent+5);
/*
* Give other metrics that were kept
*/
outp.Write("\nCapHeight");
Outval(capheight);
outp.Write("\nXHeight");
Outval(xheight);
outp.Write("\nDescender");
Outval(-descender);
outp.Write("\nAscender");
Outval(ascender);
outp.Write('\n');
}