[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] [Doubt] About reading a font file to check for its driver
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] [Doubt] About reading a font file to check for its driver. |
Date: |
Mon, 07 May 2018 22:58:47 +0200 (CEST) |
> while going through the code I found out that in file
> `src/base/ftobjs.c` in the function `ft_open_face_internal`, if the
> driver is not specified in the `FT_Open_Args' instance variable then
> it tries to open_face from all the installed available drivers for
> appropriate formats. Isn't this an extra overhead? Can't we to
> determine the driver from its filename extension?
No, we can't. First of all, it sometimes happens that fonts are
incorrectly called `*.ttf', but in reality they are `*.pfb' (I've seen
this in the wild). Second, some Adobe fonts don't have an extension
at all.
On the other hand, the file extension is a strong indicator which font
driver to use, so maybe the used algorithm can be streamlined by
taking the extension into account to compute a first guess.
I'm not sure whether this really speeds up FreeType...
Werner