diff --git a/util/options.cc b/util/options.cc index fe2feafb2..96d131fee 100644 --- a/util/options.cc +++ b/util/options.cc @@ -336,6 +336,7 @@ view_options_t::add_options (option_parser_t *parser) {"foreground", 0, 0, G_OPTION_ARG_STRING, &this->fore, "Set foreground color (default: "DEFAULT_FORE")", "red/#rrggbb/#rrggbbaa"}, {"line-space", 0, 0, G_OPTION_ARG_DOUBLE, &this->line_space, "Set space between lines (default: 0)", "units"}, {"margin", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_margin, "Margin around output (default: "G_STRINGIFY(DEFAULT_MARGIN)")","one to four numbers"}, + {"font-size", 0, 0, G_OPTION_ARG_DOUBLE, &this->font_size, "Font size (default: "G_STRINGIFY(DEFAULT_FONT_SIZE)")","size"}, {NULL} }; parser->add_group (entries, @@ -371,7 +372,6 @@ font_options_t::add_options (option_parser_t *parser) { {"font-file", 0, 0, G_OPTION_ARG_STRING, &this->font_file, "Font file-name", "filename"}, {"face-index", 0, 0, G_OPTION_ARG_INT, &this->face_index, "Face index (default: 0)", "index"}, - {"font-size", 0, 0, G_OPTION_ARG_DOUBLE, &this->font_size, "Font size (default: "G_STRINGIFY(DEFAULT_FONT_SIZE)")","size"}, {NULL} }; parser->add_group (entries, diff --git a/util/options.hh b/util/options.hh index a101f7d9d..e8747a6b2 100644 --- a/util/options.hh +++ b/util/options.hh @@ -77,6 +77,7 @@ struct option_parser_t #define DEFAULT_MARGIN 18 #define DEFAULT_FORE "#000000" #define DEFAULT_BACK "#FFFFFF" +#define DEFAULT_FONT_SIZE 36 struct view_options_t : option_group_t { @@ -86,6 +87,7 @@ struct view_options_t : option_group_t back = DEFAULT_BACK; line_space = 0; margin.t = margin.r = margin.b = margin.l = DEFAULT_MARGIN; + font_size = DEFAULT_FONT_SIZE; add_options (parser); } @@ -99,6 +101,7 @@ struct view_options_t : option_group_t struct margin_t { double t, r, b, l; } margin; + double font_size; }; @@ -142,14 +145,11 @@ struct shape_options_t : option_group_t }; -#define DEFAULT_FONT_SIZE 36 - struct font_options_t : option_group_t { font_options_t (option_parser_t *parser) { font_file = NULL; face_index = 0; - font_size = DEFAULT_FONT_SIZE; font = NULL; @@ -165,7 +165,6 @@ struct font_options_t : option_group_t const char *font_file; int face_index; - double font_size; private: mutable hb_font_t *font; diff --git a/util/view-cairo.cc b/util/view-cairo.cc index 9ca44c8f1..c6278f1cd 100644 --- a/util/view-cairo.cc +++ b/util/view-cairo.cc @@ -80,7 +80,7 @@ void view_cairo_t::init (const font_options_t *font_opts) { lines = g_array_new (FALSE, FALSE, sizeof (line_t)); - scale = double (font_opts->font_size) / hb_face_get_upem (hb_font_get_face (font_opts->get_font ())); + scale = double (font_size) / hb_face_get_upem (hb_font_get_face (font_opts->get_font ())); } void @@ -217,7 +217,7 @@ view_cairo_t::create_scaled_font (const font_options_t *font_opts) cairo_matrix_init_identity (&ctm); cairo_matrix_init_scale (&font_matrix, - font_opts->font_size, font_opts->font_size); + font_size, font_size); font_options = cairo_font_options_create (); cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);