fonts problem on linux with custom cairo build
Mikhail Kozhevnikov <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Hi All, I'm experiencing certain troubles with font face selection on Linux. On Windows and Mac things work fine, while on my Linux box (running Debian Squeeze) the font face is always the same and... well... it looks funny. I have a two samples attached: serif-1.10.2.png is where the problem occurs -- with our own build of cairo 1.10.2, serif-1.8.2.png is the result produced by exactly the same code linked against the version 1.8.2 installed via apt-get. The code's attached too. I gather there must be something wrong with our build. It seems that Freetype and fontconfig are enabled, though. If anybody's got an idea what could cause this kind of problem or how to fix it, I'd be glad to hear your suggestions. Thanks in advance, --Mikhail -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo
serif-1.8.2.png
(image/png, 4.8 KB) - not displayed
serif-1.10.2.png
(image/png, 3.9 KB) - not displayed
test.cpp
(text/x-c, 756 B)
#include <cairo.h>
int main() {
cairo_surface_t *surface;
cairo_t *cr;
cairo_text_extents_t te;
printf("%s", cairo_version_string());
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 400, 120);
cr = cairo_create(surface);
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_select_font_face(cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cr, 120);
const char* text = "Cairo";
cairo_text_extents(cr, text, &te);
cairo_move_to(cr, 200 - te.width / 2 - te.x_bearing, 60 - te.height / 2 - te.y_bearing);
cairo_show_text(cr, text);
cairo_surface_write_to_png(surface, "serif.png");
cairo_destroy(cr);
cairo_surface_destroy(surface);
return 0;
}