mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-23 07:51:10 +01:00
[util] Include serialization in hb-subset iterations (#6580)
hb-subset serialized only the final face, leaving serialization out of the repeated work measured by --num-iterations. Reference each subset face's blob inside the loop, releasing the previous blob on the next iteration and writing the final blob once. Tested with meson test -C build: 299 passed, 1 skipped. Also checked identical output for one and three iterations with and without preprocessing, plus zero iterations and invalid-font handling. Assisted-by: Codex
This commit is contained in:
1 parent
2823aad36c
commit
fcebeeba60
1 file changed
+4
-4
+4
-4
@@ -119,22 +119,22 @@ struct subset_main_t : option_parser_t, face_options_t, output_options_t<false>
|
||||
}
|
||||
|
||||
hb_face_t *new_face = nullptr;
|
||||
hb_blob_t *result = nullptr;
|
||||
for (unsigned i = 0; i < num_iterations; i++)
|
||||
{
|
||||
hb_blob_destroy (result);
|
||||
hb_face_destroy (new_face);
|
||||
new_face = hb_subset_or_fail (orig_face, input);
|
||||
result = new_face ? hb_face_reference_blob (new_face) : nullptr;
|
||||
}
|
||||
|
||||
bool success = new_face;
|
||||
if (success)
|
||||
{
|
||||
hb_blob_t *result = hb_face_reference_blob (new_face);
|
||||
write_file (output_file, result);
|
||||
hb_blob_destroy (result);
|
||||
}
|
||||
else if (hb_face_get_glyph_count (orig_face) == 0)
|
||||
fail (false, "Invalid font file.");
|
||||
|
||||
hb_blob_destroy (result);
|
||||
hb_face_destroy (new_face);
|
||||
|
||||
return success ? 0 : 1;
|
||||
|
||||
Reference in new issue
Block a user