[texhax] How does VFlib process .GF and .PK bitmap file formats?

Ammar ul hassan ammar.instantsoft at gmail.com
Wed Jan 17 09:00:09 CET 2018


After reading some papers on this 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.

On Tue, Jan 16, 2018 at 11:46 AM, Ammar ul hassan <
ammar.instantsoft at gmail.com> wrote:

> Hi Karl Berry. Thank for your response
> > FreeType doesn't support bitmaps directly, does it?
>
> Yes FreeType doesn't support bitmaps directly. It takes an outline font
> and rasterizes it into bitmaps internally (without creating an additional
> bitmap file)
>
> > So the real question is why you want to use mf instead of mftrace?
>
> Actually with using mftrace in my current setup, the process looks complex
> i.e. input .mf to FreeType,
> send .mf to mftrace for converting it into any outline font (Type1 in my
> case), then passing this newly
> created outline to default FreeType driver modules, these driver modules
> then do default working and
> i can display styled fonts etc. Plus the main reason that i want to use mf
> program is that i want to use it
>  as an external program that inputs a bitmap file to FreeType, then
> FreeType sends this bitmap file to programs
>  like VFlib (that say that they can support bitmap files like .gf and .pk)
> so, that these processed files can be used for printing and previewing
> stuff.
>
> On Tue, Jan 16, 2018 at 7:43 AM, Karl Berry <karl at freefriends.org> wrote:
>
>> Hi Ammar,
>>
>>     What is the main task of this library if a .gf or .pk file is input?
>>
>> I have nothing to do with vflib, but I gather the purpose of vflib
>> (https://core.ac.uk/display/21783721) is to rasterize outline formats
>> into bitmaps. So if it's given a bitmap (gf or pk), it seems there's
>> nothing much for it to do, essentially just pass back the input.
>>
>> This is why mftrace is called in your present setup -- to go the other
>> direction, from Metafont's bitmap output to outlines, which (as far as I
>> know) is what freetype needs.  (freetype doesn't support bitmaps
>> directly, does it?)
>>
>> So the real question is why you want to use mf instead of mftrace.
>> Put that way, it seems an impedance mismatch ... -k
>>
>> P.S. The only alternative option I can think of in this area is to use
>> MetaPost (mpost) instead of mf. But it is far from a drop-in replacement
>> when it comes to font creation. MetaType1
>> (https://ctan.org/pkg/metatype1), written by the GUST font developers,
>> attempts to ameliorate this, but it is also far from a simple install
>> and use ... good luck ...
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20180117/93a3d456/attachment.html>


More information about the texhax mailing list