[hb-view] Hide --annotate and make it alias for --show-extents

This commit is contained in:
Behdad Esfahbod 2023-01-24 11:27:35 -07:00
parent 8cfb0ed072
commit 91a174f151
3 changed files with 7 additions and 18 deletions

View File

@ -524,7 +524,7 @@ helper_cairo_create_context (double w, double h,
if (content == CAIRO_CONTENT_ALPHA) if (content == CAIRO_CONTENT_ALPHA)
{ {
if (view_opts->annotate || if (view_opts->show_extents ||
br != bg || bg != bb || br != bg || bg != bb ||
fr != fg || fg != fb) fr != fg || fg != fb)
content = CAIRO_CONTENT_COLOR; content = CAIRO_CONTENT_COLOR;

View File

@ -168,13 +168,12 @@ view_cairo_t::render (const font_options_t *font_opts)
cairo_translate (cr, -vert * leading, +horiz * leading); cairo_translate (cr, -vert * leading, +horiz * leading);
if (annotate) if (show_extents)
{ {
cairo_save (cr); cairo_save (cr);
/* Draw actual glyph origins */
cairo_set_source_rgba (cr, 1., 0., 0., .5); 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); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
for (unsigned i = 0; i < l.num_glyphs; i++) { for (unsigned i = 0; i < l.num_glyphs; i++) {
cairo_move_to (cr, l.glyphs[i].x, l.glyphs[i].y); 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_stroke (cr);
cairo_restore (cr); cairo_restore (cr);
}
if (show_extents)
{
cairo_save (cr); cairo_save (cr);
/* Draw actual glyph origins */ cairo_set_source_rgba (cr, 1., 0., 1., .5);
cairo_set_source_rgba (cr, .5, .5, .5, 1.); cairo_set_line_width (cr, 3);
cairo_set_line_width (cr, 2);
for (unsigned i = 0; i < l.num_glyphs; i++) for (unsigned i = 0; i < l.num_glyphs; i++)
{ {
hb_glyph_extents_t hb_extents; hb_glyph_extents_t hb_extents;

View File

@ -44,13 +44,6 @@ struct view_options_t
void add_options (option_parser_t *parser); 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 *fore = nullptr;
char *back = nullptr; char *back = nullptr;
unsigned int palette = 0; unsigned int palette = 0;
@ -115,7 +108,8 @@ view_options_t::add_options (option_parser_t *parser)
{ {
GOptionEntry entries[] = 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"}, {"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"}, {"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"}, {"font-palette", 0, 0, G_OPTION_ARG_INT, &this->palette, "Set font palette (default: 0)", "index"},