Fix bug 0000151: File loading not properly handled.
Link to bug: https://obsproject.com/mantis/view.php?id=151
A newly selected font is not loaded properly if "read from file" is
active without a valid file. Old error handling lead to random memory
being displayed.
Closes Pull Request #390
(message edited by Jim)
Typedef pointers are unsafe. If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data. I admit this was a fundamental mistake that must
be corrected.
All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.
This does not break ABI though, which is pretty nice.
This changes the font plugin from using a font file to using a specific
installed system font, which is searched for on each specific system and
associated with the font file. It now uses a font property instead of a
path property, and font size has been removed because the font property
now handles that.
When the module is first loaded, it will build up a list of system fonts
in order to be usable by Freetype. It was quite painful to program this
because font files can contain multiple localized versions of their face
names, and then there was the issue where windows likes to mangle
custom style types to the font name. Regardless, it all seems to have
worked out pretty well.
Minor issues:
- Truetype/Opentype fonts sometimes do not automatically have
italic and/or bold styles available, it seems that the system applies
transformations manually in those cases. We don't do this yet,
however, so right now a user might select a font with italic/bold
only to discover that italic/bold doesn't always work. Not entirely
sure what to do about this yet. There's probably a freetype function
to do something like that somehow,
This also requires that iconv be used for non-windows systems to be able
to look up localized font names within font files. Windows will use
the win32 API and code page IDs to translate font names.