Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile FreeType with Lcd enabled #131

Open
helviett opened this issue Jul 25, 2019 · 7 comments
Open

Compile FreeType with Lcd enabled #131

helviett opened this issue Jul 25, 2019 · 7 comments

Comments

@helviett
Copy link

helviett commented Jul 25, 2019

We'd like to update SharpFont in our game engine in order to get HarfBuzz bindings. But also we need lcd support which is not enabled in your compiled libraries.

http://doc.mawan.de/libfreetype6/reference/ft2-lcd_filtering.html

@HinTak
Copy link
Contributor

HinTak commented Jul 25, 2019

You are reading outdated and unauthoritative documentation - go to www.freetype.org to read up for 2.10.x, instead of the 5/6 year old 2.5.x . Subpixel rendering was enabled by default in 2.7.x, AFAIK.

@helviett
Copy link
Author

helviett commented Jul 25, 2019 via email

@HinTak
Copy link
Contributor

HinTak commented Jul 25, 2019

I don't think there is anything to be done on the SharpFont side? The provided freetype binaries were provided by @Robmaister as a convenience. If you build your own up-to-date freetype and drow it in, it would probably just work.

Just for interest, what part of Harfbuzz are you interested in?

@HinTak
Copy link
Contributor

HinTak commented Jul 25, 2019

BTW, https://github.com/HinTak/Font-Validator/tree/master/bin contains win32/win64 freetype 2.10.x statically linked with harfbuzz 2.2.x , built in a way compatible with SharpFont. It probably will do what you want. You need to grab the whole directory though.

@HinTak
Copy link
Contributor

HinTak commented Jul 25, 2019

Oh, mine has a slight quirk compared to upstream - you need to explicitly enable subpixel rendering mode with lib.PropertySet("truetype", "interpreter-version", 40) on the c# side. See Compat/Compat.cs to see how it is used.

I did it because the purpose of font-validator (or this part in particular) is to analyse the hinting instructions in B/W and gray mode, historically.

35 was the one and only default up to freetype 2.6.x. '38' was available in the so called "infinity patch", but is considered too slow for general use/merging upstream. '40' was introduced in late 2.6.x (2.6.3 or 2.6.4), and became the default in 2.7 on wards. But I choose to not take the default.

@Robmaister
Copy link
Owner

@HinTak is correct on all accounts, the binaries were shipped for convenience and making sure that you have a working build right off the bat with nuget install. You are more than welcome, even encouraged, to customize your build and drop in a custom freetype6.dll if you want to customize the build.

SharpFont requires a patch if you want to support Win64 due to the lack of a C# type with the same size as C/C++ long across platforms (honestly not sure if it's still needed as I haven't kept up with FreeType much the last few years). Instructions for that as well as general instructions for making Windows builds are here: https://github.com/Robmaister/SharpFont.Dependencies/tree/master/freetype2

@HinTak
Copy link
Contributor

HinTak commented Jul 25, 2019

The Win64 patch is still needed. What's more, if you need harfbuzz related functionality, you need to patch freetype before you build harfbuzz, as harfbuzz uses some of freetype's headers and there is a circular dependency with harfbuzz.

That's what I meant and hinted at earlier about "... built in a way compatible with SharpFont". I tried upstreaming the win64 patch but the freetype people are, understandably, not keen on taking on a patch that's basically working around a design flaw of C#, and also that will break usage with other win64 language bindings of freetype, such as freetype-py on win64 python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants