From 91a174f151f20ede983eb879fc62631f83919098 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 24 Jan 2023 11:27:35 -0700 Subject: [PATCH] [hb-view] Hide --annotate and make it alias for --show-extents --- util/helper-cairo.hh | 2 +- util/view-cairo.hh | 13 ++++--------- util/view-options.hh | 10 ++-------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh index 91fb87379..d931d1b70 100644 --- a/util/helper-cairo.hh +++ b/util/helper-cairo.hh @@ -524,7 +524,7 @@ helper_cairo_create_context (double w, double h, if (content == CAIRO_CONTENT_ALPHA) { - if (view_opts->annotate || + if (view_opts->show_extents || br != bg || bg != bb || fr != fg || fg != fb) content = CAIRO_CONTENT_COLOR; diff --git a/util/view-cairo.hh b/util/view-cairo.hh index cdce2a1f7..d737b85dd 100644 --- a/util/view-cairo.hh +++ b/util/view-cairo.hh @@ -168,13 +168,12 @@ view_cairo_t::render (const font_options_t *font_opts) cairo_translate (cr, -vert * leading, +horiz * leading); - if (annotate) + if (show_extents) { cairo_save (cr); - /* Draw actual glyph origins */ cairo_set_source_rgba (cr, 1., 0., 0., .5); - cairo_set_line_width (cr, 5); + cairo_set_line_width (cr, 10); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); for (unsigned i = 0; i < l.num_glyphs; i++) { cairo_move_to (cr, l.glyphs[i].x, l.glyphs[i].y); @@ -183,14 +182,10 @@ view_cairo_t::render (const font_options_t *font_opts) cairo_stroke (cr); cairo_restore (cr); - } - if (show_extents) - { cairo_save (cr); - /* Draw actual glyph origins */ - cairo_set_source_rgba (cr, .5, .5, .5, 1.); - cairo_set_line_width (cr, 2); + cairo_set_source_rgba (cr, 1., 0., 1., .5); + cairo_set_line_width (cr, 3); for (unsigned i = 0; i < l.num_glyphs; i++) { hb_glyph_extents_t hb_extents; diff --git a/util/view-options.hh b/util/view-options.hh index d5c3cdde7..9d89802f0 100644 --- a/util/view-options.hh +++ b/util/view-options.hh @@ -44,13 +44,6 @@ struct view_options_t void add_options (option_parser_t *parser); - void post_parse (GError **error) - { - if (annotate) - show_extents = true; - } - - hb_bool_t annotate = false; char *fore = nullptr; char *back = nullptr; unsigned int palette = 0; @@ -115,7 +108,8 @@ view_options_t::add_options (option_parser_t *parser) { GOptionEntry entries[] = { - {"annotate", 0, 0, G_OPTION_ARG_NONE, &this->annotate, "Annotate output rendering", nullptr}, + {"annotate", 0, G_OPTION_FLAG_HIDDEN, + G_OPTION_ARG_NONE, &this->show_extents, "Annotate output rendering", nullptr}, {"background", 0, 0, G_OPTION_ARG_STRING, &this->back, "Set background color (default: " DEFAULT_BACK ")", "rrggbb/rrggbbaa"}, {"foreground", 0, 0, G_OPTION_ARG_STRING, &this->fore, "Set foreground color (default: " DEFAULT_FORE ")", "rrggbb/rrggbbaa"}, {"font-palette", 0, 0, G_OPTION_ARG_INT, &this->palette, "Set font palette (default: 0)", "index"},