mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 15:01:01 +01:00
[util/gpu] Fold the handful of used view options into the GPU group
hb-gpu only honors four of view_options_t's eleven options (--foreground, --background, --font-palette, --custom-palette). Exposing the full set via --help-view misled users into trying --stroke, --margin, --rainbow, etc., which silently did nothing. Merge the four relevant entries into the GPU option group (pointing at view_options_t's storage fields) and delegate parsing to view.post_parse() via a new gpu_output_t::post_parse. Drops the unused view entries from --help while keeping all the color/palette parsing logic shared with hb-view / hb-raster. Assisted-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
ed9bdd1031
commit
bb64f2cb30
1 file changed
+15
-3
+15
-3
@@ -86,6 +86,14 @@ struct gpu_output_t
|
||||
{"draw", 0, 0, G_OPTION_ARG_NONE, &this->force_draw, "Force monochrome draw path", nullptr},
|
||||
{"paint", 0, 0, G_OPTION_ARG_NONE, &this->force_paint, "Force color paint path", nullptr},
|
||||
{"output-file", 'o', 0, G_OPTION_ARG_STRING, &this->output_file, "Render one frame to PPM file (\"-\" for stdout) and exit","filename"},
|
||||
/* Reuse the storage in `view` for the four options hb-gpu
|
||||
* actually honors. view_options_t::post_parse() does the
|
||||
* parsing for us; gpu_output_t::post_parse() below forwards
|
||||
* to it. */
|
||||
{"background", 0, 0, G_OPTION_ARG_STRING, &this->view.back, "Set background color (default: " DEFAULT_BACK ")","rrggbb/rrggbbaa"},
|
||||
{"foreground", 0, 0, G_OPTION_ARG_STRING, &this->view.fore, "Set foreground color (default: " DEFAULT_FORE ")","rrggbb/rrggbbaa"},
|
||||
{"font-palette", 0, 0, G_OPTION_ARG_INT, &this->view.palette, "Set font palette (default: 0)", "index"},
|
||||
{"custom-palette",0, 0, G_OPTION_ARG_STRING, &this->view.custom_palette, "Custom palette", "comma-separated colors"},
|
||||
#ifdef __APPLE__
|
||||
{"metal", 0, 0, G_OPTION_ARG_NONE, &this->use_metal, "Use Metal renderer", nullptr},
|
||||
#endif
|
||||
@@ -98,10 +106,14 @@ struct gpu_output_t
|
||||
"gpu",
|
||||
"GPU options:",
|
||||
"Options for GPU rendering",
|
||||
this,
|
||||
false);
|
||||
this);
|
||||
}
|
||||
|
||||
view.add_options (parser);
|
||||
void post_parse (GError **error)
|
||||
{
|
||||
/* Delegate to view_options_t: parses foreground / background
|
||||
* / custom-palette strings into rgba_color_t / GArray. */
|
||||
view.post_parse (error);
|
||||
}
|
||||
|
||||
template <typename app_t>
|
||||
|
||||
Reference in new issue
Block a user