The Birdfont Source Code


All Repositories / birdfont.git / commit – 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
author Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 16 Mar 2015 21:38:20 +0000 (22:38 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 16 Mar 2015 21:38:54 +0000 (22:38 +0100)
commit f9499dd6040aca05b5543876435cdaa3ac7a220a
tree 9c82ecbe6f3888787657a7dca4a6834f16118609
parent 853a773a0a3757f3e97d9705df998c3713670b33
Sharper text in text area

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.");