From 983a0d8ce4f835c5714052171307ca29c402b015 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 18 Nov 2010 18:43:41 +0000 Subject: Fixed ARM Unicode cross compilation issue (STR #2432) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7873 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/xutf8/utf8Wrap.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xutf8/utf8Wrap.c b/src/xutf8/utf8Wrap.c index 4961ac0f4..bb3676d13 100644 --- a/src/xutf8/utf8Wrap.c +++ b/src/xutf8/utf8Wrap.c @@ -43,6 +43,21 @@ * extern const char *encoding_name(int num); */ +/* The ARM header files have a bug by not taking into account that ARM cpu + * likes pacing to 4 bytes. This little trick defines our own version of + * XChar2b which does not have this problem + */ + +typedef struct { + unsigned char byte1; + unsigned char byte2; +} +#if defined(__GNUC__) && defined(__arm__) && !defined(__ARM_EABI__) +__attribute__ ((packed)) +#endif +Fl_XChar2b; + + /*********************************************************************/ /** extract a list of font from the base font name list **/ /*********************************************************************/ @@ -328,8 +343,8 @@ XUtf8DrawRtlString(Display *display, int *encodings; /* encodings array */ XFontStruct **fonts; /* fonts array */ - XChar2b buf[128]; /* drawing buffer */ - XChar2b *ptr; /* pointer to the drawing buffer */ + Fl_XChar2b buf[128]; /* drawing buffer */ + Fl_XChar2b *ptr; /* pointer to the drawing buffer */ int fnum; /* index of the current font in the fonts array*/ int i; /* current byte in the XChar2b buffer */ int first; /* first valid font index */ @@ -449,7 +464,7 @@ XUtf8DrawString(Display *display, int *encodings; /* encodings array */ XFontStruct **fonts; /* fonts array */ - XChar2b buf[128]; /* drawing buffer */ + Fl_XChar2b buf[128]; /* drawing buffer */ int fnum; /* index of the current font in the fonts array*/ int i; /* current byte in the XChar2b buffer */ int first; /* first valid font index */ @@ -559,7 +574,7 @@ XUtf8TextWidth(XUtf8FontStruct *font_set, int x; int *encodings; /* encodings array */ XFontStruct **fonts; /* fonts array */ - XChar2b buf[128]; /* drawing buffer */ + Fl_XChar2b buf[128]; /* drawing buffer */ int fnum; /* index of the current font in the fonts array*/ int i; /* current byte in the XChar2b buffer */ int first; /* first valid font index */ @@ -739,7 +754,7 @@ XUtf8UcsWidth(XUtf8FontStruct *font_set, int x; int *encodings; /* encodings array */ XFontStruct **fonts; /* fonts array */ - XChar2b buf[8]; /* drawing buffer */ + Fl_XChar2b buf[8]; /* drawing buffer */ int fnum; /* index of the current font in the fonts array*/ int i; /* current byte in the XChar2b buffer */ int first; /* first valid font index */ -- cgit v1.2.3