Recently I made a small helping module in FreeType for my research work. This module is mainly responsible for processing a METAFONT input by client application. I used FTVIEW as my client application that takes a METAFONT file to display styled text on screen.

I am using the Mftrace program for converting any METAFONT request into its corresponding Type1 format and then, using the default Type1 driver module, I am processing it and displaying results on screen. It's working fine.

Now what I want is to use the mf program (the default compiler of METAFONT) instead of Mftrace, to process METAFONT using FreeType. The mf program takes a .mf file as input and returns a .tfm and .gf file. This .gf file is then converted using GFtoPK or GFtoDVI into .pk or .dvi files respectively and then can be used for displaying.

As FreeType engine doesn't support .gf and pk files respectively, I came to know that there is an old library called VFlib that actually supports these two types of files. I have read about VFlib and got to know that it is also a font library that handles many font types and can make glyphs as bitmaps from these different font formats like .ttf, .pfb, .gf, .pk etc.

As .gf and .pk files are actually bitmap font formats (the later is the more compressed file of .gf file which can be obtained by using programs like GFToPK), my question is: how does this VFlib library actually support .gf and .pk formats? What is the main task of this library if a .gf or .pk file is input?

  • 2
    Maybe adding a pointer to this library could help.
    – egreg
    Jan 14, 2018 at 9:15
  • @egreg definitely it will help Jan 15, 2018 at 2:25
  • @AmmarUlHassan Since you appear to know about the library, it's your task to add information on it.
    – egreg
    Jan 17, 2018 at 8:00
  • @egreg i just got my answer. I dont know everything about it. Jan 17, 2018 at 8:03
  • A pointer means: a web site or other place where to find it. If I google for vflib, I find references to a graph matching library that doesn't seem to be the one you're referring to, is it?
    – egreg
    Jan 17, 2018 at 8:04

1 Answer 1


After reading some papers on this VFlib library i got my answer.

Primary purpose of GF and PK font driver is that application programmer dont need to know the internal data representation in GF and PK font files. VFlib converts bitmaps in a common format. The term "common format" means VF_Bitmap structure defined in VFlib. That is the common data structure for representing bitmap data in VFlib. Regardless data style (bitmap/outline) of fonts, VFlib uses the VF_Bitmap structure to represent bitmap of a character in font.

Another purpose of gf and pk support is that. Because they are in bitmap form, we must prepare many files for different magnification and resolution. For example, when we use "cmr10" font, we must select appropreate font files generated by MetaFont. For example,

 - Mangification 1.00, 300 dpi --> "cmr10.300pk"
 - Mangification 1.20, 300 dpi --> "cmr10.360pk"
 - Mangification 1.00, 600 dpi --> "cmr10.600pk"
 - Mangification 1.20, 600 dpi --> "cmr10.720pk"

Selecting appropriate file name is tedious, and VFlib does the messy things. Given parameters fontname (e.g., "cmr10.pk"), device resolution (e.g., 300), and magnification (e.g., 1.20), VFlib PK driver internally computes appropriate file ame (e.g., "cmr10.360pk") and find its location in filesystem. Application programmer need not to care about actual font file names and font directories.

Refrence 1 Refrence 2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.