Skip to content

Commit

Permalink
backport bidi text_out to winxp
Browse files Browse the repository at this point in the history
  • Loading branch information
dk committed Nov 3, 2015
1 parent 60fed55 commit 11e0575
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/win32/win32guts.h
Expand Up @@ -214,6 +214,7 @@ typedef struct _WinGuts
HANDLE socketThread; // thread id
Bool socketPostSync; // semaphore
Bool dont_xlate_message; // one-time stopper to TranslateMessage() call
WCHAR * (*alloc_utf8_to_wchar_visual)(const char*,int,int*);
} WinGuts, *PWinGuts;

typedef struct _WindowData
Expand Down
6 changes: 6 additions & 0 deletions win32/global.c
Expand Up @@ -92,8 +92,14 @@ window_subsystem_init( char * error_buf)
WNDCLASSW wc;
HDC dc;
HBITMAP hbm;
OSVERSIONINFO os = { sizeof( OSVERSIONINFO)};

guts. version = GetVersion();
GetVersionEx( &os);
guts. alloc_utf8_to_wchar_visual =
(( os.dwMajorVersion > 5) || (os.dwMajorVersion == 5 && os.dwMinorVersion > 1)) ?
alloc_utf8_to_wchar_visual :
alloc_utf8_to_wchar;
guts. mainThreadId = GetCurrentThreadId();
guts. errorMode = SetErrorMode( SEM_FAILCRITICALERRORS);
guts. desktopWindow = GetDesktopWindow();
Expand Down
6 changes: 3 additions & 3 deletions win32/gp.c
Expand Up @@ -907,7 +907,7 @@ apc_gp_text_out( Handle self, const char * text, int x, int y, int len, Bool utf

if ( utf8) {
int mb_len;
if ( !( text = ( char *) alloc_utf8_to_wchar_visual( text, len, &mb_len))) return false;
if ( !( text = ( char *) guts.alloc_utf8_to_wchar_visual( text, len, &mb_len))) return false;
len = mb_len;
}

Expand Down Expand Up @@ -1577,7 +1577,7 @@ apc_gp_get_text_width( Handle self, const char* text, int len, Bool addOverhang,
int ret;
if ( utf8) {
int mb_len;
if ( !( text = ( char *) alloc_utf8_to_wchar_visual( text, len, &mb_len))) return 0;
if ( !( text = ( char *) guts.alloc_utf8_to_wchar_visual( text, len, &mb_len))) return 0;
len = mb_len;
}
ret = gp_get_text_width( self, text, len, addOverhang, utf8);
Expand All @@ -1596,7 +1596,7 @@ apc_gp_get_text_box( Handle self, const char* text, int len, Bool utf8)

if ( utf8) {
int mb_len;
if ( !( text = ( char *) alloc_utf8_to_wchar_visual( text, len, &mb_len))) {
if ( !( text = ( char *) guts.alloc_utf8_to_wchar_visual( text, len, &mb_len))) {
free( pt);
return nil;
}
Expand Down

0 comments on commit 11e0575

Please sign in to comment.