Merge branch 'main' into HVF

This commit is contained in:
Behdad Esfahbod committed 2025-04-20 00:37:24 -06:00
commit aef3df5097
26 files changed
+119 -42

No files matched your search

+1 -1
View File
@@ -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@fc7e4a0fa01c3cca5fd6a1fddec5c0740c977aa2 # v3.28.14
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
with:
sarif_file: results.sarif
+1
View File
@@ -204,6 +204,7 @@ set (project_headers
${PROJECT_SOURCE_DIR}/src/hb-ot.h
${PROJECT_SOURCE_DIR}/src/hb-paint.h
${PROJECT_SOURCE_DIR}/src/hb-set.h
${PROJECT_SOURCE_DIR}/src/hb-script-list.h
${PROJECT_SOURCE_DIR}/src/hb-shape-plan.h
${PROJECT_SOURCE_DIR}/src/hb-shape.h
${PROJECT_SOURCE_DIR}/src/hb-style.h
+14
View File
@@ -1,3 +1,17 @@
Overview of changes leading to 11.1.0
Wednesdat, April 16, 2025
====================================
- Include bidi mirroring variants of the requested codepoints when subsetting.
The new HB_SUBSET_FLAGS_NO_BIDI_CLOSURE can be used to disable this
behaviour.
- Various bug fixes.
- Various build fixes and improvements.
- Various test suite improvements.
New API:
+HB_SUBSET_FLAGS_NO_BIDI_CLOSURE
Overview of changes leading to 11.0.1
Friday, April 4, 2025
====================================
+7 -2
View File
@@ -1,6 +1,6 @@
project('harfbuzz', ['c', 'cpp'],
meson_version: '>= 0.60.0',
version: '11.0.1',
version: '11.1.0',
default_options: [
'cpp_eh=none', # Just to support msvc, we are passing -fno-exceptions also anyway
# 'cpp_rtti=false', # Do NOT enable, wraps inherit it and ICU needs RTTI
@@ -32,11 +32,16 @@ pkgmod = import('pkgconfig')
cpp = meson.get_compiler('cpp')
null_dep = dependency('', required: false)
# Includes Microsoft Clang compiler with GNU arguments, see
# https://github.com/harfbuzz/harfbuzz/pull/4394
cpp_is_microsoft_compiler = host_machine.system() == 'windows' and cpp.get_define('_MSC_FULL_VER') != ''
# Only perform these checks if cpp_std is c++11 as setting -std directly
# produces a warning from meson.
if get_option('cpp_std') == 'c++11'
# Enforce C++14 requirement for MSVC STL
if cpp.get_id() == 'clang' and cpp.get_define('_MSC_FULL_VER') != ''
if cpp.get_id() == 'clang' and cpp_is_microsoft_compiler
add_project_arguments('-std=c++14', language: 'cpp')
elif cpp.get_id() == 'clang-cl'
# Clang-cl produces a warning when using -std=c++14, but not when using /std:c++14
+1 -1
View File
@@ -1604,7 +1604,7 @@ struct ClipBox
void closurev1 (hb_colrv1_closure_context_t* c) const
{
switch (u.format) {
case 2: u.format2.closurev1 (c);
case 2: u.format2.closurev1 (c); return;
default:return;
}
}
+1
View File
@@ -17,6 +17,7 @@ IGNORED_SYMBOLS += [
'rust_eh_personality',
'_ZN3std9panicking11EMPTY_PANIC.*', # 'std::panicking::EMPTY_PANIC::.*'
'_ZN3std3sys3pal4unix4args3imp15ARGV_INIT_ARRAY.*', # 'std::sys::pal::unix::args::imp::ARGV_INIT_ARRAY::.*'
'_ZN3std3sys4args4unix3imp15ARGV_INIT_ARRAY.*', # std::sys::args::unix::imp::ARGV_INIT_ARRAY::.*
'_ZN17compiler_builtins4math4libm7generic4sqrt9RSQRT_TAB.*', # 'compiler_builtins::math::libm::generic::sqrt::RSQRT_TAB::.*'
]
+3
View File
@@ -969,6 +969,9 @@ extern "C" fn _hb_fontations_paint_glyph(
hb_paint_push_font_transform(paint_funcs, paint_data, font);
}
let _ = color_glyph.paint(location, &mut painter);
unsafe {
hb_paint_pop_transform(paint_funcs, paint_data);
}
}
extern "C" fn _hb_fontations_glyph_name(
+2 -2
View File
@@ -782,8 +782,8 @@ struct hb_font_t
bool y_neg = y_scale < 0;
y_mult = (y_neg ? -((int64_t) -y_scale << 16) : ((int64_t) y_scale << 16)) / upem;
x_strength = fabsf (roundf (x_scale * x_embolden));
y_strength = fabsf (roundf (y_scale * y_embolden));
x_strength = roundf (abs (x_scale) * x_embolden);
y_strength = roundf (abs (y_scale) * y_embolden);
slant_xy = y_scale ? slant * x_scale / y_scale : 0.f;
+6 -6
View File
@@ -415,18 +415,18 @@ hb_ot_get_glyph_extents (hb_font_t *font,
const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
const hb_ot_face_t *ot_face = ot_font->ot_face;
#ifndef HB_NO_VAR_COMPOSITES
if (ot_face->VARC->get_extents (font, glyph, extents)) return true;
#endif
#ifndef HB_NO_VAR_HVF
if (ot_face->hvgl->get_extents (font, glyph, extents)) return true;
#endif
#if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR)
if (ot_face->sbix->get_extents (font, glyph, extents)) return true;
if (ot_face->CBDT->get_extents (font, glyph, extents)) return true;
#endif
#if !defined(HB_NO_COLOR) && !defined(HB_NO_PAINT)
if (ot_face->COLR->get_extents (font, glyph, extents)) return true;
#endif
#ifndef HB_NO_VAR_COMPOSITES
if (ot_face->VARC->get_extents (font, glyph, extents)) return true;
#endif
#ifndef HB_NO_VAR_HVF
if (ot_face->hvgl->get_extents (font, glyph, extents)) return true;
#endif
if (ot_face->glyf->get_extents (font, glyph, extents)) return true;
#ifndef HB_NO_OT_FONT_CFF
+1 -1
View File
@@ -182,7 +182,7 @@ struct BaseCoord
void collect_variation_indices (hb_set_t& varidx_set /* OUT */) const
{
switch (u.format) {
case 3: hb_barrier (); u.format3.collect_variation_indices (varidx_set);
case 3: hb_barrier (); u.format3.collect_variation_indices (varidx_set); return;
default:return;
}
}
+2 -1
View File
@@ -2632,7 +2632,8 @@ struct hb_get_glyph_alternates_dispatch_t :
* @alternate_glyphs: (out caller-allocates) (array length=alternate_count): A glyphs buffer.
* Alternate glyphs associated with the glyph id.
*
* Fetches alternates of a glyph from a given GSUB lookup index.
* Fetches alternates of a glyph from a given GSUB lookup index. Note that for one-to-one GSUB
* glyph substitutions, this function fetches the substituted glyph.
*
* Return value: Total number of alternates found in the specific lookup index for the given glyph id.
*
+43 -10
View File
@@ -29,6 +29,8 @@
#include "hb-map.hh"
#include "hb-multimap.hh"
#include "hb-set.hh"
#include "hb-subset.h"
#include "hb-unicode.h"
#include "hb-ot-cmap-table.hh"
#include "hb-ot-glyf-table.hh"
@@ -209,15 +211,46 @@ _fill_unicode_and_glyph_map(hb_subset_plan_t *plan,
_fill_unicode_and_glyph_map(plan, unicode_iterator, unicode_to_gid_for_iterator, unicode_to_gid_for_iterator);
}
/*
* Finds additional unicode codepoints which are reachable from the input unicode set.
* Currently this adds in mirrored variants (needed for bidi) of any input unicodes.
*/
static hb_set_t
_unicode_closure (const hb_set_t* unicodes, bool bidi_closure) {
// TODO: we may want to also consider pulling in reachable unicode composition and decompositions.
// see: https://github.com/harfbuzz/harfbuzz/issues/2283
hb_set_t out = *unicodes;
if (!bidi_closure) return out;
if (out.is_inverted()) {
// don't closure inverted sets, they are asking to specifically exclude certain codepoints.
// otherwise everything is already included.
return out;
}
auto unicode_funcs = hb_unicode_funcs_get_default ();
for (hb_codepoint_t cp : *unicodes) {
hb_codepoint_t mirror = hb_unicode_mirroring(unicode_funcs, cp);
if (unlikely (mirror != cp)) {
out.add(mirror);
}
}
return out;
}
static void
_populate_unicodes_to_retain (const hb_set_t *unicodes,
_populate_unicodes_to_retain (const hb_set_t *unicodes_in,
const hb_set_t *glyphs,
hb_subset_plan_t *plan)
{
hb_set_t unicodes = _unicode_closure(unicodes_in,
!(plan->flags & HB_SUBSET_FLAGS_NO_BIDI_CLOSURE));
OT::cmap::accelerator_t cmap (plan->source);
unsigned size_threshold = plan->source->get_num_glyphs ();
if (glyphs->is_empty () && unicodes->get_population () < size_threshold)
if (glyphs->is_empty () && unicodes.get_population () < size_threshold)
{
const hb_map_t* unicode_to_gid = nullptr;
@@ -227,9 +260,9 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
// This is approach to collection is faster, but can only be used if glyphs
// are not being explicitly added to the subset and the input unicodes set is
// not excessively large (eg. an inverted set).
plan->unicode_to_new_gid_list.alloc (unicodes->get_population ());
plan->unicode_to_new_gid_list.alloc (unicodes.get_population ());
if (!unicode_to_gid) {
_fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) {
_fill_unicode_and_glyph_map(plan, unicodes.iter(), [&] (hb_codepoint_t cp) {
hb_codepoint_t gid;
if (!cmap.get_nominal_glyph (cp, &gid)) {
return HB_MAP_VALUE_INVALID;
@@ -241,7 +274,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
// the map. This code is mostly duplicated from above to avoid doing
// conditionals on the presence of the unicode_to_gid map each
// iteration.
_fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) {
_fill_unicode_and_glyph_map(plan, unicodes.iter(), [&] (hb_codepoint_t cp) {
return unicode_to_gid->get (cp);
});
}
@@ -258,7 +291,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
if (!plan->accelerator) {
cmap.collect_mapping (&cmap_unicodes_storage, &unicode_glyphid_map_storage);
plan->unicode_to_new_gid_list.alloc (hb_min(unicodes->get_population ()
plan->unicode_to_new_gid_list.alloc (hb_min(unicodes.get_population ()
+ glyphs->get_population (),
cmap_unicodes->get_population ()));
} else {
@@ -267,10 +300,10 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
}
if (plan->accelerator &&
unicodes->get_population () < cmap_unicodes->get_population () &&
unicodes.get_population () < cmap_unicodes->get_population () &&
glyphs->get_population () < cmap_unicodes->get_population ())
{
plan->codepoint_to_glyph->alloc (unicodes->get_population () + glyphs->get_population ());
plan->codepoint_to_glyph->alloc (unicodes.get_population () + glyphs->get_population ());
auto &gid_to_unicodes = plan->accelerator->gid_to_unicodes;
@@ -285,7 +318,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
});
}
_fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) {
_fill_unicode_and_glyph_map(plan, unicodes.iter(), [&] (hb_codepoint_t cp) {
/* Don't double-add entry. */
if (plan->codepoint_to_glyph->has (cp))
return HB_MAP_VALUE_INVALID;
@@ -306,7 +339,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
{
_fill_unicode_and_glyph_map(plan, hb_range(first, last + 1), [&] (hb_codepoint_t cp) {
hb_codepoint_t gid = (*unicode_glyphid_map)[cp];
if (!unicodes->has (cp) && !glyphs->has (gid))
if (!unicodes.has (cp) && !glyphs->has (gid))
return HB_MAP_VALUE_INVALID;
return gid;
},
+5 -2
View File
@@ -71,10 +71,12 @@ typedef struct hb_subset_plan_t hb_subset_plan_t;
* in the final subset.
* @HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES: If set then the unicode ranges in
* OS/2 will not be recalculated.
* @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set don't perform glyph closure on layout
* @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set do not perform glyph closure on layout
* substitution rules (GSUB). Since: 7.2.0.
* @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the
* remaining gvar table's deltas. Since: 8.5.0
* @HB_SUBSET_FLAGS_NO_BIDI_CLOSURE: If set do not pull mirrored versions of input
* codepoints into the subset. Since: 11.1.0
* @HB_SUBSET_FLAGS_IFTB_REQUIREMENTS: If set enforce requirements on the output subset
* to allow it to be used with incremental font transfer IFTB patches. Primarily,
* this forces all outline data to use long (32 bit) offsets. Since: EXPERIMENTAL
@@ -96,8 +98,9 @@ typedef enum { /*< flags >*/
HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES = 0x00000100u,
HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE = 0x00000200u,
HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS = 0x00000400u,
HB_SUBSET_FLAGS_NO_BIDI_CLOSURE = 0x00000800u,
#ifdef HB_EXPERIMENTAL_API
HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00000800u,
HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00001000u,
#endif
} hb_subset_flags_t;
+3 -3
View File
@@ -47,20 +47,20 @@ HB_BEGIN_DECLS
*
* The minor component of the library version available at compile-time.
*/
#define HB_VERSION_MINOR 0
#define HB_VERSION_MINOR 1
/**
* HB_VERSION_MICRO:
*
* The micro component of the library version available at compile-time.
*/
#define HB_VERSION_MICRO 1
#define HB_VERSION_MICRO 0
/**
* HB_VERSION_STRING:
*
* A string literal containing the library version available at compile-time.
*/
#define HB_VERSION_STRING "11.0.1"
#define HB_VERSION_STRING "11.1.0"
/**
* HB_VERSION_ATLEAST:
+1 -1
View File
@@ -465,7 +465,7 @@ static int HB_UNUSED _hb_errno = 0;
# define hb_atexit atexit
# else
template <void (*function) (void)> struct hb_atexit_t { ~hb_atexit_t () { function (); } };
# define hb_atexit(f) static hb_atexit_t<f> _hb_atexit_##__LINE__;
# define hb_atexit(f) static hb_atexit_t<f> _hb_atexit_##__LINE__
# endif
#endif
#endif
+13 -12
View File
@@ -601,7 +601,7 @@ defs_list = [harfbuzz_def]
version = '0.@0@.0'.format(hb_version_int)
extra_hb_cpp_args = []
if cpp.get_define('_MSC_FULL_VER') != ''
if cpp_is_microsoft_compiler
if get_option('default_library') != 'static'
extra_hb_cpp_args += '-DHB_DLL_EXPORT'
endif
@@ -723,7 +723,7 @@ if get_option('tests').enabled()
# TODO: Microsoft LINK gives the following because extern, non dllexport
# symbols can only be used when linking against a static library
# error LNK2019: unresolved external symbol "unsigned __int64 const * const _hb_NullPool"
if cpp.get_define('_MSC_FULL_VER') == ''
if not cpp_is_microsoft_compiler
noinst_programs = {
'main': 'main.cc',
'test-basics': 'test.cc',
@@ -770,7 +770,7 @@ if get_option('tests').enabled()
'test-unicode-ranges': ['test-unicode-ranges.cc'],
}
foreach name, source : compiled_tests
if cpp.get_define('_MSC_FULL_VER') != '' and source.contains('hb-static.cc')
if cpp_is_microsoft_compiler and source.contains('hb-static.cc')
# TODO: Microsoft compilers cannot link tests using hb-static.cc, fix them
continue
endif
@@ -842,15 +842,10 @@ have_gobject = conf.get('HAVE_GOBJECT', 0) == 1
cmake_config = configuration_data()
cmake_config_dir = cmake_package_install_dir / 'harfbuzz'
have_fs_relative_to = meson.version().version_compare('>=1.3.0')
if not have_fs_relative_to
relative_to = find_program('relative_to.py')
endif
if have_fs_relative_to
if meson.version().version_compare('>=1.3.0')
cmake_package_prefix_dir = fs.relative_to(get_option('prefix'), get_option('prefix') / cmake_config_dir)
else
relative_to = find_program('relative_to.py')
cmake_package_prefix_dir = run_command(relative_to, get_option('prefix'), get_option('prefix') / cmake_config_dir, check: true).stdout().strip()
endif
@@ -862,7 +857,7 @@ cmake_package_prefix_dir = '${CMAKE_CURRENT_LIST_DIR}/@0@'.format(cmake_package_
cmake_install_includedir = get_option('includedir')
if fs.is_absolute(cmake_install_includedir)
if have_fs_relative_to
if meson.version().version_compare('>=1.3.0')
cmake_install_includedir = fs.relative_to(cmake_install_includedir, get_option('prefix'))
else
cmake_install_includedir = run_command(relative_to, cmake_install_includedir, get_option('prefix'), check: true).stdout().strip()
@@ -872,7 +867,7 @@ endif
cmake_install_libdir = get_option('libdir')
if fs.is_absolute(cmake_install_libdir)
if have_fs_relative_to
if meson.version().version_compare('>=1.3.0')
cmake_install_libdir = fs.relative_to(cmake_install_libdir, get_option('prefix'))
else
cmake_install_libdir = run_command(relative_to, cmake_install_libdir, get_option('prefix'), check: true).stdout().strip()
@@ -1049,11 +1044,17 @@ if get_option('tests').enabled()
env.set('libs', meson.current_build_dir()) # TODO: Merge this with builddir after autotools removal
HBSOURCES = []
foreach f : hb_sources
if meson.version().version_compare('>=1.4.0')
f = f.full_path()
endif
HBSOURCES += '@0@'.format(f)
endforeach
env.set('HBSOURCES', ' '.join(HBSOURCES))
HBHEADERS = []
foreach f : hb_headers
if meson.version().version_compare('>=1.4.0')
f = f.full_path()
endif
HBHEADERS += '@0@'.format(f)
endforeach
env.set('HBHEADERS', ' '.join(HBHEADERS))
@@ -1,3 +1,4 @@
--layout-features=*
--notdef-outline
--no-bidi-closure
--retain-gids
@@ -1,2 +1,3 @@
--layout-features=*
--notdef-outline
--no-bidi-closure
@@ -0,0 +1 @@
--no-bidi-closure
+10
View File
@@ -0,0 +1,10 @@
FONTS:
Roboto-Regular.ttf
PROFILES:
default.txt
no_bidi_closure.txt
SUBSETS:
abc<
abc>
+1
View File
@@ -1,5 +1,6 @@
tests = [
'basics',
'bidi',
'cmap',
'cmap14',
'preprocess',
+1
View File
@@ -985,6 +985,7 @@ subset_main_t::add_options ()
{"notdef-outline", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NOTDEF_OUTLINE>, "Keep the outline of \'.notdef\' glyph", nullptr},
{"no-prune-unicode-ranges", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES>, "Don't change the 'OS/2 ulUnicodeRange*' bits.", nullptr},
{"no-layout-closure", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE>, "Don't perform glyph closure for layout substitution (GSUB).", nullptr},
{"no-bidi-closure", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NO_BIDI_CLOSURE>, "Don't perform bidi closure (adding mirrored variants) for input codepoints.", nullptr},
{"glyph-names", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_GLYPH_NAMES>, "Keep PS glyph names in TT-flavored fonts. ", nullptr},
{"passthrough-tables", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED>, "Do not drop tables that the tool does not know how to subset.", nullptr},
{"preprocess-face", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &this->preprocess,