summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2010-10-21 13:52:33 +0200
committerUli Schlachter <psychon@znc.in>2010-10-21 22:20:12 +0200
commit6bfe71124b56b496056b77b3b51eef4d656ccf54 (patch)
treed80c9c2ecf7075367554500505c46283d2af5824
parentfae88051c18722566d15b96a1b23bfde1844c3ee (diff)
font options: Add private round_glpyh_positions field
Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r--src/cairo-font-options.c49
-rw-r--r--src/cairo-surface.c3
-rw-r--r--src/cairo-types-private.h7
-rw-r--r--src/cairoint.h7
4 files changed, 63 insertions, 3 deletions
diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c
index b472a301..5d59fb0f 100644
--- a/src/cairo-font-options.c
+++ b/src/cairo-font-options.c
@@ -54,7 +54,8 @@ static const cairo_font_options_t _cairo_font_options_nil = {
CAIRO_SUBPIXEL_ORDER_DEFAULT,
CAIRO_LCD_FILTER_DEFAULT,
CAIRO_HINT_STYLE_DEFAULT,
- CAIRO_HINT_METRICS_DEFAULT
+ CAIRO_HINT_METRICS_DEFAULT,
+ CAIRO_ROUND_GLYPH_POS_DEFAULT
};
/**
@@ -71,6 +72,7 @@ _cairo_font_options_init_default (cairo_font_options_t *options)
options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
options->hint_style = CAIRO_HINT_STYLE_DEFAULT;
options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
+ options->round_glyph_positions = CAIRO_ROUND_GLYPH_POS_DEFAULT;
}
void
@@ -82,6 +84,7 @@ _cairo_font_options_init_copy (cairo_font_options_t *options,
options->lcd_filter = other->lcd_filter;
options->hint_style = other->hint_style;
options->hint_metrics = other->hint_metrics;
+ options->round_glyph_positions = other->round_glyph_positions;
}
/**
@@ -211,6 +214,8 @@ cairo_font_options_merge (cairo_font_options_t *options,
options->hint_style = other->hint_style;
if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT)
options->hint_metrics = other->hint_metrics;
+ if (other->round_glyph_positions != CAIRO_ROUND_GLYPH_POS_DEFAULT)
+ options->round_glyph_positions = other->round_glyph_positions;
}
slim_hidden_def (cairo_font_options_merge);
@@ -241,7 +246,8 @@ cairo_font_options_equal (const cairo_font_options_t *options,
options->subpixel_order == other->subpixel_order &&
options->lcd_filter == other->lcd_filter &&
options->hint_style == other->hint_style &&
- options->hint_metrics == other->hint_metrics);
+ options->hint_metrics == other->hint_metrics &&
+ options->round_glyph_positions == other->round_glyph_positions);
}
slim_hidden_def (cairo_font_options_equal);
@@ -390,6 +396,45 @@ _cairo_font_options_get_lcd_filter (const cairo_font_options_t *options)
}
/**
+ * _cairo_font_options_set_round_glyph_positions:
+ * @options: a #cairo_font_options_t
+ * @round: the new rounding value
+ *
+ * Sets the rounding options for the font options object. If rounding is set, a
+ * glyph's position will be rounded to integer values.
+ *
+ * Since: 1.12
+ **/
+void
+_cairo_font_options_set_round_glyph_positions (cairo_font_options_t *options,
+ cairo_round_glyph_positions_t round)
+{
+ if (cairo_font_options_status (options))
+ return;
+
+ options->round_glyph_positions = round;
+}
+
+/**
+ * _cairo_font_options_get_round_glyph_positions:
+ * @options: a #cairo_font_options_t
+ *
+ * Gets the glyph position rounding option for the font options object.
+ *
+ * Return value: The round glyph posistions flag for the font options object.
+ *
+ * Since: 1.12
+ **/
+cairo_round_glyph_positions_t
+_cairo_font_options_get_round_glyph_positions (const cairo_font_options_t *options)
+{
+ if (cairo_font_options_status ((cairo_font_options_t *) options))
+ return CAIRO_ROUND_GLYPH_POS_DEFAULT;
+
+ return options->round_glyph_positions;
+}
+
+/**
* cairo_font_options_set_hint_style:
* @options: a #cairo_font_options_t
* @hint_style: the new hint style
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index ba70a2ec..2293991f 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -123,7 +123,8 @@ const cairo_surface_t name = { \
CAIRO_SUBPIXEL_ORDER_DEFAULT, /* subpixel_order */ \
CAIRO_LCD_FILTER_DEFAULT, /* lcd_filter */ \
CAIRO_HINT_STYLE_DEFAULT, /* hint_style */ \
- CAIRO_HINT_METRICS_DEFAULT /* hint_metrics */ \
+ CAIRO_HINT_METRICS_DEFAULT, /* hint_metrics */ \
+ CAIRO_ROUND_GLYPH_POS_DEFAULT /* round_glyph_positions */ \
} /* font_options */ \
}
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index ac3fda82..93b035d7 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -161,12 +161,19 @@ typedef enum _cairo_lcd_filter {
CAIRO_LCD_FILTER_FIR5
} cairo_lcd_filter_t;
+typedef enum _cairo_round_glyph_positions {
+ CAIRO_ROUND_GLYPH_POS_DEFAULT,
+ CAIRO_ROUND_GLYPH_POS_ON,
+ CAIRO_ROUND_GLYPH_POS_OFF
+} cairo_round_glyph_positions_t;
+
struct _cairo_font_options {
cairo_antialias_t antialias;
cairo_subpixel_order_t subpixel_order;
cairo_lcd_filter_t lcd_filter;
cairo_hint_style_t hint_style;
cairo_hint_metrics_t hint_metrics;
+ cairo_round_glyph_positions_t round_glyph_positions;
};
/* XXX: Right now, the _cairo_color structure puts unpremultiplied
diff --git a/src/cairoint.h b/src/cairoint.h
index e3582ec3..346fc51f 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1088,6 +1088,13 @@ _cairo_font_options_set_lcd_filter (cairo_font_options_t *options,
cairo_private cairo_lcd_filter_t
_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options);
+cairo_private void
+_cairo_font_options_set_round_glyph_positions (cairo_font_options_t *options,
+ cairo_round_glyph_positions_t round);
+
+cairo_private cairo_round_glyph_positions_t
+_cairo_font_options_get_round_glyph_positions (const cairo_font_options_t *options);
+
/* cairo-hull.c */
cairo_private cairo_status_t
_cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);