3 * GDI BiDirectional handling
5 * Copyright 2003 Shachar Shemesh
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #ifdef HAVE_UNICODE_UBIDI_H
26 #include <unicode/ubidi.h>
32 #include "wine/debug.h"
34 #include "gdi_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(bidi
);
39 BOOL BidiAvail
= TRUE
;
41 BOOL BidiAvail
= FALSE
;
45 /*************************************************************
49 LPCWSTR lpString
, /* [in] The string for which information is to be returned */
50 INT uCount
, /* [in] Number of WCHARs in string. */
51 DWORD dwFlags
, /* [in] GetCharacterPlacement compatible flags specifying how to process the string */
52 DWORD dwWineGCP_Flags
, /* [in] Wine internal flags - Force paragraph direction */
53 LPWSTR lpOutString
, /* [out] Reordered string */
54 INT uCountOut
, /* [in] Size of output buffer */
55 UINT
*lpOrder
/* [out] Logical -> Visual order map */
58 TRACE("%s, %d, 0x%08lx lpOutString=%p, lpOrder=%p\n",
59 debugstr_wn(lpString
, uCount
), uCount
, dwFlags
,
60 lpOutString
, lpOrder
);
63 if ((dwFlags
& GCP_REORDER
) != 0) {
70 WARN("Failed to allocate structure\n");
71 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
75 switch( dwWineGCP_Flags
&WINE_GCPW_DIR_MASK
)
77 case WINE_GCPW_FORCE_LTR
:
80 case WINE_GCPW_FORCE_RTL
:
83 case WINE_GCPW_LOOSE_LTR
:
84 level
=UBIDI_DEFAULT_LTR
;
86 case WINE_GCPW_LOOSE_RTL
:
87 level
=UBIDI_DEFAULT_RTL
;
91 ubidi_setPara( bidi
, lpString
, uCount
, level
, NULL
, &err
);
92 if( lpOutString
!=NULL
) {
93 ubidi_writeReordered( bidi
, lpOutString
, uCount
,
94 (dwFlags
&GCP_SYMSWAPOFF
)?0:UBIDI_DO_MIRRORING
, &err
);
98 ubidi_getLogicalMap( bidi
, lpOrder
, &err
);
103 if( U_FAILURE(err
) ) {
104 FIXME("ICU Library return error code %d.\n", err
);
105 FIXME("Please report this error to wine-devel@winehq.org so we can place "
106 "descriptive Windows error codes here\n");
107 SetLastError(ERROR_INVALID_LEVEL
); /* This error is cryptic enough not to mean anything, I hope */
115 #endif /* HAVE_ICU */