[HarfBuzz] Windows build with MSVC 2008

Sebastien Metrot meeloo at meeloo.net
Wed Aug 3 17:39:17 PDT 2011

Hi All,

I have added harfbuzz-ng to my GUI framework and it now works fine on OSX and iOS. While compiling the code on windows, I had to make some changes to get harfbuzz to build and run:
- USHORT, SHORT, ULONG and LONG are already defined by the Win32 SDK so I had to #define them in hb-opentype-private.hh:
#define LONG HB_LONG
- I also had to disable the extern "C" { } declarations, all code now being in .cc files and some functions returning class object, the compiler refuses them. So I changed line 32 of hb_common.h to: # if (defined __cplusplus) && (!defined WIN32)
- Last but not least, I noticed what looks like a bug to me: the declaration of the hb_prealloced_array_t template lacks a constructor, so all its data is rubbish if the compiler doesn't blank it or if the memory is not already zeroed, which is the case with visual C++.

With all these changes I have been able to build harfbuzz and two of my test programs. The bad news is that the first program runs but displays mismatched glyphs (and that's for Latin1 text with the Vera Sans mono font, so I guess it should be pretty simple). The second program seems stuck in a loop in the method hb_ot_map_builder_t::compile(...) with the font Andalus and some arabian text.

I welcome any help finding solutions :-).

Sébastien Métrot
libnui author

More information about the HarfBuzz mailing list