diff options
author | Thomas White <taw@bitwiz.org.uk> | 2013-03-03 13:48:00 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2013-03-03 13:48:00 +0100 |
commit | 8fc78cc84efb13dcc10c633eec3ed3cc3e320d30 (patch) | |
tree | 3150b9dfffca17e67840f578f3debe856b0913ce | |
parent | b12ef708fe327a892412fcf62ced42fd046c16c0 (diff) |
Use pango_units_to_double()
-rw-r--r-- | src/render.c | 11 | ||||
-rw-r--r-- | src/wrap.c | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/render.c b/src/render.c index 8fb14d6..ef98e07 100644 --- a/src/render.c +++ b/src/render.c @@ -44,7 +44,7 @@ static void render_glyph_box(cairo_t *cr, struct wrap_box *box) { cairo_new_path(cr); - cairo_move_to(cr, 0.0, box->ascent/PANGO_SCALE); + cairo_move_to(cr, 0.0, pango_units_to_double(box->ascent)); if ( box->glyphs == NULL ) { fprintf(stderr, "Box %p has NULL pointer.\n", box); return; @@ -54,7 +54,8 @@ static void render_glyph_box(cairo_t *cr, struct wrap_box *box) box->col[3]); cairo_fill(cr); - cairo_rectangle(cr, 0.0, 0.0, box->width/PANGO_SCALE, box->height/PANGO_SCALE); + cairo_rectangle(cr, 0.0, 0.0, pango_units_to_double(box->width), + pango_units_to_double(box->height)); cairo_set_source_rgb(cr, 1.0, 0.0, 0.0); cairo_set_line_width(cr, 0.1); cairo_stroke(cr); @@ -87,7 +88,7 @@ static void render_boxes(struct wrap_line *line, cairo_t *cr) } - x_pos += (double)line->boxes[j].width / PANGO_SCALE; + x_pos += pango_units_to_double(line->boxes[j].width); cairo_restore(cr); @@ -102,7 +103,7 @@ static void render_lines(struct frame *fr, cairo_t *cr) for ( i=0; i<fr->n_lines; i++ ) { - double asc = fr->lines[i].ascent/PANGO_SCALE; + double asc = pango_units_to_double(fr->lines[i].ascent); cairo_move_to(cr, 0, y_pos+asc+0.5); cairo_line_to(cr, fr->lines[i].width, y_pos+asc+0.5); @@ -117,7 +118,7 @@ static void render_lines(struct frame *fr, cairo_t *cr) render_boxes(&fr->lines[i], cr); /* FIXME: line spacing */ - y_pos += fr->lines[i].height/PANGO_SCALE + 0.0; + y_pos += pango_units_to_double(fr->lines[i].height) + 0.0; } } @@ -93,7 +93,7 @@ void get_cursor_pos(struct frame *fr, size_t pos, break; } *yposd += fr->lines[i].height; - *line_height = fr->lines[i].height / PANGO_SCALE; + *line_height = pango_units_to_double(fr->lines[i].height); } assert(line >= 0); |