How we can Make an Adobe Font Metrics (AFM) file from a font
hamza-ain-uddin-khan opened this issue · 1 comments
I have recently checked php-font-lib but not sure how we can create Adobe Font Metrics (AFM) file from a font.
Please share example or anything else for better understanding.
You can generate font metrics as follows:
$font = FontLib\Font::load($test_file);
$font->parse();
$font->saveAdobeFontMetrics(basename($test_file) . '.ufm');
The default format produced by php-font-lib is "UFM" (Unicode Font Metrics). This format is based on the AFM format but supports the full Unicode character set. The primary difference is that the UFM format references characters using the "U" key (instead of "C") followed by the decimal Unicode index, and also adds a glyph index (G) which indicates where to find the character in the font's glyph table.
If you need the AFM format you have to specify the appropriate encoding, where the encoding matches one of the map files.
$font->saveAdobeFontMetrics(basename($test_file) . '.afm', 'iso-8859-1');
Note that the AFM produced by php-font-lib only writes the code, width, and name for each character.