From c4122018aaf9853e4c89db7e1e5b244963bcd7cb Mon Sep 17 00:00:00 2001 From: Alexander Malmberg Date: Sun, 29 Jun 2003 15:36:28 +0000 Subject: [PATCH] Make handling of non-integer sized screen fonts consistent. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@17066 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/art/ftfont.m | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 052b2fc..db093b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-06-29 17:34 Alexander Malmberg + + * Source/art/ftfont.m (-initWithFontName:matrix:screenFont:): Round + the matrix entries for screen fonts to integers to get consistent + handling of non-integer sized screen fonts. + 2003-06-28 15:27 Alexander Malmberg * Source/art/ftfont.m: Use a specific table when translating diff --git a/Source/art/ftfont.m b/Source/art/ftfont.m index d717e03..05786eb 100644 --- a/Source/art/ftfont.m +++ b/Source/art/ftfont.m @@ -641,6 +641,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_ self = [super init]; + screenFont = p_screenFont; NSDebugLLog(@"ftfont", @"[%@ -initWithFontName: %@ matrix: (%g %g %g %g %g %g)] %i\n", self, name, @@ -670,11 +671,19 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_ mostCompatibleStringEncoding = NSUTF8StringEncoding; encodingScheme = @"iso10646-1"; + if (screenFont) + { + /* Round up; makes the text more legible. */ + matrix[0] = ceil(matrix[0]); + if (matrix[3] < 0.0) + matrix[3] = floor(matrix[3]); + else + matrix[3] = ceil(matrix[3]); + } + imgd.font.pix_width = fabs(matrix[0]); imgd.font.pix_height = fabs(matrix[3]); - screenFont = p_screenFont; - rfi = font_entry->files; if (screenFont && font_entry->num_sizes && imgd.font.pix_width == imgd.font.pix_height)