diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 299dddf65..66c793f21 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -59,6 +59,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19 + uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 with: sarif_file: results.sarif diff --git a/CMakeLists.txt b/CMakeLists.txt index fab2fdb60..f71c8c195 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -491,6 +491,9 @@ endif () ## Define harfbuzz library add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers}) target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS}) +if (MINGW) + target_compile_options(harfbuzz PRIVATE "-Wa,-mbig-obj") +endif() target_include_directories(harfbuzz PUBLIC "$" "$") @@ -534,6 +537,10 @@ if (HB_BUILD_SUBSET) target_link_libraries(harfbuzz-subset harfbuzz ${THIRD_PARTY_LIBS}) set_target_properties(harfbuzz-subset PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + if (MINGW) + target_compile_options(harfbuzz-subset PRIVATE "-Wa,-mbig-obj") + endif() + if (BUILD_SHARED_LIBS) if (BUILD_FRAMEWORK) set_target_properties(harfbuzz harfbuzz-subset PROPERTIES diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml index 76c3b49d1..8616c5393 100644 --- a/docs/harfbuzz-docs.xml +++ b/docs/harfbuzz-docs.xml @@ -24,6 +24,11 @@ release tarballs. + + This document is for HarfBuzz &version;. + The latest version of this documentation can be found on-line at + https://harfbuzz.github.io. + @@ -42,14 +47,6 @@ - - - This document is for HarfBuzz &version;. - - - - Reference manual Core API diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index 9c4bab95d..6e2bd914b 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -161,6 +161,58 @@ _hb_directwrite_table_data_release (void *data) hb_free (context); } +static hb_blob_t * +_hb_directwrite_get_file_blob (IDWriteFontFace *dw_face) +{ + UINT32 file_count; + if (FAILED (dw_face->GetFiles(&file_count, NULL))) + return nullptr; + + IDWriteFontFile **files = new IDWriteFontFile*[file_count]; + if (FAILED (dw_face->GetFiles(&file_count, files))) + { + delete [] files; + return nullptr; + } + + hb_blob_t *blob = nullptr; + for (UINT32 i = 0; i < file_count; i++) + { + LPCVOID reference_key; + UINT32 reference_key_size; + if (FAILED (files[i]->GetReferenceKey(&reference_key, &reference_key_size))) + continue; + + IDWriteFontFileLoader *loader; + if (FAILED (files[i]->GetLoader(&loader))) + continue; + + IDWriteFontFileStream *stream; + if (FAILED (loader->CreateStreamFromKey (reference_key, reference_key_size, &stream))) + { + loader->Release (); + continue; + } + + UINT64 file_size; + const void *fragment; + void *context; + if (FAILED (stream->GetFileSize(&file_size)) || + FAILED (stream->ReadFileFragment (&fragment, 0, file_size, &context))) + { + loader->Release (); + continue; + } + blob = hb_blob_create ((const char *) fragment, file_size, HB_MEMORY_MODE_DUPLICATE, NULL, NULL); + stream->ReleaseFileFragment (context); + loader->Release (); + break; + } + + delete [] files; + return blob; +} + static hb_blob_t * _hb_directwrite_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) { @@ -169,6 +221,9 @@ _hb_directwrite_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void * uint32_t length; void *table_context; BOOL exists; + if (tag == HB_TAG_NONE) + return _hb_directwrite_get_file_blob (dw_face); + if (FAILED (dw_face->TryGetFontTable (hb_uint32_swap (tag), &data, &length, &table_context, &exists))) return nullptr; diff --git a/src/hb-face-builder.cc b/src/hb-face-builder.cc index beea89ed2..c3ddcd856 100644 --- a/src/hb-face-builder.cc +++ b/src/hb-face-builder.cc @@ -169,8 +169,7 @@ _hb_face_builder_get_table_tags (const hb_face_t *face HB_UNUSED, if (unlikely (start_offset >= population)) { - if (table_count) - *table_count = 0; + *table_count = 0; return population; } diff --git a/src/hb-glib.cc b/src/hb-glib.cc index 1da81696e..a85cb365d 100644 --- a/src/hb-glib.cc +++ b/src/hb-glib.cc @@ -127,11 +127,7 @@ hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t *ab, void *user_data HB_UNUSED) { -#if GLIB_CHECK_VERSION(2,29,12) return g_unichar_compose (a, b, ab); -#else - return false; -#endif } static hb_bool_t @@ -141,11 +137,7 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t *b, void *user_data HB_UNUSED) { -#if GLIB_CHECK_VERSION(2,29,12) return g_unichar_decompose (ab, a, b); -#else - return false; -#endif } diff --git a/src/hb-gobject-enums.cc.tmpl b/src/hb-gobject-enums.cc.tmpl index 87a11dd40..cf90ffc32 100644 --- a/src/hb-gobject-enums.cc.tmpl +++ b/src/hb-gobject-enums.cc.tmpl @@ -31,12 +31,6 @@ /* g++ didn't like older gtype.h gcc-only code path. */ #include -#if !GLIB_CHECK_VERSION(2,29,16) -#undef __GNUC__ -#undef __GNUC_MINOR__ -#define __GNUC__ 2 -#define __GNUC_MINOR__ 6 -#endif #include "hb-gobject.h" diff --git a/src/hb-gobject-structs.cc b/src/hb-gobject-structs.cc index d66de0b23..60670b862 100644 --- a/src/hb-gobject-structs.cc +++ b/src/hb-gobject-structs.cc @@ -51,12 +51,6 @@ /* g++ didn't like older gtype.h gcc-only code path. */ #include -#if !GLIB_CHECK_VERSION(2,29,16) -#undef __GNUC__ -#undef __GNUC_MINOR__ -#define __GNUC__ 2 -#define __GNUC_MINOR__ 6 -#endif #include "hb-gobject.h" diff --git a/src/rust/shape.rs b/src/rust/shape.rs index 22edde8bf..a2fbf0f6c 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -293,10 +293,10 @@ pub unsafe extern "C" fn _hb_harfrust_shape_rs( if hr_info.safe_to_insert_tatweel() { info.mask |= hb_glyph_flags_t_HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL; } - pos.x_advance = (hr_pos.x_advance as f32 * x_scale).round() as hb_position_t; - pos.y_advance = (hr_pos.y_advance as f32 * y_scale).round() as hb_position_t; - pos.x_offset = (hr_pos.x_offset as f32 * x_scale).round() as hb_position_t; - pos.y_offset = (hr_pos.y_offset as f32 * y_scale).round() as hb_position_t; + pos.x_advance = (hr_pos.x_advance as f32 * x_scale + 0.5).floor() as hb_position_t; + pos.y_advance = (hr_pos.y_advance as f32 * y_scale + 0.5).floor() as hb_position_t; + pos.x_offset = (hr_pos.x_offset as f32 * x_scale + 0.5).floor() as hb_position_t; + pos.y_offset = (hr_pos.y_offset as f32 * y_scale + 0.5).floor() as hb_position_t; } true as hb_bool_t diff --git a/test/api/hb-test.h b/test/api/hb-test.h index f7ab7b393..2aec8fa23 100644 --- a/test/api/hb-test.h +++ b/test/api/hb-test.h @@ -127,19 +127,10 @@ hb_test_normalize_path (const char *path) } -#if GLIB_CHECK_VERSION(2,25,12) typedef GTestFunc hb_test_func_t; typedef GTestDataFunc hb_test_data_func_t; typedef GTestFixtureFunc hb_test_fixture_func_t; -#else -typedef void (*hb_test_func_t) (void); -typedef void (*hb_test_data_func_t) (gconstpointer user_data); -typedef void (*hb_test_fixture_func_t) (gpointer fixture, gconstpointer user_data); -#endif -#if !GLIB_CHECK_VERSION(2,30,0) -#define g_test_fail() g_error("Test failed") -#endif #ifndef g_assert_true #define g_assert_true g_assert #endif diff --git a/test/shape/meson.build b/test/shape/meson.build index 80526b057..4407f54ef 100644 --- a/test/shape/meson.build +++ b/test/shape/meson.build @@ -5,13 +5,6 @@ subdir('data/text-rendering-tests') # text_rendering_tests shape_run_tests_py = find_program('run-tests.py') -env = environment() -env.set('HAVE_FREETYPE', '@0@'.format(conf.get('HAVE_FREETYPE', 0))) -env.set('HAVE_FONTATIONS', '@0@'.format(conf.get('HAVE_FONTATIONS', 0))) -env.set('HAVE_CORETEXT', '@0@'.format(conf.get('HAVE_CORETEXT', 0))) -env.set('HAVE_DIRECTWRITE', '@0@'.format(conf.get('HAVE_DIRECTWRITE', 0))) -env.set('HAVE_UNISCRIBE', '@0@'.format(conf.get('HAVE_UNISCRIBE', 0))) - sets = ['in-house', 'aots', 'text-rendering-tests'] foreach set : sets # in-house -> in_house_tests, aots -> aots_tests, text-rendering-tests -> text_rendering_tests @@ -29,7 +22,6 @@ foreach set : sets ], protocol: 'tap', #verbose: true, - env: env, workdir: meson.current_build_dir() / '..' / '..', suite: ['shape', set], ) diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh index b6ef80677..59b667775 100644 --- a/util/helper-cairo.hh +++ b/util/helper-cairo.hh @@ -46,8 +46,7 @@ #endif #ifdef CAIRO_HAS_PS_SURFACE # include -# if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,6,0) -# define HAS_EPS 1 +# define HAS_EPS 1 static cairo_surface_t * _cairo_eps_surface_create_for_stream (cairo_write_func_t write_func, @@ -63,9 +62,6 @@ _cairo_eps_surface_create_for_stream (cairo_write_func_t write_func, return surface; } -# else -# undef HAS_EPS -# endif #endif #ifdef CAIRO_HAS_SCRIPT_SURFACE # include diff --git a/util/view-cairo.hh b/util/view-cairo.hh index 3a486766a..704b49fa8 100644 --- a/util/view-cairo.hh +++ b/util/view-cairo.hh @@ -76,11 +76,7 @@ struct view_cairo_t : view_options_t, output_options_t<> helper_cairo_line_t &line = g_array_index (lines, helper_cairo_line_t, i); line.finish (); } -#if GLIB_CHECK_VERSION (2, 22, 0) g_array_unref (lines); -#else - g_array_free (lines, TRUE); -#endif } protected: