[tlbuild] Graphite support on cygwin

Jonathan Kew jfkthame at googlemail.com
Thu Oct 1 23:38:42 CEST 2009

On 1 Oct 2009, at 21:40, Ken Brown wrote:

> Hi Peter,
> This is a very low-priority item, but something I'd like to fix  
> eventually.
> Some time ago I mentioned that I had to build xetex without graphite  
> support on cygwin because cygwin's gcc didn't (yet) support  
> std::wstring.  The latest version of gcc now has that support, so I  
> tried again.  The build fails as follows:
> ../../../libs/graphite/src/font/FileFont.cpp: In member function  
> 'void gr::FileFont::initializeFromFace()':
> ../../../libs/graphite/src/font/FileFont.cpp:211: error: invalid  
> conversion from 'gr::utf16*' to 'const wchar_t*'
> ../../../libs/graphite/src/font/FileFont.cpp:211: error:    
> initializing argument 1 of 'std::basic_string<_CharT, _Traits,  
> _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::assign(const  
> _CharT*) [with _CharT = wchar_t, _Traits =  
> std::char_traits<wchar_t>, _Alloc = std::allocator<wchar_t>]'
> If and when you think it's worth trying to track this down, let me  
> know if you need further information.  I'm not going to try to fix  
> it before the release of TL2009 unless Karl asks us to rebuild again  
> for some other reason.

Looks like the Graphite code assumes here that pointers to gr::utf16  
(presumably a 16-bit unsigned int) and to wchar_t are interchangeable,  
but this is not necessarily true.

First question is whether your wchar_t is in fact a 16-bit type; if  
not, there's a configure error, and it shouldn't be trying to compile  
this code at all (note the #if ... #else ... #endif). But assuming  
sizeof(wchar_t) is indeed 2 bytes, there might be a compiler option to  
make it less strict about the type compatibility, or else you could  
add a typecast (but don't do this if the sizes don't actually match!).  
But this is really a Graphite issue that should be fixed upstream.

Copying this to the graphite development mailing list.... please look  
into this and decide on the correct fix to make the code safely  
portable. (My personal preference would be to drop the use of wchar_t,  
wstring, etc in the codebase altogether, as converting between wchar_t  
and integer types like gr::utf16 is inherently problematic, and you're  
likely to stray beyond the language specification and into  
implementation-defined territory.)


More information about the tlbuild mailing list