[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: listing the supported file formats
From: |
Werner LEMBERG |
Subject: |
Re: listing the supported file formats |
Date: |
Sun, 21 Nov 2021 10:15:00 +0000 (UTC) |
> Hello, I've recently started doing more in-depth development with
> Freetype2 and I was wondering if there was a way to list, or build a
> list of, the file formats supported by freetype or any extended
> modules when supplying a filepath to `FT_New_Face()`.
>
> If freetype doesn't support a format, I would like to avoid calling
> `FT_New_Face()` entirely, rather than receiving an error for an
> unsupported format. :)
How do you know that font file X has format Y? If you are a Windows
user you might say 'look at the extension of X'! Such a thing doesn't
exist on GNU/Linux in general. For example, PostScript font resources
are often files without an extension at all.
Note that even on Windows the extension check is not reliable: As an
example, both TrueType and OpenType Collections normally get the same
extension (`.ttc`).
In other words, you *must* parse a font with FreeType to find out its
type. This is exactly what `FT_New_Face` does, as fast as possible,
if you specify -1 as the value for the function's `face_index`
parameter.
> If you could also improve the documentation to describe this
> process, it would be very helpful to avoid errors entirely. :)
What process shall be described?
Werner