summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-03 16:01:54 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-08-03 16:30:23 -0400
commit3ef436bf8df0890280547ae392be03e4789a8a89 (patch)
tree43d7920950b51d0c968cf78a8e87a94568c66526 /utils
parent7d3e528978ee1a1b5f1e12eaa09ad13fa8b13606 (diff)
downloadpango-3ef436bf8df0890280547ae392be03e4789a8a89.tar.gz
pango-view: Add a --subpixel-positions option
This lets us explore the influence of subpixel positioning in various contexts without relying on gtk applications.
Diffstat (limited to 'utils')
-rw-r--r--utils/viewer-pangocairo.c4
-rw-r--r--utils/viewer-render.c3
-rw-r--r--utils/viewer-render.h1
3 files changed, 8 insertions, 0 deletions
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index f82bd72d..ac3b49c3 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -36,6 +36,7 @@ typedef struct
PangoFontMap *fontmap;
cairo_font_options_t *font_options;
+ gboolean subpixel_positions;
} CairoViewer;
static gpointer
@@ -73,6 +74,8 @@ pangocairo_view_create (const PangoViewer *klass G_GNUC_UNUSED)
if (opt_antialias != ANTIALIAS_DEFAULT)
cairo_font_options_set_antialias (instance->font_options, (cairo_antialias_t)opt_antialias);
+ instance->subpixel_positions = opt_subpixel_positions;
+
return instance;
}
@@ -100,6 +103,7 @@ pangocairo_view_get_context (gpointer instance)
context = pango_font_map_create_context (c->fontmap);
pango_cairo_context_set_font_options (context, c->font_options);
+ pango_context_set_round_glyph_positions (context, !c->subpixel_positions);
return context;
}
diff --git a/utils/viewer-render.c b/utils/viewer-render.c
index 36cee596..82b30f05 100644
--- a/utils/viewer-render.c
+++ b/utils/viewer-render.c
@@ -63,6 +63,7 @@ HintMode opt_hinting = HINT_DEFAULT;
HintMetrics opt_hint_metrics = HINT_METRICS_DEFAULT;
SubpixelOrder opt_subpixel_order = SUBPIXEL_DEFAULT;
Antialias opt_antialias = ANTIALIAS_DEFAULT;
+gboolean opt_subpixel_positions = FALSE;
PangoWrapMode opt_wrap = PANGO_WRAP_WORD_CHAR;
gboolean opt_wrap_set = FALSE;
static const char *opt_pangorc = NULL; /* Unused */
@@ -800,6 +801,8 @@ parse_options (int argc, char *argv[])
"Antialiasing", "none/gray/subpixel"},
{"hint-metrics", 0, 0, G_OPTION_ARG_CALLBACK, &parse_hint_metrics,
"Hint metrics", "on/off"},
+ { "subpixel-positions", 0, 0, G_OPTION_ARG_NONE, &opt_subpixel_positions,
+ "Subpixel positioning", NULL},
{"subpixel-order", 0, 0, G_OPTION_ARG_CALLBACK, &parse_subpixel_order,
"Subpixel order", "rgb/bgr/vrgb/vbgr"},
{"indent", 0, 0, G_OPTION_ARG_INT, &opt_indent,
diff --git a/utils/viewer-render.h b/utils/viewer-render.h
index bfb50e55..3ffc42e4 100644
--- a/utils/viewer-render.h
+++ b/utils/viewer-render.h
@@ -107,6 +107,7 @@ extern HintMode opt_hinting;
extern SubpixelOrder opt_subpixel_order;
extern Antialias opt_antialias;
extern HintMetrics opt_hint_metrics;
+extern gboolean opt_subpixel_positions;
extern PangoColor opt_fg_color;
extern guint16 opt_fg_alpha;
extern gboolean opt_bg_set;