The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Sharper text in text area

These changes was commited to the Birdfont repository Mon, 16 Mar 2015 21:38:20 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Mon, 16 Mar 2015 21:38:20 +0000]

Updated Files

libbirdfont/Renderer/Text.vala
libbirdfont/Renderer/TextArea.vala
--- a/libbirdfont/Renderer/Text.vala +++ b/libbirdfont/Renderer/Text.vala @@ -451,8 +451,11 @@ glyph.set_cache (cache_id, cache); } + cr.save (); + cr.set_antialias (Cairo.Antialias.NONE); cr.set_source_surface (glyph.get_cache (cache_id), (int) xp, (int) yp); cr.paint (); + cr.restore (); } void draw_path (Context cr, Path path, double lsb, double x, double y, double scale) {
--- a/libbirdfont/Renderer/TextArea.vala +++ b/libbirdfont/Renderer/TextArea.vala @@ -1146,7 +1146,7 @@ ty = paragraph.start_y; if (paragraph.cached_surface == null) { - paragraph.cached_surface = new Surface.similar (cr.get_target (), Cairo.Content.COLOR_ALPHA, (int) width + 1, paragraph.get_height () + (int) font_size + 1); + paragraph.cached_surface = new Surface.similar (cr.get_target (), Cairo.Content.COLOR_ALPHA, (int) width + 2, paragraph.get_height () + (int) font_size + 2); cc = new Context ((!) paragraph.cached_surface); foreach (Text next_word in paragraph.words) { @@ -1159,7 +1159,8 @@ } if (likely (paragraph.cached_surface != null)) { - cr.set_source_surface ((!) paragraph.cached_surface, x + tx, widget_y + paragraph.start_y - font_size + padding); + // FIXME: subpixel offset in text area + cr.set_source_surface ((!) paragraph.cached_surface, (int) (x + tx), (int) (widget_y + paragraph.start_y - font_size + padding)); cr.paint (); } else { warning ("No paragraph image.");