Skip to content

Commit 77a23af

Browse files
committed
Merge commit '3ef8709829a5884517ad91a97b32b9435b2f20d1'
2 parents f9b7a7c + 3ef8709 commit 77a23af

File tree

89 files changed

+790
-272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+790
-272
lines changed

NEWS

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1+
Overview of changes leading to 10.4.0
2+
Saturday, March 1, 2025
3+
====================================
4+
- Drawing glyphs using hb-draw API now avoids any “malloc” calls, which
5+
improves drawing performance by 10+%.
6+
- Add support new “GVAR” table fonts with more than 65535 glyphs. Support is
7+
currently behind a compilation flag and is disabled by default.
8+
- Some hb-directwrite and hb-ft APIs got renamed with more clear names and the
9+
old names are deprecated.
10+
- Various build and fuzzing fixes.
11+
12+
- New API:
13+
+hb_directwrite_face_get_dw_font_face()
14+
+hb_ft_font_get_ft_face()
15+
16+
- Deprecated API:
17+
+hb_directwrite_face_get_font_face()
18+
+hb_ft_font_get_face()
19+
20+
121
Overview of changes leading to 10.3.0
222
Thursday, February 11, 2025
323
====================================
4-
524
- Vastly improved “AAT” shaping performance. LucidaGrande benchmark-shape
625
before: 14.6ms after: 5.9ms.
726
- Improved OpenType shaping performance (kerning / ligature), at the expense of
@@ -226,10 +245,10 @@ Saturday, November 11, 2023
226245
tools. Old option is kept as an alias.
227246

228247
- New API:
229-
HB_AAT_LAYOUT_FEATURE_TYPE_CURSIVE_CONNECTION
248+
+HB_AAT_LAYOUT_FEATURE_TYPE_CURSIVE_CONNECTION
230249

231250
- Deprecated API:
232-
HB_AAT_LAYOUT_FEATURE_TYPE_CURISVE_CONNECTION
251+
+HB_AAT_LAYOUT_FEATURE_TYPE_CURISVE_CONNECTION
233252

234253
Overview of changes leading to 8.2.2
235254
Wednesday, October 18, 2023

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
[![Linux CI Status](https://github.com/harfbuzz/harfbuzz/workflows/linux-ci/badge.svg)](https://github.com/harfbuzz/harfbuzz/workflows/linux-ci/badge.svg)
1+
[![Linux CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/linux-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/linux-ci.yml)
2+
[![macoOS CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/macos-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/macos-ci.yml)
3+
[![Windows CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/msvc-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/msvc-ci.yml)
24
[![CircleCI Build Status](https://circleci.com/gh/harfbuzz/harfbuzz/tree/main.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz/tree/main)
35
[![OSS-Fuzz Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/harfbuzz.svg)](https://oss-fuzz-build-logs.storage.googleapis.com/index.html)
46
[![Coverity Scan Build Status](https://scan.coverity.com/projects/15166/badge.svg)](https://scan.coverity.com/projects/harfbuzz)
5-
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/89c872f5ce1c42af802602bfcd15d90a)](https://app.codacy.com/gh/harfbuzz/harfbuzz/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
67
[![Packaging status](https://repology.org/badge/tiny-repos/harfbuzz.svg)](https://repology.org/project/harfbuzz/versions)
78
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/harfbuzz/harfbuzz/badge)](https://securityscorecards.dev/viewer/?uri=github.com/harfbuzz/harfbuzz)
89

docs/harfbuzz-docs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
<index id="api-index-full"><title>API Index</title><xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include></index>
121121
<index id="deprecated-api-index"><title>Index of deprecated API</title><xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include></index>
122122

123+
<index id="api-index-10-4-0"><title>Index of new symbols in 10.4.0</title><xi:include href="xml/api-index-10.4.0.xml"><xi:fallback /></xi:include></index>
123124
<index id="api-index-10-3-0"><title>Index of new symbols in 10.3.0</title><xi:include href="xml/api-index-10.3.0.xml"><xi:fallback /></xi:include></index>
124125
<index id="api-index-10-2-0"><title>Index of new symbols in 10.2.0</title><xi:include href="xml/api-index-10.2.0.xml"><xi:fallback /></xi:include></index>
125126
<index id="api-index-10-1-0"><title>Index of new symbols in 10.1.0</title><xi:include href="xml/api-index-10.1.0.xml"><xi:fallback /></xi:include></index>

docs/harfbuzz-sections.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ hb_font_funcs_set_glyph_shape_func
332332
hb_font_get_glyph_v_kerning
333333
hb_font_get_glyph_v_kerning_func_t
334334
HB_AAT_LAYOUT_FEATURE_TYPE_CURISVE_CONNECTION
335+
hb_directwrite_face_get_font_face
336+
hb_ft_font_get_face
337+
hb_graphite2_font_get_gr_font
335338
</SECTION>
336339

337340
<SECTION>
@@ -350,7 +353,7 @@ hb_coretext_font_set_funcs
350353
<SECTION>
351354
<FILE>hb-directwrite</FILE>
352355
hb_directwrite_face_create
353-
hb_directwrite_face_get_font_face
356+
hb_directwrite_face_get_dw_font_face
354357
hb_directwrite_font_create
355358
hb_directwrite_font_get_dw_font
356359
</SECTION>
@@ -523,7 +526,7 @@ hb_ft_face_create_from_file_or_fail
523526
hb_ft_font_create
524527
hb_ft_font_create_referenced
525528
hb_ft_font_changed
526-
hb_ft_font_get_face
529+
hb_ft_font_get_ft_face
527530
hb_ft_font_lock_face
528531
hb_ft_font_unlock_face
529532
hb_ft_font_set_load_flags
@@ -549,7 +552,6 @@ hb_glib_blob_create
549552
<FILE>hb-graphite2</FILE>
550553
HB_GRAPHITE2_TAG_SILF
551554
hb_graphite2_face_get_gr_face
552-
hb_graphite2_font_get_gr_font
553555
</SECTION>
554556

555557
<SECTION>

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('harfbuzz', 'c', 'cpp',
22
meson_version: '>= 0.55.0',
3-
version: '10.3.0',
3+
version: '10.4.0',
44
default_options: [
55
'cpp_eh=none', # Just to support msvc, we are passing -fno-exceptions also anyway
66
# 'cpp_rtti=false', # Do NOT enable, wraps inherit it and ICU needs RTTI

src/OT/Color/CBDT/CBDT.hh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,10 +941,12 @@ struct CBDT
941941
}
942942
}
943943

944-
bool has_data () const { return cbdt.get_length (); }
944+
bool has_data () const { return cbdt->version.major; }
945945

946946
bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const
947947
{
948+
if (!has_data ()) return false;
949+
948950
hb_glyph_extents_t extents;
949951
hb_glyph_extents_t pixel_extents;
950952
hb_blob_t *blob = reference_png (font, glyph);

src/OT/Var/VARC/VARC.cc

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ VarComponent::get_path_at (hb_font_t *font,
137137
hb_decycler_t *decycler,
138138
signed *edges_left,
139139
signed depth_left,
140+
hb_glyf_scratch_t &scratch,
140141
VarRegionList::cache_t *cache) const
141142
{
142143
const unsigned char *end = total_record.arrayZ + total_record.length;
143144
const unsigned char *record = total_record.arrayZ;
144145

145-
auto &VARC = *font->face->table.VARC;
146+
auto &VARC = *font->face->table.VARC->table;
146147
auto &varStore = &VARC+VARC.varStore;
147-
auto instancer = MultiItemVarStoreInstancer(&varStore, nullptr, coords, cache);
148148

149149
#define READ_UINT32VAR(name) \
150150
HB_STMT_START { \
@@ -187,22 +187,25 @@ VarComponent::get_path_at (hb_font_t *font,
187187
unsigned conditionIndex;
188188
READ_UINT32VAR (conditionIndex);
189189
const auto &condition = (&VARC+VARC.conditionList)[conditionIndex];
190+
auto instancer = MultiItemVarStoreInstancer(&varStore, nullptr, coords, cache);
190191
show = condition.evaluate (coords.arrayZ, coords.length, &instancer);
191192
}
192193

193194
// Axis values
194195

195-
hb_vector_t<unsigned> axisIndices;
196-
hb_vector_t<float> axisValues;
196+
auto &axisIndices = scratch.axisIndices;
197+
axisIndices.clear ();
198+
auto &axisValues = scratch.axisValues;
199+
axisValues.clear ();
197200
if (flags & (unsigned) flags_t::HAVE_AXES)
198201
{
199202
unsigned axisIndicesIndex;
200203
READ_UINT32VAR (axisIndicesIndex);
201-
axisIndices = (&VARC+VARC.axisIndicesList)[axisIndicesIndex];
204+
axisIndices.extend ((&VARC+VARC.axisIndicesList)[axisIndicesIndex]);
202205
axisValues.resize (axisIndices.length);
203206
const HBUINT8 *p = (const HBUINT8 *) record;
204207
TupleValues::decompile (p, axisValues, (const HBUINT8 *) end);
205-
record += (const unsigned char *) p - record;
208+
record = (const unsigned char *) p;
206209
}
207210

208211
// Apply variations if any
@@ -319,7 +322,8 @@ VarComponent::get_path_at (hb_font_t *font,
319322
VARC.get_path_at (font, gid,
320323
draw_session, component_coords, total_transform,
321324
parent_gid,
322-
decycler, edges_left, depth_left - 1);
325+
decycler, edges_left, depth_left - 1,
326+
scratch);
323327
}
324328

325329
#undef PROCESS_TRANSFORM_COMPONENTS
@@ -337,7 +341,8 @@ VARC::get_path_at (hb_font_t *font,
337341
hb_codepoint_t parent_glyph,
338342
hb_decycler_t *decycler,
339343
signed *edges_left,
340-
signed depth_left) const
344+
signed depth_left,
345+
hb_glyf_scratch_t &scratch) const
341346
{
342347
// Don't recurse on the same glyph.
343348
unsigned idx = glyph == parent_glyph ?
@@ -354,7 +359,7 @@ VARC::get_path_at (hb_font_t *font,
354359
hb_draw_session_t transformer_session {transformer_funcs, &context};
355360
hb_draw_session_t &shape_draw_session = transform.is_identity () ? draw_session : transformer_session;
356361

357-
if (!font->face->table.glyf->get_path_at (font, glyph, shape_draw_session, coords))
362+
if (!font->face->table.glyf->get_path_at (font, glyph, shape_draw_session, coords, scratch))
358363
#ifndef HB_NO_CFF
359364
if (!font->face->table.cff2->get_path_at (font, glyph, shape_draw_session, coords))
360365
if (!font->face->table.cff1->get_path (font, glyph, shape_draw_session)) // Doesn't have variations
@@ -376,19 +381,19 @@ VARC::get_path_at (hb_font_t *font,
376381

377382
hb_ubytes_t record = (this+glyphRecords)[idx];
378383

379-
VarRegionList::cache_t *cache = record.length >= 64 ? // Heuristic
380-
(this+varStore).create_cache ()
381-
: nullptr;
384+
float static_cache[sizeof (void *) * 16];
385+
VarRegionList::cache_t *cache = (this+varStore).create_cache (hb_array (static_cache));
382386

383387
transform.scale (font->x_multf, font->y_multf);
384388

385389
VarCompositeGlyph::get_path_at (font, glyph,
386390
draw_session, coords, transform,
387391
record,
388392
decycler, edges_left, depth_left,
393+
scratch,
389394
cache);
390395

391-
(this+varStore).destroy_cache (cache);
396+
(this+varStore).destroy_cache (cache, hb_array (static_cache));
392397

393398
return true;
394399
}

src/OT/Var/VARC/VARC.hh

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct VarComponent
5353
hb_decycler_t *decycler,
5454
signed *edges_left,
5555
signed depth_left,
56+
hb_glyf_scratch_t &scratch,
5657
VarRegionList::cache_t *cache = nullptr) const;
5758
};
5859

@@ -68,6 +69,7 @@ struct VarCompositeGlyph
6869
hb_decycler_t *decycler,
6970
signed *edges_left,
7071
signed depth_left,
72+
hb_glyf_scratch_t &scratch,
7173
VarRegionList::cache_t *cache = nullptr)
7274
{
7375
while (record)
@@ -76,7 +78,7 @@ struct VarCompositeGlyph
7678
record = comp.get_path_at (font, glyph,
7779
draw_session, coords, transform,
7880
record,
79-
decycler, edges_left, depth_left, cache);
81+
decycler, edges_left, depth_left, scratch, cache);
8082
}
8183
}
8284
};
@@ -98,10 +100,14 @@ struct VARC
98100
hb_codepoint_t parent_glyph,
99101
hb_decycler_t *decycler,
100102
signed *edges_left,
101-
signed depth_left) const;
103+
signed depth_left,
104+
hb_glyf_scratch_t &scratch) const;
102105

103106
bool
104-
get_path (hb_font_t *font, hb_codepoint_t gid, hb_draw_session_t &draw_session) const
107+
get_path (hb_font_t *font,
108+
hb_codepoint_t gid,
109+
hb_draw_session_t &draw_session,
110+
hb_glyf_scratch_t &scratch) const
105111
{
106112
hb_decycler_t decycler;
107113
signed edges = HB_MAX_GRAPH_EDGE_COUNT;
@@ -114,7 +120,9 @@ struct VARC
114120
HB_CODEPOINT_INVALID,
115121
&decycler,
116122
&edges,
117-
HB_MAX_NESTING_LEVEL); }
123+
HB_MAX_NESTING_LEVEL,
124+
scratch);
125+
}
118126

119127
bool sanitize (hb_sanitize_context_t *c) const
120128
{
@@ -129,6 +137,63 @@ struct VARC
129137
glyphRecords.sanitize (c, this));
130138
}
131139

140+
struct accelerator_t
141+
{
142+
friend struct VarComponent;
143+
144+
accelerator_t (hb_face_t *face)
145+
{
146+
table = hb_sanitize_context_t ().reference_table<VARC> (face);
147+
}
148+
~accelerator_t ()
149+
{
150+
auto *scratch = cached_scratch.get_relaxed ();
151+
if (scratch)
152+
{
153+
scratch->~hb_glyf_scratch_t ();
154+
hb_free (scratch);
155+
}
156+
157+
table.destroy ();
158+
}
159+
160+
bool
161+
get_path (hb_font_t *font, hb_codepoint_t gid, hb_draw_session_t &draw_session) const
162+
{
163+
if (!table->has_data ()) return false;
164+
165+
hb_glyf_scratch_t *scratch;
166+
167+
// Borrow the cached strach buffer.
168+
{
169+
scratch = cached_scratch.get_acquire ();
170+
if (!scratch || unlikely (!cached_scratch.cmpexch (scratch, nullptr)))
171+
{
172+
scratch = (hb_glyf_scratch_t *) hb_calloc (1, sizeof (hb_glyf_scratch_t));
173+
if (unlikely (!scratch))
174+
return true;
175+
}
176+
}
177+
178+
bool ret = table->get_path (font, gid, draw_session, *scratch);
179+
180+
// Put it back.
181+
if (!cached_scratch.cmpexch (nullptr, scratch))
182+
{
183+
scratch->~hb_glyf_scratch_t ();
184+
hb_free (scratch);
185+
}
186+
187+
return ret;
188+
}
189+
190+
private:
191+
hb_blob_ptr_t<VARC> table;
192+
hb_atomic_ptr_t<hb_glyf_scratch_t> cached_scratch;
193+
};
194+
195+
bool has_data () const { return version.major != 0; }
196+
132197
protected:
133198
FixedVersion<> version; /* Version identifier */
134199
Offset32To<Coverage> coverage;
@@ -140,6 +205,10 @@ struct VARC
140205
DEFINE_SIZE_STATIC (24);
141206
};
142207

208+
struct VARC_accelerator_t : VARC::accelerator_t {
209+
VARC_accelerator_t (hb_face_t *face) : VARC::accelerator_t (face) {}
210+
};
211+
143212
#endif
144213

145214
//}

0 commit comments

Comments
 (0)