SharpFont icon indicating copy to clipboard operation
SharpFont copied to clipboard

Compile FreeType with Lcd enabled

Open helviett opened this issue 6 years ago • 7 comments

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

helviett avatar Jul 25 '19 06:07 helviett

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.

HinTak avatar Jul 25 '19 08:07 HinTak

Will SharpFont update to 2.10?

On Thu, 25 Jul 2019 at 18:26, HinTak [email protected] wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Robmaister/SharpFont/issues/131?email_source=notifications&email_token=AEIGDFMNFSZOESZNFCL6SITQBFPUHA5CNFSM4IGXGMJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2YYBWY#issuecomment-514949339, or mute the thread https://github.com/notifications/unsubscribe-auth/AEIGDFJNM36LTGQ7PRUU6H3QBFPUHANCNFSM4IGXGMJA .

helviett avatar Jul 25 '19 08:07 helviett

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 avatar Jul 25 '19 14:07 HinTak

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 avatar Jul 25 '19 14:07 HinTak

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.

HinTak avatar Jul 25 '19 14:07 HinTak

@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

Robmaister avatar Jul 25 '19 15:07 Robmaister

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.

HinTak avatar Jul 25 '19 15:07 HinTak