Support versions of freetype without exact FT_Bitmap_Size.x/y_ppem values by using the pixel width and height values instead.

Add a check for FT_Bitmap_Size.y_ppem.
reviewed by: keithp
This commit is contained in:
Billy Biggs 2005-07-31 11:19:47 +00:00
parent b4ae3371b3
commit cd78d99642
3 changed files with 31 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2005-07-31 Billy Biggs <vektor@dumbterm.net>
reviewed by: keithp
* src/cairo-ft-font.c: (_ft_unscaled_font_set_scale): Support
versions of freetype without exact FT_Bitmap_Size.x/y_ppem
values by using the pixel width and height values instead.
* configure.in: Add a check for FT_Bitmap_Size.y_ppem.
2005-07-31 Billy Biggs <vektor@dumbterm.net>
* src/cairo-quartz-surface.c: (cairo_quartz_surface_create):

View file

@ -273,6 +273,20 @@ if test "x$use_freetype" = "xyes"; then
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_REQUIRES)
temp_save_libs="$LIBS"
temp_save_cflags="$CFLAGS"
LIBS="$LIBS $FREETYPE_LIBS"
CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
[#include<ft2build.h>
#include FT_FREETYPE_H])
AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
[FT_Bitmap_Size structure includes y_ppem field])
LIBS="$temp_save_libs"
CFLAGS="$temp_save_cflags"
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"

View file

@ -528,7 +528,11 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled,
pixel_width = pixel_height = 0;
for (i = 0; i < unscaled->face->num_fixed_sizes; i++) {
#if HAVE_FT_BITMAP_SIZE_Y_PPEM
double size = unscaled->face->available_sizes[i].y_ppem / 64.;
#else
double size = unscaled->face->available_sizes[i].height;
#endif
double distance = fabs (size - sf.y_scale);
if (distance <= min_distance) {
@ -536,11 +540,13 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled,
best_i = i;
}
}
#if HAVE_FT_BITMAP_SIZE_Y_PPEM
error = FT_Set_Char_Size (unscaled->face,
unscaled->face->available_sizes[best_i].x_ppem,
unscaled->face->available_sizes[best_i].y_ppem,
0, 0);
if (error )
if (error)
#endif
error = FT_Set_Pixel_Sizes (unscaled->face,
unscaled->face->available_sizes[best_i].width,
unscaled->face->available_sizes[best_i].height);