summaryrefslogtreecommitdiff
path: root/util/view-cairo.hh
diff options
context:
space:
mode:
Diffstat (limited to 'util/view-cairo.hh')
-rw-r--r--util/view-cairo.hh19
1 files changed, 13 insertions, 6 deletions
diff --git a/util/view-cairo.hh b/util/view-cairo.hh
index c621984..cb52373 100644
--- a/util/view-cairo.hh
+++ b/util/view-cairo.hh
@@ -31,10 +31,13 @@
#define VIEW_CAIRO_HH
-struct view_cairo_t {
+struct view_cairo_t
+{
view_cairo_t (option_parser_t *parser)
- : output_options (parser),
- view_options (parser) {}
+ : output_options (parser, helper_cairo_supported_formats),
+ view_options (parser),
+ direction (HB_DIRECTION_INVALID),
+ lines (0), scale_bits (0) {}
~view_cairo_t (void) {
if (debug)
cairo_debug_reset_static_data ();
@@ -43,7 +46,7 @@ struct view_cairo_t {
void init (const font_options_t *font_opts)
{
lines = g_array_new (false, false, sizeof (helper_cairo_line_t));
- scale = double (view_options.font_size) / hb_face_get_upem (hb_font_get_face (font_opts->get_font ()));
+ scale_bits = -font_opts->subpixel_bits;
}
void new_line (void)
{
@@ -68,7 +71,7 @@ struct view_cairo_t {
{
direction = hb_buffer_get_direction (buffer);
helper_cairo_line_t l;
- helper_cairo_line_from_buffer (&l, buffer, text, text_len, scale, utf8_clusters);
+ helper_cairo_line_from_buffer (&l, buffer, text, text_len, scale_bits, utf8_clusters);
g_array_append_val (lines, l);
}
void finish (const font_options_t *font_opts)
@@ -79,7 +82,11 @@ struct view_cairo_t {
helper_cairo_line_t &line = g_array_index (lines, helper_cairo_line_t, i);
line.finish ();
}
+#if GLIB_CHECK_VERSION (2, 22, 0)
g_array_unref (lines);
+#else
+ g_array_free (lines, TRUE);
+#endif
}
protected:
@@ -93,7 +100,7 @@ struct view_cairo_t {
hb_direction_t direction; // Remove this, make segment_properties accessible
GArray *lines;
- double scale;
+ int scale_bits;
};
#endif