FreeType 2.4.10 Amalgamation! NEW RELEASE

Using my Amalgamate tool, I have produced an amalgamation of FreeType for your pleasure:

https://github.com/vinniefalco/FreeTypeAmalgam

Github is now the official location for the FreeType amalgamation (and my other projects).

Wow. 157,000 lines of code, just to load a font!

It is a lot of code, but I do end up with nice looking fonts using FreeType’s LCD optimised rendering (am not bothered with the hinting though).

Would be very happy if Juce did it for me :wink:

[quote=“TheVinn”]Alpha release of my modified Juce amalgamation tool, plus a preliminary version of FreeType, packaged as a pair of amalgamated files!

Just TWO source files, FreeTypeAmalgam.h and FreeTypeAmalgam.c and you don’t have to worry about any messy projects or linking options. Instant support for FreeType in your plugin.

http://code.google.com/p/amalgamate/source/browse/#svn%2Ftrunk%2FFreeType[/quote]

Vinnie - it works fine for me once I dive into FreeTypeAmalgam.c and adjust a few options to match what I already had (see below).

[code]// Un-comment the following
#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING

// Comment out the following
#define FT_CONFIG_OPTION_USE_LZW
#define FT_CONFIG_OPTION_USE_ZLIB[/code]

BTW, my binary increases by 106kB with this approach. So either there’s something else I clipped out of it, or there have been other changes to FreeType (I was using 2.4.7 previously).

-Andrew

LOL…plus the hinting bytecode interpreter and the auto-hinting module

[quote=“Andrew J”]Vinnie - it works fine for me once I dive into FreeTypeAmalgam.c and adjust a few options to match what I already had (see below)…
BTW, my binary increases by 106kB with this approach. So either there’s something else I clipped out of it, or there have been other changes to FreeType (I was using 2.4.7 previously).[/quote]

I need to consolidate the compile time switches into a separate file… say, FreeTypeConfig.h (much like AppConfig.h for Juce), and test the combinations. No one should be editing the amalgamation header or sources directly (since they might get updated).

As for the increase in size its probably a good thing. When the compiler is given one large file instead of several smaller ones it creates opportunities for optimizations that could not happen otherwise (for example more function inlining). So probably that 106kB consists of additional inlining in conjunction with the new features of FreeType 2.4.8

I agree, that sounds a good approach.

Actually, it might have been because I disabled modules I wasn’t interested in:

FT_USE_MODULE( FT_Module_Class, autofit_module_class ) FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) //FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) //FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) //FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) //FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) //FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) //FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) //FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) //FT_USE_MODULE( FT_Module_Class, psaux_module_class ) //FT_USE_MODULE( FT_Module_Class, psnames_module_class ) //FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) //FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) //FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
This is another thing which needs to be optionally configurable. I tried snipping out these in the amalgamated version and found I had to do it in 2 places (which was confusing). However, the binary increased by another 300KB - go figure!

The FreeType amalgamation has moved to github. The original post has been updated.

I’m on github now so if you could please review this amalgamation, it’s been updated to FreeType 2.4.9.

I would like to address the issues that you brought up. The Amalgamate tool is available in a separate repo in my github, as is a fork of the FreeType sources. Since modifying the amalgamator output is not really the way to go, I would like to work with you to figure out how we can add support for turning things on and off by making the appropriate changes to the FreeType source tree (https://github.com/vinniefalco/FreeType).

You can re-amalgamate yourself by picking up the FreeTypeAmalgam repo (GitHub - vinniefalco/FreeTypeAmalgam: The FreeType Project: a free, high-quality and portable font engine.) and running the script in the Source directory. It will re-create the amalgamation with any changes you made to FreeType (which has to be checked out first and placed as a sibling to the FreeTypeAmalgam folder).

Let me know how this works out for you.

Hi Vinnie - sorry for the delayed response, have been away overseas and otherwise occupied. I’ll have a go at this when I can find some time and will let you know how it works out.

Thanks,
Andrew

Hi Vinnie,

I’ve been able to use your new amalgamated version and also re-amalgamate it myself.

[list][]Using your amalgamation, the release build exe is only 124.5KB larger than using my unamalgamated FT2.4.9 with edited options/modules.[/]
[]Using my amalgamation, the exe is exactly the same size.[/]
[]In both cases, the rendering appears to be identical.[/][/list]

Setting & unsetting #defines in FreeTypeConfig.h seems to make no difference. How is this referenced? Or is it just not implemented yet?

Regards,
Andrew

PS Just being able to amalgamate my own FreeType configuration is great, makes it very easy to set up my projects - so props

Great!!

Not implemented. I’ve been looking over the FT_USE_MODULE macros and quite frankly, I’m stymied. I don’t understand it at all. So I will have to post to the mailing list.

Not implemented. I’ve been looking over the FT_USE_MODULE macros and quite frankly, I’m stymied. I don’t understand it at all. So I will have to post to the mailing list.[/quote]

The options are the critical things, as they let us switch functionality on/off. If the amalgamation can’t cater for disabling FT_USE_MODULE definitions, then the only negative impact is increased size of the executable - and seeing as the penalty is only 125KB in my case, then I’m not too concerned about it.

Just a question, seems i got a problem with your amalgamation
i’m unable to find any definition of FT_Glyph in FreeTypeAmalgam.h , it seems the header containing it is missing
by the way i use you most recent version

was it intended or a bug ?

[quote=“Chaotikmind”]Just a question, seems i got a problem with your amalgamation
i’m unable to find any definition of FT_Glyph in FreeTypeAmalgam.h , it seems the header containing it is missing
by the way i use you most recent version

was it intended or a bug ?[/quote]

It compiles for me. What are you building it on?

vs2010 32 bit build

do a search for FT_Glyph in FreeTypeAmalgam.h , i’ts obviously missing

Btw i use a custom rasterizer, that’s why i need access to it

Edit :
FT_OutlineGlyphRec, FT_Done_Glyph are just missing too, part of the same header i think

Look at line 477 in FreeTypeAmalgam.h:

And then do a search in FreeTypeAmalgam.c and you’ll find where ftglyph.h is included.

Does FreeTypeAmalgam.c compile for you?

I think I see the problem. FT_Glyph.h is not included by any freetype headers, since its an internal object. I didn’t know about it, so I never added it to FreeTypeAmalgamTemplate.h.

I just updated the amalgamation to include this header, let me know if it works.

Also, you could have rebuilt the amalgamation yourself, the Amalgamate tool, FreeType, and scripts/template to create the amalgamation are all up on my Github.

I can add more files to the header if you need them.

yes i could obviously amalgamate it myself, but you know… laziness :wink:
i’m headed for bed right now, i’ll let you know tomorrow
thanks for your time.

[quote=“Chaotikmind”]yes i could obviously amalgamate it myself, but you know… laziness :wink:
i’m headed for bed right now, i’ll let you know tomorrow
thanks for your time.[/quote]

Haha I understand. Well, I made sure FT_Glyph was in the header (it was). I don’t mind re-amalgamating it but if I’m asleep or something and you are impatient like me then, its all there.