diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 4ab838f3..bdcd2e0e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,7 @@ # Release Notes +- [Version 5.0.13](#version-5013) + + [What's new in version 5.0.13](#whats-new-in-version-5013) - [Version 5.0.12](#version-5012) + [What's new in version 5.0.12](#whats-new-in-version-5012) - [Version 5.0.11](#version-5011) @@ -30,6 +32,23 @@ + [Changes leading to incompatibility](#changes-leading-to-incompatibility) + [Deprecated APIs](#deprecated-apis) +## Version 5.0.13 + +On July 31, 2023, FMSoft announces the availability of MiniGUI 5.0.13, +which is an enhancement release with some minor enhancements +of MiniGUI 5.0.x. + +### What's new in version 5.0.13 + +In this version, we made some enhancements: + +* ENHANCEMENTS: + - Disable BIDI for text in UTF-8 charset by default. +* CHANGES: + - Add `BIDI_FLAG_NONE` and `BIDI_FLAG_LEGACY`. +* BUGFIXING: + - Ignore C0CTRL characters when renerding text. + ## Version 5.0.12 On May 10, 2023, FMSoft announces the availability of MiniGUI 5.0.12, diff --git a/Version.md b/Version.md index 80a9b578..aa4da7b0 100644 --- a/Version.md +++ b/Version.md @@ -1,4 +1,4 @@ -Version 5.0.12 (2023/04/30) +Version 5.0.14 (2023/07/31) This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version. diff --git a/configure.ac b/configure.ac index 5d362622..98835d81 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.60) -AC_INIT(libminigui, 5.0.12) +AC_INIT(libminigui, 5.0.13) AC_CONFIG_SRCDIR(src/main/main.c) dnl Set various version strings - taken gratefully from the SDL sources @@ -16,9 +16,9 @@ dnl Set various version strings - taken gratefully from the SDL sources # MINIGUI_MAJOR_VERSION=5 MINIGUI_MINOR_VERSION=0 -MINIGUI_MICRO_VERSION=12 -MINIGUI_INTERFACE_AGE=0 -MINIGUI_BINARY_AGE=2 +MINIGUI_MICRO_VERSION=13 +MINIGUI_INTERFACE_AGE=1 +MINIGUI_BINARY_AGE=3 MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION AC_SUBST(MINIGUI_MAJOR_VERSION) diff --git a/include/gdi.h b/include/gdi.h index 9104262c..0493d946 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -10713,7 +10713,10 @@ MG_EXPORT int GUIAPI GetTabbedTextExtent (HDC hdc, SetDCAttr (hdc, DC_ATTR_TEXT_ALIGN, (DWORD)ta_flags) #define BIDI_FLAG_LTR 0x00 -#define BIDI_FLAG_RTL 0x10 +#define BIDI_FLAG_RTL 0x01 + +#define BIDI_FLAG_NONE BIDI_FLAG_LTR +#define BIDI_FLAG_LEGACY 0x10 #define GetBIDIFlags(hdc) \ GetDCAttr (hdc, DC_ATTR_BIDI_FLAGS) diff --git a/src/newgdi/drawtext.c b/src/newgdi/drawtext.c index 00375c5b..becaf7d1 100644 --- a/src/newgdi/drawtext.c +++ b/src/newgdi/drawtext.c @@ -120,6 +120,8 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value, switch (char_type & ACHARTYPE_BASIC_MASK) { case ACHAR_BASIC_ZEROWIDTH: + case ACHAR_BASIC_CTRL1: + case ACHAR_BASIC_CTRL2: case ACHAR_BASIC_CR: adv_x = adv_y = 0; break; @@ -312,7 +314,7 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount, pText, nCount, '\n', &nr_delim_newline); /* line_len == 0 means the first char is '\n' */ - if(nFormat & DT_SINGLELINE) { + if (nFormat & DT_SINGLELINE) { line_len = nCount; } else if (line_len == 0) { @@ -324,7 +326,7 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount, nCount -= line_len + nr_delim_newline; pText = pText + line_len + nr_delim_newline; - while(line_len){ + while (line_len){ if (nLines == 0) { line_x = indent; maxwidth = rcDraw.right - rcDraw.left; @@ -369,7 +371,7 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount, ctxt.x = x + line_x; ctxt.advance = 0; ctxt.only_extent = old_set; - if((nFormat & DT_CALCRECT) && (pRect->left > ctxt.x)) + if ((nFormat & DT_CALCRECT) && (pRect->left > ctxt.x)) pRect->left = ctxt.x; _gdi_reorder_text_break (pdc, pline, line_len, (pdc->ta_flags & TA_X_MASK) != TA_RIGHT, diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index a0d843b1..b2f056a2 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -1932,7 +1932,7 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient) pdc->mapmode = MM_TEXT; pdc->ta_flags = TA_LEFT | TA_TOP | TA_NOUPDATECP; - pdc->bidi_flags = BIDI_FLAG_LTR; + pdc->bidi_flags = BIDI_FLAG_NONE; pdc->ViewOrig.x = pdc->ViewOrig.y = 0; pdc->ViewExtent.x = pdc->ViewExtent.y = 1; @@ -2155,7 +2155,7 @@ static void dc_InitScreenDC (PDC pdc, GAL_Surface *surface) pdc->mapmode = MM_TEXT; pdc->ta_flags = TA_LEFT | TA_TOP | TA_NOUPDATECP; - pdc->bidi_flags = BIDI_FLAG_LTR; + pdc->bidi_flags = BIDI_FLAG_NONE; pdc->ViewOrig.x = pdc->ViewOrig.y = 0; pdc->ViewExtent.x = pdc->ViewExtent.y = 1; diff --git a/src/newgdi/legacy-bidi.c b/src/newgdi/legacy-bidi.c index 37fad788..49ee4078 100644 --- a/src/newgdi/legacy-bidi.c +++ b/src/newgdi/legacy-bidi.c @@ -95,6 +95,7 @@ static Achar32* _gdi_get_achars_string(PDC pdc, const unsigned char* text, logical_achars[i++] = SET_MBCHV(chv); char_type = (*mbc_devfont->charset_ops->char_type) (chv); + if (!(char_type & ACHAR_BASIC_NOSPACING_MARK)){ prev_mchar = text; prev_len = len_cur_char; @@ -476,7 +477,7 @@ static int _gdi_output_achars_direct(PDC pdc, const unsigned char* text, } #endif - while (left_bytes > 0){ + while (left_bytes > 0) { if (mbc_devfont) { len_cur_char = mbc_devfont->charset_ops->len_first_char ((const unsigned char*)text, left_bytes); @@ -551,7 +552,9 @@ Achar32* _gdi_bidi_reorder (PDC pdc, const unsigned char* text, int text_len, DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1]; Achar32 *logical_achars = NULL; - if (mbc_devfont && mbc_devfont->charset_ops->bidi_char_type) { + if (mbc_devfont && + (mbc_devfont->charset_ops->legacy_bidi || pdc->bidi_flags) && + mbc_devfont->charset_ops->bidi_char_type) { logical_achars = _gdi_get_achars_string (pdc, text, text_len, nr_achars); if (*nr_achars > 0) __mg_legacy_bidi_achars_reorder (mbc_devfont->charset_ops, @@ -574,7 +577,8 @@ int _gdi_reorder_text (PDC pdc, const unsigned char* text, int text_len, int nr_achars = 0; Achar32 *logical_achars = NULL; - if (mbc_devfont->charset_ops->bidi_char_type) { + if ((mbc_devfont->charset_ops->legacy_bidi || pdc->bidi_flags) && + mbc_devfont->charset_ops->bidi_char_type) { logical_achars = _gdi_bidi_reorder (pdc, text, text_len, &nr_achars); if (!logical_achars || nr_achars <= 0) @@ -969,7 +973,8 @@ int _gdi_reorder_text_break (PDC pdc, const unsigned char* text, int nr_achars = text_len; Achar32 *logical_achars = NULL; - if (mbc_devfont->charset_ops->bidi_char_type){ + if ((mbc_devfont->charset_ops->legacy_bidi || pdc->bidi_flags) && + mbc_devfont->charset_ops->bidi_char_type){ logical_achars = _gdi_get_achars_string_break(pdc, text, text_len, &nr_achars, context); @@ -1456,8 +1461,8 @@ int GUIAPI BIDIGetTextVisualAChars(LOGFONT* log_font, nr_achars = BIDIGetTextLogicalAChars(log_font, text, text_len, achs, achs_map); - if (nr_achars > 0 && mbc_devfont - && mbc_devfont->charset_ops->bidi_char_type) { + if (nr_achars > 0 && mbc_devfont && + mbc_devfont->charset_ops->bidi_char_type) { __mg_legacy_bidi_map_reorder (mbc_devfont->charset_ops, *achs, nr_achars, -1, *achs_map); } diff --git a/src/newgdi/tabbedtextout.c b/src/newgdi/tabbedtextout.c index 3bfdab4f..912ea715 100644 --- a/src/newgdi/tabbedtextout.c +++ b/src/newgdi/tabbedtextout.c @@ -136,6 +136,8 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value, switch (char_type & ACHARTYPE_BASIC_MASK) { case ACHAR_BASIC_ZEROWIDTH: + case ACHAR_BASIC_CTRL1: + case ACHAR_BASIC_CTRL2: adv_x = adv_y = 0; break; @@ -219,6 +221,8 @@ static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value, switch (char_type & ACHARTYPE_BASIC_MASK) { case ACHAR_BASIC_ZEROWIDTH: + case ACHAR_BASIC_CTRL1: + case ACHAR_BASIC_CTRL2: adv_x = adv_y = 0; break; @@ -590,6 +594,8 @@ static int get_tabbed_text_extent_point_for_bidi(HDC hdc, int adv_x = 0, adv_y = 0; switch (achar_type & ACHARTYPE_BASIC_MASK) { case ACHAR_BASIC_ZEROWIDTH: + case ACHAR_BASIC_CTRL1: + case ACHAR_BASIC_CTRL2: adv_x = adv_y = 0; break; case ACHAR_BASIC_LF: @@ -660,7 +666,8 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text, /* set size to zero first */ size->cx = size->cy = 0; - if (mbc_devfont && pdc->bidi_flags && + if (mbc_devfont && + (mbc_devfont->charset_ops->legacy_bidi || pdc->bidi_flags) && mbc_devfont->charset_ops->bidi_char_type) { return get_tabbed_text_extent_point_for_bidi(hdc, text, len, max_extent, fit_chars, pos_chars, dx_chars, size); @@ -709,6 +716,8 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text, switch (char_type & ACHARTYPE_BASIC_MASK) { case ACHAR_BASIC_ZEROWIDTH: + case ACHAR_BASIC_CTRL1: + case ACHAR_BASIC_CTRL2: break; case ACHAR_BASIC_LF: size->cy += line_height; @@ -784,6 +793,8 @@ int GUIAPI GetTabbedACharsExtentPointEx(HDC hdc, int adv_x = 0, adv_y = 0; switch (achar_type & ACHARTYPE_BASIC_MASK) { case ACHAR_BASIC_ZEROWIDTH: + case ACHAR_BASIC_CTRL1: + case ACHAR_BASIC_CTRL2: adv_x = adv_y = 0; break; case ACHAR_BASIC_LF: diff --git a/src/newgdi/textout.c b/src/newgdi/textout.c index d6de3b1c..dd2ac67e 100644 --- a/src/newgdi/textout.c +++ b/src/newgdi/textout.c @@ -533,7 +533,8 @@ int GUIAPI GetTextExtentPoint (HDC hdc, size->cx = size->cy = 0; /* This function does not support BIDI */ - if (mbc_devfont && pdc->bidi_flags && + if (mbc_devfont && + (mbc_devfont->charset_ops->legacy_bidi || pdc->bidi_flags) && mbc_devfont->charset_ops->bidi_char_type) { get_text_extent_point_for_bidi(pdc, text, len, max_extent, fit_chars, pos_chars, dx_chars, size);