3 квітня 2008 о 11:09 -0700 Carl Worth написав(-ла): > Meanwhile, there's an independent bug that's perhaps even more > concerning. Namely, with cairo 1.5.16 (or current git master), the > results of running fntsample are totally wrong, (with the large glyphs > all misplaced by a consistent offset). The incorrect output can be > seen here: Simplified program that demonstrates this bug is attached. It expects font as the only argument and gives wrong results on amd64 with cairo 1.5.x but not 1.4.14 (result is in file out.pdf).
Another version of this program gives assertion failure with FreeSansItalic.ttf: http://article.gmane.org/gmane.comp.lib.cairo/9166 (file test.c, cairo 1.4.14 on amd64, but not 1.5.x).
#include <stdio.h> #include <ft2build.h> #include FT_FREETYPE_H #include <cairo.h> #include <cairo-pdf.h> #include <cairo-ft.h> #define A4_WIDTH (8.3*72) #define A4_HEIGHT (11.7*72) int main(int argc, char **argv) { cairo_surface_t *surface; cairo_t *cr; FT_Error error; FT_Library library; FT_Face face; cairo_font_face_t *cr_face; error = FT_Init_FreeType(&library); error = FT_New_Face(library, argv[1], 0, &face); cr_face = cairo_ft_font_face_create_for_ft_face(face, 0); surface = cairo_pdf_surface_create("out.pdf", A4_WIDTH, A4_HEIGHT); cr = cairo_create(surface); cairo_surface_destroy(surface); cairo_set_font_face(cr, cr_face); cairo_set_font_size(cr, 20.0); FT_ULong charcode; FT_UInt idx; charcode = FT_Get_First_Char(face, &idx); int i = 0; cairo_glyph_t glyphs[256]; while (idx && (i < 256)) { glyphs[i] = (cairo_glyph_t) {idx, 20 + 30*(i/35), 20+ (i%35)*20.0}; i++; charcode = FT_Get_Next_Char(face, charcode, &idx); } cairo_show_glyphs(cr, glyphs, i); cairo_show_page(cr); cairo_destroy(cr); return 0; }
signature.asc
Description: Digital signature