summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Mainz <roland.mainz@nrubsig.org>2004-04-10 09:04:07 +0000
committerRoland Mainz <roland.mainz@nrubsig.org>2004-04-10 09:04:07 +0000
commitbac9d7b3199ebdb6007897d7baab064ae6135347 (patch)
treeb961c2f23ea7ab85a284706e04ee8c5cfb5cd727
parentb752403a028a4ee317c4cb40d798adff3438f271 (diff)
Resync to 2004-04-10 XORG-RELEASE-1 branchXPRINT_BEGINXPRINT
-rw-r--r--include/X11/Xft/Xft.h2
-rw-r--r--man/Xft.3.in2
-rw-r--r--src/xftfreetype.c53
3 files changed, 34 insertions, 23 deletions
diff --git a/include/X11/Xft/Xft.h b/include/X11/Xft/Xft.h
index d495b58..1c67265 100644
--- a/include/X11/Xft/Xft.h
+++ b/include/X11/Xft/Xft.h
@@ -33,7 +33,7 @@
#define XFT_MAJOR 2
#define XFT_MINOR 1
-#define XFT_REVISION 5
+#define XFT_REVISION 6
#define XFT_VERSION ((XFT_MAJOR * 10000) + (XFT_MINOR * 100) + (XFT_REVISION))
#define XftVersion XFT_VERSION
diff --git a/man/Xft.3.in b/man/Xft.3.in
index b7313d8..4c9f95c 100644
--- a/man/Xft.3.in
+++ b/man/Xft.3.in
@@ -138,4 +138,4 @@ has become relatively stable and is expected to retain source and binary
compatibility in future releases.
.SH AUTHOR
-Keith Packard, member of the XFree86 Project, Inc.
+Keith Packard
diff --git a/src/xftfreetype.c b/src/xftfreetype.c
index d6285b4..1a52c21 100644
--- a/src/xftfreetype.c
+++ b/src/xftfreetype.c
@@ -182,6 +182,14 @@ _XftUnlockFile (XftFtFile *f)
_XftLockError ("too many file unlocks");
}
+#if HAVE_FT_BITMAP_SIZE_Y_PPEM
+#define X_SIZE(face,i) ((face)->available_sizes[i].x_ppem)
+#define Y_SIZE(face,i) ((face)->available_sizes[i].y_ppem)
+#else
+#define X_SIZE(face,i) ((face)->available_sizes[i].width << 6)
+#define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6)
+#endif
+
FcBool
_XftSetFace (XftFtFile *f, FT_F26Dot6 xsize, FT_F26Dot6 ysize, FT_Matrix *matrix)
{
@@ -198,39 +206,42 @@ _XftSetFace (XftFtFile *f, FT_F26Dot6 xsize, FT_F26Dot6 ysize, FT_Matrix *matrix
*/
if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
{
- FT_Short width = xsize >> 6;
- FT_Short height = ysize >> 6;
- int i, best = -1;
+ int i, best = 0;
#define xft_abs(a) ((a) < 0 ? -(a) : (a))
#define dist(a,b) (xft_abs((a)-(b)))
-#if !HAVE_FT_BITMAP_SIZE_Y_PPEM
-#define y_ppem height
-#define x_ppem width
-#endif
- for (i = 0; i < face->num_fixed_sizes; i++)
+ for (i = 1; i < face->num_fixed_sizes; i++)
{
- if (best == -1 ||
- dist (height, face->available_sizes[i].y_ppem >> 6) <
- dist (height, face->available_sizes[best].y_ppem >> 6) ||
- (dist (height, face->available_sizes[i].y_ppem >> 6) ==
- dist (height, face->available_sizes[best].y_ppem >> 6) &&
- dist (width, face->available_sizes[i].x_ppem >> 6) <
- dist (width, face->available_sizes[best].x_ppem >> 6)))
+ if (dist (ysize, Y_SIZE(face,i)) <
+ dist (ysize, Y_SIZE(face, best)) ||
+ (dist (ysize, Y_SIZE(face, i)) ==
+ dist (ysize, Y_SIZE(face, best)) &&
+ dist (xsize, X_SIZE(face, i)) <
+ dist (xsize, X_SIZE(face, best))))
{
best = i;
}
}
- if (FT_Set_Char_Size (face, face->available_sizes[best].x_ppem,
- face->available_sizes[best].y_ppem, 0, 0) != 0)
+ /*
+ * Freetype 2.1.7 and earlier used width/height
+ * for matching sizes in the BDF and PCF loaders.
+ * This has been fixed for 2.1.8. Because BDF and PCF
+ * files have but a single strike per file, we can
+ * simply try both sizes.
+ */
+ if (
+#if HAVE_FT_BITMAP_SIZE_Y_PPEM
+ FT_Set_Char_Size (face, face->available_sizes[best].x_ppem,
+ face->available_sizes[best].y_ppem, 0, 0) != 0
+ &&
+#endif
+ FT_Set_Char_Size (face, face->available_sizes[best].width << 6,
+ face->available_sizes[best].height << 6,
+ 0, 0) != 0)
{
return False;
}
-#if !HAVE_FT_BITMAP_SIZE_Y_PPEM
-#undef y_ppem
-#undef x_ppem
-#endif
}
else
{