diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 1e67dbcb0..9c606a70d 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -1086,8 +1086,6 @@ hb_vector_draw_get_extents hb_vector_draw_set_glyph_extents hb_vector_draw_get_funcs hb_vector_draw_glyph -hb_vector_draw_set_flat -hb_vector_draw_get_flat hb_vector_draw_set_precision hb_vector_draw_get_precision hb_vector_draw_svg_set_prefix @@ -1117,8 +1115,6 @@ hb_vector_paint_set_custom_palette_color hb_vector_paint_clear_custom_palette_colors hb_vector_paint_get_funcs hb_vector_paint_glyph -hb_vector_paint_set_flat -hb_vector_paint_get_flat hb_vector_paint_set_precision hb_vector_paint_get_precision hb_vector_paint_svg_set_prefix diff --git a/src/hb-vector-draw.cc b/src/hb-vector-draw.cc index fe1d81015..ff5eea735 100644 --- a/src/hb-vector-draw.cc +++ b/src/hb-vector-draw.cc @@ -591,8 +591,7 @@ hb_vector_draw_glyph (hb_vector_draw_t *draw, case HB_VECTOR_FORMAT_SVG: { - bool needs_def = !draw->flat && !hb_set_has (draw->defined_glyphs, glyph); - if (needs_def) + if (!hb_set_has (draw->defined_glyphs, glyph)) { draw->path.clear (); hb_vector_svg_path_sink_t sink = {&draw->path, draw->precision}; @@ -609,34 +608,6 @@ hb_vector_draw_glyph (hb_vector_draw_t *draw, hb_set_add (draw->defined_glyphs, glyph); } - if (draw->flat) - { - draw->path.clear (); - hb_vector_svg_path_sink_t sink = {&draw->path, draw->precision}; - hb_font_draw_glyph (font, glyph, hb_vector_svg_path_draw_funcs_get (), &sink); - - if (!draw->path.length) - return false; - - float xx = draw->transform.xx; - float yx = draw->transform.yx; - float xy = draw->transform.xy; - float yy = draw->transform.yy; - float tx = draw->transform.x0 + xx * pen_x + xy * pen_y; - float ty = draw->transform.y0 + yx * pen_x + yy * pen_y; - - hb_buf_append_str (&draw->body, "body, draw->path.arrayZ, draw->path.length); - hb_buf_append_str (&draw->body, "\" transform=\""); - hb_vector_svg_append_instance_transform (&draw->body, - draw->precision, - draw->x_scale_factor, - draw->y_scale_factor, - xx, yx, xy, yy, tx, ty); - hb_buf_append_str (&draw->body, "\"/>\n"); - return true; - } - float xx = draw->transform.xx; float yx = draw->transform.yx; float xy = draw->transform.xy; @@ -663,39 +634,6 @@ hb_vector_draw_glyph (hb_vector_draw_t *draw, } } -/** - * hb_vector_draw_set_flat: - * @draw: a draw context. - * @flat: whether to flatten geometry and disable reuse. - * - * Enables or disables draw flattening. - * - * XSince: REPLACEME - */ -void -hb_vector_draw_set_flat (hb_vector_draw_t *draw, - hb_bool_t flat) -{ - draw->flat = !!flat; -} - -/** - * hb_vector_draw_get_flat: - * @draw: a draw context. - * - * Returns the flatten flag previously set on @draw, or `false` if - * none was set. - * - * Return value: the flatten flag. - * - * XSince: REPLACEME - */ -hb_bool_t -hb_vector_draw_get_flat (const hb_vector_draw_t *draw) -{ - return draw->flat; -} - /** * hb_vector_draw_svg_set_prefix: * @draw: a draw context. @@ -946,7 +884,7 @@ hb_vector_draw_render (hb_vector_draw_t *draw) * * Discards accumulated draw output so @draw can be reused for * another render. User configuration (transform, scale factors, - * precision, flat) is preserved. Call hb_vector_draw_reset() to + * precision) is preserved. Call hb_vector_draw_reset() to * also reset user configuration to defaults. * * XSince: REPLACEME @@ -977,7 +915,6 @@ hb_vector_draw_reset (hb_vector_draw_t *draw) draw->x_scale_factor = 1.f; draw->y_scale_factor = 1.f; draw->precision = 2; - draw->flat = false; hb_vector_draw_clear (draw); } diff --git a/src/hb-vector-draw.hh b/src/hb-vector-draw.hh index 50b728119..399e972c3 100644 --- a/src/hb-vector-draw.hh +++ b/src/hb-vector-draw.hh @@ -20,7 +20,6 @@ struct hb_vector_draw_t hb_vector_extents_t extents = {0, 0, 0, 0}; bool has_extents = false; unsigned precision = 2; - bool flat = false; hb_vector_t id_prefix; hb_vector_t defs; diff --git a/src/hb-vector-paint.cc b/src/hb-vector-paint.cc index 5ade3c541..76abdfa6d 100644 --- a/src/hb-vector-paint.cc +++ b/src/hb-vector-paint.cc @@ -1361,11 +1361,9 @@ hb_vector_paint_glyph (hb_vector_paint_t *paint, case HB_VECTOR_FORMAT_SVG: { - bool can_cache = !paint->flat; hb_vector_color_glyph_cache_key_t cache_key = hb_vector_color_glyph_cache_key (glyph, (unsigned) paint->palette, paint->foreground); - if (can_cache) { if (paint->defined_color_glyphs.has (cache_key)) { @@ -1385,7 +1383,6 @@ hb_vector_paint_glyph (hb_vector_paint_t *paint, } } - if (can_cache) { if (unlikely (!paint->group_stack.push_or_fail (hb_vector_t {}))) return false; @@ -1454,39 +1451,6 @@ hb_vector_paint_glyph (hb_vector_paint_t *paint, } } -/** - * hb_vector_paint_set_flat: - * @paint: a paint context. - * @flat: whether to flatten paint output and disable glyph-group reuse. - * - * Enables or disables paint flattening. - * - * XSince: REPLACEME - */ -void -hb_vector_paint_set_flat (hb_vector_paint_t *paint, - hb_bool_t flat) -{ - paint->flat = !!flat; -} - -/** - * hb_vector_paint_get_flat: - * @paint: a paint context. - * - * Returns the flatten flag previously set on @paint, or `false` if - * none was set. - * - * Return value: the flatten flag. - * - * XSince: REPLACEME - */ -hb_bool_t -hb_vector_paint_get_flat (const hb_vector_paint_t *paint) -{ - return paint->flat; -} - /** * hb_vector_paint_svg_set_prefix: * @paint: a paint context. @@ -1575,7 +1539,7 @@ hb_vector_paint_get_precision (const hb_vector_paint_t *paint) * * Discards accumulated paint output so @paint can be reused for * another render. User configuration (transform, scale factors, - * precision, flat, foreground, palette, custom palette colors) + * precision, foreground, palette, custom palette colors) * is preserved. Call hb_vector_paint_reset() to also reset * user configuration to defaults. * @@ -1699,7 +1663,6 @@ hb_vector_paint_reset (hb_vector_paint_t *paint) paint->foreground = HB_COLOR (0, 0, 0, 255); paint->palette = 0; paint->precision = 2; - paint->flat = false; hb_vector_paint_clear (paint); } diff --git a/src/hb-vector-paint.hh b/src/hb-vector-paint.hh index b3abcaeef..f62809dc7 100644 --- a/src/hb-vector-paint.hh +++ b/src/hb-vector-paint.hh @@ -51,7 +51,6 @@ struct hb_vector_paint_t int palette = 0; hb_hashmap_t custom_palette_colors; unsigned precision = 2; - bool flat = false; hb_vector_t id_prefix; hb_vector_t defs; diff --git a/src/hb-vector.h b/src/hb-vector.h index 978ce0d04..7d5c836f6 100644 --- a/src/hb-vector.h +++ b/src/hb-vector.h @@ -162,13 +162,6 @@ hb_vector_draw_glyph (hb_vector_draw_t *draw, float pen_y, hb_vector_extents_mode_t extents_mode); -HB_EXTERN void -hb_vector_draw_set_flat (hb_vector_draw_t *draw, - hb_bool_t flat); - -HB_EXTERN hb_bool_t -hb_vector_draw_get_flat (const hb_vector_draw_t *draw); - HB_EXTERN void hb_vector_draw_set_precision (hb_vector_draw_t *draw, unsigned precision); @@ -286,13 +279,6 @@ hb_vector_paint_glyph (hb_vector_paint_t *paint, float pen_y, hb_vector_extents_mode_t extents_mode); -HB_EXTERN void -hb_vector_paint_set_flat (hb_vector_paint_t *paint, - hb_bool_t flat); - -HB_EXTERN hb_bool_t -hb_vector_paint_get_flat (const hb_vector_paint_t *paint); - HB_EXTERN void hb_vector_paint_set_precision (hb_vector_paint_t *paint, unsigned precision); diff --git a/test/fuzzing/hb-vector-fuzzer.cc b/test/fuzzing/hb-vector-fuzzer.cc index 0efb874e5..3ed77ae35 100644 --- a/test/fuzzing/hb-vector-fuzzer.cc +++ b/test/fuzzing/hb-vector-fuzzer.cc @@ -6,8 +6,6 @@ static void exercise_format (const _fuzzing_shape_input_t *input, hb_vector_format_t format, unsigned precision, - bool flat_draw, - bool flat_paint, volatile unsigned *counter) { hb_vector_draw_t *draw = hb_vector_draw_create_or_fail (format); @@ -22,8 +20,6 @@ exercise_format (const _fuzzing_shape_input_t *input, hb_vector_draw_set_precision (draw, precision); hb_vector_paint_set_precision (paint, precision); - hb_vector_draw_set_flat (draw, flat_draw); - hb_vector_paint_set_flat (paint, flat_paint); unsigned glyph_count = hb_face_get_glyph_count (input->face); unsigned limit = glyph_count > 16 ? 16 : glyph_count; @@ -71,8 +67,6 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) return 0; unsigned precision = size ? data[size - 1] % 5 : 0; - bool flat_draw = size > 1 && (data[size - 2] & 1); - bool flat_paint = size > 2 && (data[size - 3] & 1); unsigned glyph_count = hb_face_get_glyph_count (input.face); volatile unsigned counter = !glyph_count; @@ -80,8 +74,8 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) /* Exercise both output formats. Each has its own serializer, path * encoder, gradient machinery, and (for PDF) indexed-PNG SMask + * Type 6 Coons-patch encoder. */ - exercise_format (&input, HB_VECTOR_FORMAT_SVG, precision, flat_draw, flat_paint, &counter); - exercise_format (&input, HB_VECTOR_FORMAT_PDF, precision, flat_draw, flat_paint, &counter); + exercise_format (&input, HB_VECTOR_FORMAT_SVG, precision, &counter); + exercise_format (&input, HB_VECTOR_FORMAT_PDF, precision, &counter); return counter ? 0 : 0; } diff --git a/test/vector/data/expected/basic/flat-cff1.svg b/test/vector/data/expected/basic/flat-cff1.svg deleted file mode 100644 index de0040ddc..000000000 --- a/test/vector/data/expected/basic/flat-cff1.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/test/vector/data/expected/basic/flat-precision-0.svg b/test/vector/data/expected/basic/flat-precision-0.svg deleted file mode 100644 index eabb07d73..000000000 --- a/test/vector/data/expected/basic/flat-precision-0.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/test/vector/data/expected/basic/flat-precision-4.svg b/test/vector/data/expected/basic/flat-precision-4.svg deleted file mode 100644 index 7cc0510a0..000000000 --- a/test/vector/data/expected/basic/flat-precision-4.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/test/vector/data/expected/basic/flat.svg b/test/vector/data/expected/basic/flat.svg deleted file mode 100644 index 7cc0510a0..000000000 --- a/test/vector/data/expected/basic/flat.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/test/vector/data/tests/basic.tests b/test/vector/data/tests/basic.tests index 4c03207d1..ba33a715c 100644 --- a/test/vector/data/tests/basic.tests +++ b/test/vector/data/tests/basic.tests @@ -1,13 +1,9 @@ # font-file;options;unicodes;expected-file ../../../api/fonts/Roboto-Regular.abc.ttf;;U+0061,U+0062,U+0063;../expected/basic/default.svg -../../../api/fonts/Roboto-Regular.abc.ttf;--flat;U+0061,U+0062,U+0063;../expected/basic/flat.svg ../../../api/fonts/Roboto-Regular.abc.ttf;--font-size=upem;U+0061,U+0062,U+0063;../expected/basic/upem-default.svg ../../../api/fonts/Roboto-Regular.abc.ttf;--direction=ttb;U+0061,U+0062,U+0063;../expected/basic/ttb.svg ../../../api/fonts/Roboto-Regular.abc.ttf;;U+0061,U+000A,U+0062,U+0063;../expected/basic/multiline.svg -../../../api/fonts/Roboto-Regular.abc.ttf;--flat --precision=0;U+0061,U+0062,U+0063;../expected/basic/flat-precision-0.svg -../../../api/fonts/Roboto-Regular.abc.ttf;--flat --precision=4;U+0061,U+0062,U+0063;../expected/basic/flat-precision-4.svg ../../../api/fonts/SourceSansPro-Regular.abc.otf;;U+0061,U+0062,U+0063;../expected/basic/cff1.svg -../../../api/fonts/SourceSansPro-Regular.abc.otf;--flat;U+0061,U+0062,U+0063;../expected/basic/flat-cff1.svg ../../../api/fonts/Roboto-Variable.abc.ttf;--variations=wght=900;U+0061,U+0062,U+0063;../expected/basic/glyf-var-wght900.svg ../../../api/fonts/TestCFF2VF.otf;--variations=wght=900;U+0061,U+0062,U+0063;../expected/basic/cff2-var-wght900.svg ../../../api/fonts/AdobeVFPrototype.abc.otf;--variations=wght=900,CNTR=100;U+0061,U+0062,U+0063;../expected/basic/cff2-var-cntr.svg diff --git a/util/vector-output.hh b/util/vector-output.hh index c1d22bf0c..543f23139 100644 --- a/util/vector-output.hh +++ b/util/vector-output.hh @@ -62,7 +62,6 @@ struct vector_output_t : output_options_t<>, view_options_t GOptionEntry entries[] = { - {"flat", 0, 0, G_OPTION_ARG_NONE, &this->flat, "Flatten geometry and disable reuse", nullptr}, {"precision", 0, 0, G_OPTION_ARG_INT, &this->precision, "Decimal precision (default: 2)", "N"}, {nullptr} }; @@ -207,7 +206,6 @@ struct vector_output_t : output_options_t<>, view_options_t hb_vector_draw_set_scale_factor (draw, 1.f, 1.f); hb_vector_draw_set_extents (draw, &extents); hb_vector_draw_set_precision (draw, precision); - hb_vector_draw_set_flat (draw, flat); if (paint) { @@ -218,7 +216,6 @@ struct vector_output_t : output_options_t<>, view_options_t apply_custom_palette (paint); init_palette_color_cache (); hb_vector_paint_set_precision (paint, precision); - hb_vector_paint_set_flat (paint, flat); } bool had_draw = false; @@ -1076,7 +1073,6 @@ struct vector_output_t : output_options_t<>, view_options_t if (gap) *gap = (float) fext.line_gap; } - hb_bool_t flat = false; int precision = 2; hb_color_t background = HB_COLOR (255, 255, 255, 255); hb_color_t foreground = HB_COLOR (0, 0, 0, 255);