[tlbuild] Graphite support on cygwin

Ken Brown kbrow1i at gmail.com
Fri Oct 2 12:54:00 CEST 2009


On 10/1/2009 5:38 PM, Jonathan Kew wrote:
> 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.

The configuration test shows that sizeof(wchar_t) is 2.  So I tried a 
typecast:

--- FileFont.cpp.orig   2009-03-18 11:32:42.000000000 -0400
+++ FileFont.cpp        2009-10-01 19:36:08.267707200 -0400
@@ -208,7 +208,7 @@
                         }
  //             }
  #else
-               m_stuFaceName.assign(rgchwFace);
+               m_stuFaceName.assign((const wchar_t*)rgchwFace);
                 // VS 2005 needs this:
                 //for (int cch16 = 0; cch16 < cchw; cch16++)
                 //      m_stuFaceName.push_back(rgchwFace[cch16]);

With this cast, the build completes.  I did this before seeing Peter's 
patches, but I don't see any point in doing more right now.

Thanks.

Ken


More information about the tlbuild mailing list