Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add a path to the cairo context tracing the current text.
- pango_cairo_layout_path(cr.get(), &layout);
- if(add_outline_) {
- // Set color for background outline (black).
- cairo_set_source_rgba(cr.get(), 0.0, 0.0, 0.0, 1.0);
- cairo_set_line_join(cr.get(), CAIRO_LINE_JOIN_ROUND);
- cairo_set_line_width(cr.get(), 3.0); // Adjust as necessary
- // Stroke path to draw outline. Don't delete it the path.
- cairo_stroke_preserve(cr.get());
- }
- // Set main text color.
- cairo_set_source_rgba(cr.get(),
- foreground_color_.r / 255.0,
- foreground_color_.g / 255.0,
- foreground_color_.b / 255.0,
- foreground_color_.a / 255.0
- );
- // Fill text path. This is a hack to work around bug #1744 (bad alpha blending when rendering the
- // output surface). Instead of calling pango_cairo_show_layout twice, we fill the layout path here
- // It greatly improves the look of text, but it shouldn't really be necessary and probably messes
- // with certain OS settings like disabling AA.
- cairo_fill(cr.get());
- // Necessary for pango markup to be properly rendered.
- pango_cairo_show_layout(cr.get(), &layout);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement