use mainstream HarfBuzz and hb_buffer_set_unicode_funcs

This commit is contained in:
Vincent Wei
2020-07-23 18:34:56 +08:00
parent 6d287f72e3
commit f16a629ade
4 changed files with 63 additions and 34 deletions

View File

@@ -1,5 +1,7 @@
# Release Notes For MiniGUI Core 4.0.x
- [Version 4.0.8](#version-408)
+ [What's new in version 4.0.8](#whats-new-in-version-408)
- [Version 4.0.7](#version-407)
+ [What's new in version 4.0.7](#whats-new-in-version-407)
- [Version 4.0.6](#version-406)
@@ -24,6 +26,27 @@
+ [Backward compatibility issues](#backward-compatibility-issues)
+ [Deprecated features](#deprecated-features)
## Version 4.0.8
The MiniGUI development team announces the availability of MiniGUI 4.0.8.
We strongly recommend that you use this version for any new MiniGUI
apps, especially if the new features of MiniGUI 4.0.8 are must for your
new apps.
Please report any bugs and incompatibilities in
<https://github.com/VincentWei/minigui/tree/rel-4-0>
### What's new in version 4.0.8
In this version, we tuned some code for GCC 9 and fixed some bugs:
* ADJUSTMENTS:
- Use mainstream Harfbuzz for glyph shaping of complex scripts instead
of the modified version.
* TUNING:
- Tune some code to depress compilation warnings.
## Version 4.0.7
The MiniGUI development team announces the availability of MiniGUI 4.0.7.

View File

@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT(libminigui, 4.0.7)
AC_INIT(libminigui, 4.0.8)
AC_CONFIG_SRCDIR(src/main/main.c)
dnl Set various version strings - taken gratefully from the SDL sources
@@ -16,7 +16,7 @@ dnl Set various version strings - taken gratefully from the SDL sources
#
MINIGUI_MAJOR_VERSION=4
MINIGUI_MINOR_VERSION=0
MINIGUI_MICRO_VERSION=7
MINIGUI_MICRO_VERSION=8
MINIGUI_INTERFACE_AGE=0
MINIGUI_BINARY_AGE=0
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
@@ -2168,7 +2168,7 @@ if test "x$build_complex_scripts" = "xyes"; then
[ --with-hb-includes=DIR where the HarfBuzz includes are])
if test "x$with_hb_includes" = "x"; then
HB_INC_DIR="-I/usr/local/include/harfbuzz"
HB_INC_DIR="-I/usr/include/harfbuzz"
else
HB_INC_DIR="-I$with_hb_includes"
fi

View File

@@ -120,47 +120,42 @@ hb_minigui_unicode_decompose (hb_unicode_funcs_t *ufuncs,
return UCharDecompose(ab, a, b);
}
static hb_unicode_funcs_t *_funcs;
static hb_unicode_funcs_t *get_unicode_funcs(void)
{
if (_funcs)
return _funcs;
_funcs = hb_unicode_funcs_create (NULL);
hb_unicode_funcs_set_combining_class_func (_funcs,
hb_minigui_unicode_combining_class, NULL, NULL);
hb_unicode_funcs_set_general_category_func (_funcs,
hb_minigui_unicode_general_category, NULL, NULL);
hb_unicode_funcs_set_mirroring_func (_funcs,
hb_minigui_unicode_mirroring, NULL, NULL);
hb_unicode_funcs_set_script_func (_funcs,
hb_minigui_unicode_script, NULL, NULL);
hb_unicode_funcs_set_compose_func (_funcs,
hb_minigui_unicode_compose, NULL, NULL);
hb_unicode_funcs_set_decompose_func (_funcs,
hb_minigui_unicode_decompose, NULL, NULL);
hb_unicode_funcs_make_immutable (_funcs);
return _funcs;
}
typedef hb_unicode_funcs_t *(*hb_get_unicode_funcs) (void);
extern hb_get_unicode_funcs __hb_extern_get_unicode_funcs;
/* extern hb_unicode_funcs_t *__mg_hb_unifuncs */
hb_unicode_funcs_t *__mg_hb_unifuncs;
void __mg_init_harzbuff_funcs(void)
{
_DBG_PRINTF("%s: called\n", __FUNCTION__);
__hb_extern_get_unicode_funcs = get_unicode_funcs;
if (__mg_hb_unifuncs)
return;
__mg_hb_unifuncs = hb_unicode_funcs_create (NULL);
hb_unicode_funcs_set_combining_class_func (__mg_hb_unifuncs,
hb_minigui_unicode_combining_class, NULL, NULL);
hb_unicode_funcs_set_general_category_func (__mg_hb_unifuncs,
hb_minigui_unicode_general_category, NULL, NULL);
hb_unicode_funcs_set_mirroring_func (__mg_hb_unifuncs,
hb_minigui_unicode_mirroring, NULL, NULL);
hb_unicode_funcs_set_script_func (__mg_hb_unifuncs,
hb_minigui_unicode_script, NULL, NULL);
hb_unicode_funcs_set_compose_func (__mg_hb_unifuncs,
hb_minigui_unicode_compose, NULL, NULL);
hb_unicode_funcs_set_decompose_func (__mg_hb_unifuncs,
hb_minigui_unicode_decompose, NULL, NULL);
hb_unicode_funcs_make_immutable (__mg_hb_unifuncs);
return;
}
void __mg_term_harzbuff_funcs(void)
{
_DBG_PRINTF("%s: called\n", __FUNCTION__);
if (_funcs) {
hb_unicode_funcs_destroy(_funcs);
if (__mg_hb_unifuncs) {
hb_unicode_funcs_destroy(__mg_hb_unifuncs);
}
else {
_ERR_PRINTF("%s: hb_unicode_funcs_t object is NULL\n",

View File

@@ -75,6 +75,9 @@
#include <hb.h>
#include <hb-ft.h>
/* __mg_hb_unifuncs is implemented in src/font/harzbuff-minigui-funcs.c */
extern hb_unicode_funcs_t *__mg_hb_unifuncs;
// define _CACHED_HB_FONT if you want use the cached HB fonts
#define _CACHED_HB_FONT 1
@@ -216,6 +219,14 @@ static BOOL shape_layout_run(SEInstance* inst,
if (hb_buf == NULL)
goto error;
/* use our own unicode functions */
if (__mg_hb_unifuncs) {
hb_buffer_set_unicode_funcs(hb_buf, __mg_hb_unifuncs);
}
else {
_DBG_PRINTF("Unicode functions for HarfBuzz does not initialized\n");
}
hb_buffer_set_content_type(hb_buf, HB_BUFFER_CONTENT_TYPE_UNICODE);
for (i = 0; i < run->len; i++) {
hb_buffer_add(hb_buf, run->ucs[i], i);