Fixes#707
Our scoring algorithm previously did not take into account symbolic
traits, so when `bold = false and italic = false`, regular, bold, italic
would all be equally likely to appear first.
This modifies our scoring algorithm to prioritize matching symbolic
traits. Further, we have a special case for no symbolic traits to
prioritize "Regular" named styles. We can expand this to other styles
too but we do not do this here.
We also modified the algorithm to always prefer fonts with more glyphs
over fonts with less, hopeful that we can load fewer fonts for other
glyphs later.
Some targets were duplicated in the all-targets definition list that
will not build for a Windows target. They're all moved to the
non-Windows configuration. The target now builds against a mingw64
prefix with the appropriate dependencies installed.
Updates #437
Fixes#668
We were previously only checking the first font result in the search.
This also fixes our CoreText scoring algorithm to prioritize faces that
have the codepoint we're searching for.
Fixes the next issue on windows. The fontconfig library is calling
the function xmlCreatePushParserCtxt from libxml2, however, the function
declaration was being omitted because fontconfig was not defining
the LIBXML_PUSH_ENABLED preprocessor symbol. However, instead of a
compile error, C's support for implicit function declrations allows it
to happily call the function anyway, with the wrong ABI. The main issue
was the return type being implicitly declared as "int" instead of a
pointer. On my system this was causing the return pointer to be
truncated to 32 bits and then sign-extended which caused a segfault
once it was dereferenced.
I've gone ahead and added the -Werror=implicit-function-declaration
to fontconfig to avoid these issues in the future. However, this
flag didn't compile on linux so I've left it as Windows only for now.
I also needed to add the LIBXML_STATIC define because not defining it
causes some functions on windows to be declared with
`__declspec(dllimport)` which results in linker errors since we are
actually statically linking libxml2.
Makes progress getting "zig build test" to work on windows. Mostly
fixed issues around build configuration and added some branches throughout
the Zig code to return/throw errors for unimplemented parts.
I also added an initial implementation for getting the home dir.