From 8c842e4a44908cce0f416481c73dc0866a0a9c95 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 4 Dec 2016 20:28:38 -0800 Subject: [PATCH] [hb-fuzzer] Get glyph extents for output glyphs To exercise glyph-extents codepaths (glyf / CBLC+CBDT). --- test/fuzzing/hb-fuzzer.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/fuzzing/hb-fuzzer.cc b/test/fuzzing/hb-fuzzer.cc index b319a715a..c9f15d831 100644 --- a/test/fuzzing/hb-fuzzer.cc +++ b/test/fuzzing/hb-fuzzer.cc @@ -28,6 +28,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { hb_buffer_add_utf32(buffer, text32, sizeof(text32)/sizeof(text32[0]), 0, -1); hb_buffer_guess_segment_properties(buffer); hb_shape(font, buffer, NULL, 0); + + unsigned int len = hb_buffer_get_length (buffer); + hb_glyph_info_t *infos = hb_buffer_get_glyph_infos (buffer, NULL); + //hb_glyph_position_t *positions = hb_buffer_get_glyph_positions (buffer, NULL); + for (unsigned int i = 0; i < len; i++) + { + hb_glyph_info_t info = infos[i]; + //hb_glyph_position_t pos = positions[i]; + + hb_glyph_extents_t extents; + hb_font_get_glyph_extents (font, info.codepoint, &extents); + } + hb_buffer_destroy(buffer); }