[depend] Address review feedback: preprocessor guards, minor API and naming fixes

Replace HB_DEPEND_API with HB_NO_SUBSET_DEPEND gated on HB_EXPERIMENTAL_API
and HB_LEAN in hb-config.hh, with HB_SUBSET_DEPEND_API opt-in to allow
enabling without full experimental API. Remove depend_api meson option;
depend tests now build under experimental_api=true. Fold depend symbols into
experimental symbols in gen-def.py.

Internal fixes: use free_set_list.pop(), push_or_fail() for allocation safety,
return const hb_set_t* from internal get_set_from_index. Ligature.hh: use
hb_sink iterator, rename ligset→ligset_idx, source→gid. Remove stale
test_depend_cmap unit test (cmap extraction was removed in d4d4c635).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Skef IterumandClaude Sonnet 4.6 committed 2026-06-05 15:09:12 -07:00
1 parent edc3a6fa9a
commit 9a5d99f850
29 files changed
+119 -169

No files matched your search

-4
View File
@@ -273,10 +273,6 @@ if not get_option('subset').disabled()
conf.set('HAVE_SUBSET', 1)
endif
if get_option('depend_api')
conf.set('HB_DEPEND_API', 1)
endif
if freetype_dep.found()
conf.set('HAVE_FREETYPE', 1)
check_freetype_funcs = [
-2
View File
@@ -64,8 +64,6 @@ option('with_libstdcxx', type: 'boolean', value: false,
description: 'Allow linking with libstdc++')
option('experimental_api', type: 'boolean', value: false,
description: 'Enable experimental APIs')
option('depend_api', type: 'boolean', value: false,
description: 'Enable dependency analysis APIs (highly experimental, API will change)')
option('ragel_subproject', type: 'boolean', value: false,
description: 'Build Ragel subproject if no suitable version is found')
option('fuzzer_ldflags', type: 'string',
+30 -30
View File
@@ -226,7 +226,7 @@ struct hb_colrv1_closure_context_t :
{}
};
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
struct hb_colrv1_depend_context_t :
hb_dispatch_context_t<hb_colrv1_depend_context_t, bool>
@@ -262,7 +262,7 @@ struct hb_colrv1_depend_context_t :
source_gid (0)
{}
};
#endif /* HB_DEPEND_API */
#endif /* !HB_NO_SUBSET_DEPEND */
struct LayerRecord
{
@@ -325,7 +325,7 @@ struct Variable
return_trace (c->embed (this));
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{ value.dependv1 (c); }
#endif
@@ -405,7 +405,7 @@ struct NoVariable
return_trace (c->embed (this));
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{ value.dependv1 (c); }
#endif
@@ -453,7 +453,7 @@ struct NoVariable
struct ColorStop
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t * c) const {}
#endif
@@ -519,7 +519,7 @@ struct Extend : HBUINT8
template <template<typename> class Var>
struct ColorLine
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t * c) const
{
for (const auto &stop : stops.iter ())
@@ -672,7 +672,7 @@ struct Affine2x3
return_trace (c->check_struct (this));
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const {}
#endif
@@ -722,7 +722,7 @@ struct Affine2x3
struct PaintColrLayers
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -756,7 +756,7 @@ struct PaintColrLayers
struct PaintSolid
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const {}
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const
@@ -811,7 +811,7 @@ struct PaintSolid
template <template<typename> class Var>
struct PaintLinearGradient
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{
(this+colorLine).dependv1 (c);
@@ -888,7 +888,7 @@ struct PaintLinearGradient
template <template<typename> class Var>
struct PaintRadialGradient
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{
(this+colorLine).dependv1 (c);
@@ -965,7 +965,7 @@ struct PaintRadialGradient
template <template<typename> class Var>
struct PaintSweepGradient
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{
(this+colorLine).dependv1 (c);
@@ -1036,7 +1036,7 @@ struct PaintSweepGradient
// Paint a non-COLR glyph, filled as indicated by paint.
struct PaintGlyph
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1082,7 +1082,7 @@ struct PaintGlyph
struct PaintColrGlyph
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1115,7 +1115,7 @@ struct PaintColrGlyph
template <template<typename> class Var>
struct PaintTransform
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1157,7 +1157,7 @@ struct PaintTransform
struct PaintTranslate
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1209,7 +1209,7 @@ struct PaintTranslate
struct PaintScale
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1261,7 +1261,7 @@ struct PaintScale
struct PaintScaleAroundCenter
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1319,7 +1319,7 @@ struct PaintScaleAroundCenter
struct PaintScaleUniform
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1366,7 +1366,7 @@ struct PaintScaleUniform
struct PaintScaleUniformAroundCenter
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1421,7 +1421,7 @@ struct PaintScaleUniformAroundCenter
struct PaintRotate
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1468,7 +1468,7 @@ struct PaintRotate
struct PaintRotateAroundCenter
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1523,7 +1523,7 @@ struct PaintRotateAroundCenter
struct PaintSkew
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1575,7 +1575,7 @@ struct PaintSkew
struct PaintSkewAroundCenter
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1633,7 +1633,7 @@ struct PaintSkewAroundCenter
struct PaintComposite
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const;
@@ -1746,7 +1746,7 @@ struct ClipBoxFormat2 : Variable<ClipBoxFormat1>
}
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const
@@ -1766,7 +1766,7 @@ struct ClipBox
}
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{
switch (u.format.v) {
@@ -1831,7 +1831,7 @@ struct ClipRecord
int cmp (hb_codepoint_t g) const
{ return g < startGlyphID ? -1 : g <= endGlyphID ? 0 : +1; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c, const void *base) const
{
(base+clipBox).dependv1 (c);
@@ -2335,7 +2335,7 @@ struct COLR
bool is_valid () { return colr.get_blob ()->length; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_data_t *depend_data) const
{ colr->depend (depend_data); }
#endif
@@ -2401,7 +2401,7 @@ struct COLR
mutable hb_atomic_t<hb_colr_scratch_t *> cached_scratch;
};
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_data_t *depend_data) const
{
// v0
+1 -1
View File
@@ -35,7 +35,7 @@
*/
namespace OT {
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
HB_INTERNAL void PaintColrLayers::dependv1 (hb_colrv1_depend_context_t* c) const
{
+1 -1
View File
@@ -29,7 +29,7 @@ struct AlternateSet
void closure (hb_closure_context_t *c) const
{ c->output->add_array (alternates.arrayZ, alternates.len); }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_context_t *c, hb_codepoint_t source) const
{
+ hb_iter (alternates)
+1 -1
View File
@@ -34,7 +34,7 @@ struct AlternateSubstFormat1_2
bool may_have_non_1to1 () const
{ return false; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
// Filter by parent_active_glyphs like closure does
+10 -11
View File
@@ -38,34 +38,33 @@ struct Ligature
c->output->add (ligGlyph);
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_context_t *c, hb_codepoint_t first) const
{
// Build the complete ligature set upfront before adding any edges
hb_set_t complete_ligset;
complete_ligset.add(first);
for (const auto &source : component)
complete_ligset.add(source);
complete_ligset.add (first);
+ hb_iter (component) | hb_sink (complete_ligset);
hb_codepoint_t ligset = c->depend_data->new_ligature_set(complete_ligset);
hb_codepoint_t ligset_idx = c->depend_data->new_ligature_set(complete_ligset);
// Track whether any edge using this ligset was actually added
// Track whether any edge using this ligset_idx was actually added
bool any_added = false;
// Now add all edges with the complete, immutable set
if (c->depend_data->add_gsub_lookup (first, c->lookup_index, ligGlyph, ligset))
if (c->depend_data->add_gsub_lookup (first, c->lookup_index, ligGlyph, ligset_idx))
any_added = true;
+ hb_iter (component)
| hb_apply ([&] (const hb_codepoint_t &source) {
if (c->depend_data->add_gsub_lookup (source, c->lookup_index, ligGlyph, ligset))
| hb_apply ([&] (const hb_codepoint_t &gid) {
if (c->depend_data->add_gsub_lookup (gid, c->lookup_index, ligGlyph, ligset_idx))
any_added = true;
})
;
// If no edges were added, the ligset is unused - free it for reuse
// If no edges were added, the ligset_idx is unused - free it for reuse
if (!any_added)
c->depend_data->free_ligature_set(ligset);
c->depend_data->free_ligature_set(ligset_idx);
}
#endif
+1 -1
View File
@@ -54,7 +54,7 @@ struct LigatureSet
;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_context_t *c, hb_codepoint_t first) const
{
+ hb_iter (ligature)
+1 -1
View File
@@ -43,7 +43,7 @@ struct LigatureSubstFormat1_2
bool may_have_non_1to1 () const
{ return true; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
+ hb_zip (this+coverage, ligatureSet)
+1 -1
View File
@@ -44,7 +44,7 @@ struct MultipleSubstFormat1_2
;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
// Filter by parent_active_glyphs like closure does
@@ -67,7 +67,7 @@ struct ReverseChainSingleSubstFormat1
bool may_have_non_1to1 () const
{ return false; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const {
// Filter by intersects and parent_active_glyphs like closure does (lines 83-95)
if (!intersects (c->glyphs)) return true;
+1 -1
View File
@@ -28,7 +28,7 @@ struct Sequence
void closure (hb_closure_context_t *c) const
{ c->output->add_array (substitute.arrayZ, substitute.len); }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_context_t *c, hb_codepoint_t source) const
{
+ hb_iter (substitute)
+1 -1
View File
@@ -45,7 +45,7 @@ struct SingleSubstFormat1_3
bool may_have_non_1to1 () const
{ return false; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
hb_codepoint_t d = deltaGlyphID;
+1 -1
View File
@@ -34,7 +34,7 @@ struct SingleSubstFormat2_4
bool may_have_non_1to1 () const
{ return false; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
auto &cov = this+coverage;
+2 -2
View File
@@ -61,7 +61,7 @@ struct SubstLookup : Lookup
return ret;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
hb_depend_context_t::return_t depend (hb_depend_context_t *c) const
{
c->set_recurse_func (dispatch_depend_recurse_func);
@@ -213,7 +213,7 @@ struct SubstLookup : Lookup
return ret;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
static inline typename hb_depend_context_t::return_t depend_glyphs_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index);
static inline hb_depend_context_t::return_t dispatch_depend_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index)
+2 -8
View File
@@ -25,19 +25,13 @@ hb_subset_cff_get_charstring_data
hb_subset_cff_get_charstrings_index
hb_subset_cff2_get_charstring_data
hb_subset_cff2_get_charstrings_index
""".splitlines ()
symbols = [x for x in symbols if x not in experimental_symbols]
if '--depend-api' not in sys.argv:
# Depend API symbols - only included when depend_api=true
depend_symbols = \
"""hb_depend_from_face_or_fail
hb_depend_from_face_or_fail
hb_depend_get_glyph_entry
hb_depend_get_set_from_index
hb_depend_print
hb_depend_destroy
""".splitlines ()
symbols = [x for x in symbols if x not in depend_symbols]
symbols = [x for x in symbols if x not in experimental_symbols]
symbols = "\n".join (symbols)
result = symbols if os.getenv ('PLAIN_LIST', '') else """EXPORTS
+6
View File
@@ -38,6 +38,11 @@
#ifndef HB_EXPERIMENTAL_API
#define HB_NO_BEYOND_64K
#define HB_NO_CUBIC_GLYF
#define HB_NO_SUBSET_DEPEND
#endif
#ifdef HB_SUBSET_DEPEND_API
#undef HB_NO_SUBSET_DEPEND
#endif
#ifdef HB_TINY
@@ -78,6 +83,7 @@
#define HB_NO_OT_FONT_GLYPH_NAMES
#define HB_NO_SETLOCALE
#define HB_NO_STYLE
#define HB_NO_SUBSET_DEPEND
#define HB_NO_VERTICAL
#define HB_NO_VAR
+13 -15
View File
@@ -31,7 +31,7 @@
#include "hb-multimap.hh"
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/**
* Edge flags for hb_depend_data_record_t.
@@ -227,7 +227,7 @@ struct hb_lookup_feature_record_t {
struct hb_depend_data_t
{
hb_depend_data_t ()
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
: current_context_set_index (HB_CODEPOINT_INVALID),
current_edge_flags (0)
#endif
@@ -270,8 +270,7 @@ struct hb_depend_data_t
if (free_set_list.length > 0)
{
/* Reuse freed set */
set_index = free_set_list[free_set_list.length - 1];
free_set_list.resize (free_set_list.length - 1);
set_index = free_set_list.pop ();
sets[set_index]->set (set);
}
else
@@ -282,7 +281,8 @@ struct hb_depend_data_t
if (unlikely (!new_set))
return HB_CODEPOINT_INVALID;
new_set->set (set);
sets.push (hb::unique_ptr<hb_set_t> {new_set});
if (unlikely (!sets.push_or_fail (hb::unique_ptr<hb_set_t> {new_set})))
return HB_CODEPOINT_INVALID;
}
return set_index;
@@ -315,7 +315,7 @@ struct hb_depend_data_t
return new_idx;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/* Build a context set from context information.
* Encodes backtrack and lookahead requirements as a flattened set.
* Returns HB_CODEPOINT_INVALID if no context.
@@ -454,13 +454,11 @@ struct hb_depend_data_t
return false;
}
bool get_set_from_index(hb_codepoint_t index, hb_set_t *out)
const hb_set_t *get_set_from_index (hb_codepoint_t index)
{
if (index < sets.length) {
out->set(*sets[index]);
return true;
}
return false;
if (index < sets.length)
return sets[index].get ();
return nullptr;
}
bool add_depend_layout (hb_codepoint_t target, hb_tag_t table_tag,
@@ -495,7 +493,7 @@ struct hb_depend_data_t
hb_codepoint_t lig_set = HB_CODEPOINT_INVALID,
hb_codepoint_t context_set = HB_CODEPOINT_INVALID)
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/* Use pre-computed context set index for the current rule */
if (context_set == HB_CODEPOINT_INVALID)
context_set = current_context_set_index;
@@ -548,7 +546,7 @@ struct hb_depend_data_t
/* Edge deduplication: struct-based hashing via edge_key_t */
hb_hashmap_t<edge_key_t, bool> seen_edges;
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/* Temporary: Context set index for the current rule.
* Built once per rule by context_depend_lookup/chain_context_depend_lookup,
* then used by all edges recorded from nested lookups. */
@@ -562,6 +560,6 @@ struct hb_depend_data_t
#endif
};
#endif /* HB_DEPEND_API */
#endif /* !HB_NO_SUBSET_DEPEND */
#endif /* HB_DEPEND_DATA_HH */
+6 -3
View File
@@ -37,7 +37,7 @@
#include "OT/Color/COLR/COLR.hh"
#include "OT/Color/COLR/colrv1-depend.hh"
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/**
* SECTION:hb-depend
@@ -387,7 +387,10 @@ hb_depend_get_glyph_entry(hb_depend_t *depend, hb_codepoint_t gid,
hb_bool_t
hb_depend_get_set_from_index(hb_depend_t *depend, hb_codepoint_t index,
hb_set_t *out) {
return depend->get_set_from_index(index, out);
const hb_set_t *s = depend->get_set_from_index (index);
if (!s) return false;
out->set (*s);
return true;
}
/**
@@ -428,4 +431,4 @@ hb_depend_destroy (hb_depend_t *depend)
hb_free (depend);
}
#endif /* HB_DEPEND_API */
#endif /* !HB_NO_SUBSET_DEPEND */
+1 -1
View File
@@ -34,7 +34,7 @@
HB_BEGIN_DECLS
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/**
* hb_depend_t:
+4 -4
View File
@@ -32,7 +32,7 @@
#include "hb-depend.h"
#include "hb-depend-data.hh"
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/**
* hb_depend_t:
@@ -72,9 +72,9 @@ struct hb_depend_t
return data.get_glyph_entry(gid, index, table_tag, dependent, layout_tag,
ligature_set, context_set, flags);
}
bool get_set_from_index(hb_codepoint_t index, hb_set_t *out)
const hb_set_t *get_set_from_index (hb_codepoint_t index)
{
return data.get_set_from_index(index, out);
return data.get_set_from_index (index);
}
HB_INTERNAL void get_gsub_dependencies ();
@@ -88,6 +88,6 @@ struct hb_depend_t
hb_depend_data_t data;
};
#endif /* HB_DEPEND_API */
#endif /* !HB_NO_SUBSET_DEPEND */
#endif /* HB_DEPEND_HH */
+1 -1
View File
@@ -58,7 +58,7 @@ template <typename context_t>
return l.dispatch (c);
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/*static*/ typename hb_depend_context_t::return_t SubstLookup::depend_glyphs_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index)
{
const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index);
+20 -20
View File
@@ -376,7 +376,7 @@ struct hb_collect_glyphs_context_t :
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
};
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
struct hb_depend_context_t :
hb_dispatch_context_t<hb_depend_context_t, bool>
{
@@ -1895,7 +1895,7 @@ static void context_closure_recurse_lookups (hb_closure_context_t *c,
}
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
template <typename HBUINT>
static void context_depend_recurse_lookups (hb_depend_context_t *c,
unsigned inputCount, const HBUINT input[],
@@ -1954,15 +1954,15 @@ static void context_depend_recurse_lookups (hb_depend_context_t *c,
elem = HB_SET_VALUE_INVALID;
while (disjunctive_indices.next (&elem)) {
hb_codepoint_t set_idx = elem & 0x7FFFFFFF;
hb_set_t original_set;
c->depend_data->get_set_from_index (set_idx, &original_set);
const hb_set_t *original_set = c->depend_data->get_set_from_index (set_idx);
if (unlikely (!original_set)) continue;
/* Make local copy and subtract direct requirements */
hb_set_t filtered;
filtered.set (original_set);
filtered.set (*original_set);
filtered.subtract (position_context);
if (filtered == original_set) {
if (filtered == *original_set) {
/* No overlap with position_context - add full requirement */
filtered_disjunctive_indices.add (elem);
}
@@ -2251,7 +2251,7 @@ struct ContextClosureLookupContext
void *intersected_glyphs_cache;
};
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
struct ContextDependLookupContext
{
ContextClosureFuncs funcs;
@@ -2309,7 +2309,7 @@ static inline void context_closure_lookup (hb_closure_context_t *c,
lookup_context.intersected_glyphs_cache);
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
template <typename HBUINT>
static inline void context_depend_lookup (hb_depend_context_t *c,
unsigned int inputCount, /* Including the first glyph (not matched) */
@@ -2487,7 +2487,7 @@ struct Rule
lookup_context);
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_context_t *c, unsigned value, ContextDependLookupContext &lookup_context) const
{
const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
@@ -2632,7 +2632,7 @@ struct RuleSet
;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_context_t *c, unsigned value, ContextDependLookupContext &lookup_context) const
{
+ hb_iter (rule)
@@ -2882,7 +2882,7 @@ struct ContextFormat1_4
bool may_have_non_1to1 () const
{ return true; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs ();
@@ -3079,7 +3079,7 @@ struct ContextFormat2_5
bool may_have_non_1to1 () const
{ return true; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
if (!(this+coverage).intersects (c->glyphs))
@@ -3358,7 +3358,7 @@ struct ContextFormat3
bool may_have_non_1to1 () const
{ return true; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
if (!(this+coverageZ[0]).intersects (c->glyphs))
@@ -3566,7 +3566,7 @@ struct ChainContextClosureLookupContext
void *intersected_glyphs_cache;
};
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
struct ChainContextDependLookupContext
{
ContextClosureFuncs funcs;
@@ -3646,7 +3646,7 @@ static inline void chain_context_closure_lookup (hb_closure_context_t *c,
lookup_context.intersected_glyphs_cache);
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
template <typename HBUINT>
static inline void chain_context_depend_lookup (hb_depend_context_t *c,
unsigned int backtrackCount,
@@ -3900,7 +3900,7 @@ struct ChainRule
lookup_context);
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_context_t *c, unsigned value, ChainContextDependLookupContext &lookup_context) const
{
const auto &input = StructAfter<decltype (inputX)> (backtrack);
@@ -4110,7 +4110,7 @@ struct ChainRuleSet
| hb_any
;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_context_t *c, unsigned value, ChainContextDependLookupContext &lookup_context) const
{
+ hb_iter (rule)
@@ -4381,7 +4381,7 @@ struct ChainContextFormat1_4
bool may_have_non_1to1 () const
{ return true; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs ();
@@ -4580,7 +4580,7 @@ struct ChainContextFormat2_5
bool may_have_non_1to1 () const
{ return true; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
if (!(this+coverage).intersects (c->glyphs))
@@ -4920,7 +4920,7 @@ struct ChainContextFormat3
bool may_have_non_1to1 () const
{ return true; }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
bool depend (hb_depend_context_t *c) const
{
const auto &input = StructAfter<decltype (inputX)> (backtrack);
+6 -6
View File
@@ -663,7 +663,7 @@ struct MathGlyphVariantRecord
return_trace (c->check_struct (this));
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_data_t *depend_data, unsigned source) const
{ depend_data->add_depend(source, HB_OT_TAG_MATH, variantGlyph); }
#endif
@@ -729,7 +729,7 @@ struct MathGlyphPartRecord
(partFlags & PartFlags::Defined);
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_data_t *depend_data, unsigned source) const
{ depend_data->add_depend(source, HB_OT_TAG_MATH, glyph); }
#endif
@@ -801,7 +801,7 @@ struct MathGlyphAssembly
return partRecords.len;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_data_t *depend_data, unsigned source) const
{
for (const auto& _ : partRecords.iter ())
@@ -874,7 +874,7 @@ struct MathGlyphConstruction
return mathGlyphVariantRecord.len;
}
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_data_t *depend_data, unsigned source) const
{
(this+glyphAssembly).depend (depend_data, source);
@@ -906,7 +906,7 @@ struct MathGlyphConstruction
struct MathVariants
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_data_t *depend_data) const
{
const hb_array_t<const Offset16To<MathGlyphConstruction>> glyph_construction_offsets = glyphConstruction.as_array (vertGlyphCount + horizGlyphCount);
@@ -1132,7 +1132,7 @@ struct MATH
bool has_data () const { return version.to_int (); }
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
void depend (hb_depend_data_t *depend_data) const
{
if (mathVariants)
-4
View File
@@ -630,10 +630,6 @@ gen_def_cmd = [gen_def, '@OUTPUT@', '@INPUT@']
if get_option('experimental_api')
gen_def_cmd += '--experimental-api'
endif
if get_option('depend_api')
gen_def_cmd += '--depend-api'
endif
# harfbuzz
harfbuzz_def = custom_target('harfbuzz.def',
command: gen_def_cmd,
+1 -1
View File
@@ -92,7 +92,7 @@ if conf.get('HAVE_PTHREAD', 0) == 1
tests += 'test-multithread.c'
endif
if conf.get('HB_DEPEND_API', 0) == 1
if conf.get('HB_EXPERIMENTAL_API', 0) == 1
tests += 'test-ot-depend.c'
endif
+1 -41
View File
@@ -27,7 +27,7 @@
#include <hb.h>
#include <hb-ot.h>
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
/*
* ============================================================================
@@ -275,45 +275,6 @@ find_dependency (hb_depend_t *depend,
return FALSE;
}
/* Test cmap (character mapping) dependency extraction */
static void
test_depend_cmap (void)
{
/* ===== UNDERSTANDING cmap DEPENDENCIES ===== */
/*
* IMPORTANT: Nominal cmap mappings (Unicode → glyph) are NOT stored as
* glyph→glyph dependencies. They're collected in a separate nominal_glyphs
* map for lookup purposes.
*
* Only Unicode Variation Sequences (UVS) with NonDefault mappings create
* glyph dependencies. The model is:
* - Unicode U nominally maps to glyph G
* - U + selector S → variant glyph V (NonDefault UVS)
* - This creates dependency: G depends on V with layout_tag=S
*
* Default UVS entries (where selector uses the nominal glyph) do NOT
* create dependencies.
*/
/* ===== UNICODE VARIATION SEQUENCES (UVS) ===== */
/* base.ttf has NonDefault UVS entries:
* U+904D nominally maps to cid00007 (GID 7)
* U+904D + selector 0xE01E5 → cid00010 (GID 10) via NonDefault UVS
* This creates dependency: GID 7 → GID 10 with layout_tag=0xE01E5 */
hb_face_t *face = hb_test_open_font_file ("fonts/base.ttf");
hb_depend_t *depend = hb_depend_from_face_or_fail (face);
g_assert_nonnull (depend);
g_test_message ("Testing cmap NonDefault UVS: cid00007 (7) → cid00010 (10) with selector 0xE01E5");
hb_tag_t layout_tag = 0xE01E5; /* UVS selector stored in layout_tag */
g_assert_true (find_dependency (depend, 7, 10, HB_TAG('c','m','a','p'),
&layout_tag, NULL));
hb_depend_destroy (depend);
hb_face_destroy (face);
}
/* Test glyf (composite glyph) dependency extraction */
static void
@@ -637,7 +598,6 @@ main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
hb_test_add (test_depend_cmap);
hb_test_add (test_depend_glyf);
hb_test_add (test_depend_cff);
hb_test_add (test_depend_colr);
+4 -4
View File
@@ -12,7 +12,7 @@
#include <random>
#include <vector>
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
#include <hb.h>
/**
@@ -1533,11 +1533,11 @@ compare_closures (hb_face_t *face, hb_depend_t *depend,
return match;
}
#endif /* HB_DEPEND_API */
#endif /* !HB_NO_SUBSET_DEPEND */
extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
{
#ifdef HB_DEPEND_API
#ifndef HB_NO_SUBSET_DEPEND
alloc_state = _fuzzing_alloc_state (data, size);
/* Initialize configuration on first run */
@@ -1735,7 +1735,7 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
hb_depend_destroy (depend);
hb_face_destroy (face);
hb_blob_destroy (blob);
#endif /* HB_DEPEND_API */
#endif /* !HB_NO_SUBSET_DEPEND */
return 0;
}
+2 -2
View File
@@ -74,7 +74,7 @@ foreach file_name : tests
endforeach
# Build depend-related fuzzers only if depend_api is enabled
if conf.get('HB_DEPEND_API', 0) == 1
if conf.get('HB_EXPERIMENTAL_API', 0) == 1
foreach file_name : depend_tests
test_name = file_name.split('.')[0]
@@ -227,7 +227,7 @@ if not get_option('subset').disabled()
endforeach
endif
if conf.get('HB_DEPEND_API', 0) == 1
if conf.get('HB_EXPERIMENTAL_API', 0) == 1
i = 0
foreach chunk : api_fonts_glob_chunks
test('depend-closure-parity-chunk-@0@'.format(i),