Merge branch 'main' into HVF

This commit is contained in:
Behdad Esfahbod committed 2025-03-03 01:30:08 -07:00
commit b652d02eb9
3 files changed
+19 -16

No files matched your search

+1 -1
View File
@@ -358,7 +358,7 @@ VARC::get_path_at (const hb_varc_context_t &c,
#ifndef HB_NO_VAR_HVF
if (!c.font->face->table.hvgl->get_path_at (c.font, glyph, shape_draw_session, coords))
#endif
if (!c.font->face->table.glyf->get_path_at (c.font, glyph, shape_draw_session, coords, c.scratch))
if (!c.font->face->table.glyf->get_path_at (c.font, glyph, shape_draw_session, coords, c.scratch.glyf_scratch))
#ifndef HB_NO_CFF
if (!c.font->face->table.cff2->get_path_at (c.font, glyph, shape_draw_session, coords))
if (!c.font->face->table.cff1->get_path (c.font, glyph, shape_draw_session)) // Doesn't have variations
+18 -11
View File
@@ -22,6 +22,13 @@ namespace OT {
#ifndef HB_NO_VAR_COMPOSITES
struct hb_varc_scratch_t
{
hb_vector_t<unsigned> axisIndices;
hb_vector_t<float> axisValues;
hb_glyf_scratch_t glyf_scratch;
};
struct hb_varc_context_t
{
hb_font_t *font;
@@ -30,7 +37,7 @@ struct hb_varc_context_t
mutable hb_decycler_t decycler;
mutable signed edges_left;
mutable signed depth_left;
hb_glyf_scratch_t &scratch;
hb_varc_scratch_t &scratch;
};
struct VarComponent
@@ -106,7 +113,7 @@ struct VARC
get_path (hb_font_t *font,
hb_codepoint_t gid,
hb_draw_session_t &draw_session,
hb_glyf_scratch_t &scratch) const
hb_varc_scratch_t &scratch) const
{
hb_varc_context_t c {font,
&draw_session,
@@ -124,7 +131,7 @@ struct VARC
get_extents (hb_font_t *font,
hb_codepoint_t gid,
hb_extents_t<> *extents,
hb_glyf_scratch_t &scratch) const
hb_varc_scratch_t &scratch) const
{
hb_varc_context_t c {font,
nullptr,
@@ -164,7 +171,7 @@ struct VARC
auto *scratch = cached_scratch.get_relaxed ();
if (scratch)
{
scratch->~hb_glyf_scratch_t ();
scratch->~hb_varc_scratch_t ();
hb_free (scratch);
}
@@ -205,31 +212,31 @@ struct VARC
private:
hb_glyf_scratch_t *acquire_scratch () const
hb_varc_scratch_t *acquire_scratch () const
{
hb_glyf_scratch_t *scratch = cached_scratch.get_acquire ();
hb_varc_scratch_t *scratch = cached_scratch.get_acquire ();
if (!scratch || unlikely (!cached_scratch.cmpexch (scratch, nullptr)))
{
scratch = (hb_glyf_scratch_t *) hb_calloc (1, sizeof (hb_glyf_scratch_t));
scratch = (hb_varc_scratch_t *) hb_calloc (1, sizeof (hb_varc_scratch_t));
if (unlikely (!scratch))
return nullptr;
}
return scratch;
}
void release_scratch (hb_glyf_scratch_t *scratch) const
void release_scratch (hb_varc_scratch_t *scratch) const
{
if (!cached_scratch.cmpexch (scratch, nullptr))
if (!cached_scratch.cmpexch (nullptr, scratch))
{
scratch->~hb_glyf_scratch_t ();
scratch->~hb_varc_scratch_t ();
hb_free (scratch);
}
}
private:
hb_blob_ptr_t<VARC> table;
hb_atomic_ptr_t<hb_glyf_scratch_t> cached_scratch;
hb_atomic_ptr_t<hb_varc_scratch_t> cached_scratch;
};
bool has_data () const { return version.major != 0; }
-4
View File
@@ -53,10 +53,6 @@ struct hb_glyf_scratch_t
contour_point_vector_t deltas;
hb_vector_t<unsigned int> shared_indices;
hb_vector_t<unsigned int> private_indices;
// VARC
hb_vector_t<unsigned> axisIndices;
hb_vector_t<float> axisValues;
};
namespace OT {