[pango/round-glyphs-option: 3/5] pango-view: Add a --subpixel-positions option
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/round-glyphs-option: 3/5] pango-view: Add a --subpixel-positions option
- Date: Sat, 3 Aug 2019 20:30:44 +0000 (UTC)
commit 3ef436bf8df0890280547ae392be03e4789a8a89
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Aug 3 16:01:54 2019 -0400
pango-view: Add a --subpixel-positions option
This lets us explore the influence of subpixel
positioning in various contexts without relying
on gtk applications.
utils/viewer-pangocairo.c | 4 ++++
utils/viewer-render.c | 3 +++
utils/viewer-render.h | 1 +
3 files changed, 8 insertions(+)
---
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]