diff --git a/include/gdi.h b/include/gdi.h index 483b6a7c..4c79a77b 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -2009,20 +2009,26 @@ MG_EXPORT void GUIAPI DeleteSecondaryDC (HWND hwnd); #define DC_ATTR_TEXT_ALIGN 10 +#define DC_ATTR_BIDI_ENABLED 11 +#define DC_ATTR_BIDI_FIRSTCH_TYPE 12 + #define BIDI_CHAR_TYPE_INIT 0 + #define BIDI_CHAR_TYPE_LTR 1 + #define BIDI_CHAR_TYPE_RTL 2 + #ifdef _MGHAVE_ADV_2DAPI -#define DC_ATTR_PEN_TYPE 11 -#define DC_ATTR_PEN_CAP_STYLE 12 -#define DC_ATTR_PEN_JOIN_STYLE 13 -#define DC_ATTR_PEN_WIDTH 14 +#define DC_ATTR_PEN_TYPE 13 +#define DC_ATTR_PEN_CAP_STYLE 14 +#define DC_ATTR_PEN_JOIN_STYLE 15 +#define DC_ATTR_PEN_WIDTH 16 -#define DC_ATTR_BRUSH_TYPE 15 +#define DC_ATTR_BRUSH_TYPE 17 -#define NR_DC_ATTRS 16 +#define NR_DC_ATTRS 18 #else -#define NR_DC_ATTRS 11 +#define NR_DC_ATTRS 13 #endif @@ -2064,9 +2070,12 @@ MG_EXPORT void GUIAPI DeleteSecondaryDC (HWND hwnd); * Spacing bellow line for the DC. * - DC_ATTR_MAP_MODE\n * mode of a DC. - * - DC_ATTR_TEXT_ALIGN\n + * - DC_ATTR_TEXT_ALIGN\n * Text-alignment flags of a DC. - * + * - DC_ATTR_BIDI_ENABLED\n + * Is BIDI enabled. + * - DC_ATTR_BIDI_FIRSTCH_TYPE\n + * The first character type, on of BIDI_CHAR_TYPE_INIT, BIDI_CHAR_TYPE_LTR, or BIDI_CHAR_TYPE_RTL. * \return The attribute value. * * \sa SetDCAttr @@ -7008,7 +7017,15 @@ MG_EXPORT int GUIAPI GetTabbedTextExtent (HDC hdc, * \sa GetTextAlign */ #define SetTextAlign(hdc, ta_flags) \ - SetDCAttr (hdc, DC_ATTR_TEXT_ALIGN, (DWORD)ta_flags) + SetDCAttr (hdc, DC_ATTR_TEXT_ALIGN, (DWORD)ta_flags) + +#define GetBIDIFlag(hdc) GetDCAttr (hdc, DC_ATTR_BIDI_ENABLED) +#define SetBIDIFlag(hdc, bidi) \ + SetDCAttr (hdc, DC_ATTR_BIDI_ENABLED, (DWORD)bidi) + +#define GetBIDIFirstChType(hdc) GetDCAttr (hdc, DC_ATTR_BIDI_FIRSTCH_TYPE) +#define SetBIDIFirstChType(hdc, type) \ + SetDCAttr (hdc, DC_ATTR_BIDI_FIRSTCH_TYPE, (DWORD)type) /** * \fn int GUIAPI TextOutLen (HDC hdc, int x, int y, \ diff --git a/src/include/dc.h b/src/include/dc.h index f00769f3..fa8b36ae 100644 --- a/src/include/dc.h +++ b/src/include/dc.h @@ -166,6 +166,9 @@ struct tagDC int ta_flags; /* Text alignment flags */ + int bidi_flag; /* BIDI enable flag */ + int bidi_firstch_type; /* BIDI first char type */ + #ifdef _MGHAVE_ADV_2DAPI /* pen attributes */ int pen_type; diff --git a/src/newgdi/tabbedtextout.c b/src/newgdi/tabbedtextout.c index cf086a99..edbb51b6 100644 --- a/src/newgdi/tabbedtextout.c +++ b/src/newgdi/tabbedtextout.c @@ -529,10 +529,9 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text, /* set size to zero first */ size->cx = size->cy = 0; - /* FIXME: use HDC property for BIDI enable or not - if (mbc_devfont && mbc_devfont->charset_ops->bidi_reorder) + /* This function does not support BIDI */ + if (mbc_devfont && pdc->bidi_flag && mbc_devfont->charset_ops->bidi_glyph_type) return -1; - */ _gdi_start_new_line (pdc); diff --git a/src/newgdi/textout.c b/src/newgdi/textout.c index 4aa51f7a..116d0b1d 100644 --- a/src/newgdi/textout.c +++ b/src/newgdi/textout.c @@ -462,10 +462,9 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len, /* set size to zero first */ size->cx = size->cy = 0; - /* FIXME: use HDC property for BIDI enable or not - if (mbc_devfont && mbc_devfont->charset_ops->bidi_reorder) + /* This function does not support BIDI */ + if (mbc_devfont && pdc->bidi_flag && mbc_devfont->charset_ops->bidi_glyph_type) return -1; - */ _gdi_start_new_line(pdc);