From 32f5af3e0844a3bc15f301ca6ab82413f60cf4b7 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 9 Nov 2004 21:22:36 +0000 Subject: [PATCH] 2004-11-09 23:15 Alexander Malmberg * Source/art/ftfont.m (fix_path): Don't prepend the path to absolute file names. (-initWithFontName:matrix:screenFont:): Initialize cachedGlyph. (-advancementForGlyph:): Handle NSNullGlyph. (-glyphForCharacter:): Return NSNullGlyph if there's no glyph for the character. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@20331 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 9 +++++++++ Source/art/ftfont.m | 28 +++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e09f766..b96e30e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-11-09 23:15 Alexander Malmberg + + * Source/art/ftfont.m (fix_path): Don't prepend the path to absolute + file names. + (-initWithFontName:matrix:screenFont:): Initialize cachedGlyph. + (-advancementForGlyph:): Handle NSNullGlyph. + (-glyphForCharacter:): Return NSNullGlyph if there's no glyph for + the character. + 2004-11-09 19:00 Alexander Malmberg * Tools/gpbs.m (main): If we get a -GSStartupNotification argument, diff --git a/Source/art/ftfont.m b/Source/art/ftfont.m index 4d865d7..3f36bb5 100644 --- a/Source/art/ftfont.m +++ b/Source/art/ftfont.m @@ -296,7 +296,10 @@ static NSArray *fix_path(NSString *path, NSArray *files) nfiles = [[NSMutableArray alloc] init]; for (i = 0; i < c; i++) { - [nfiles addObject: [path stringByAppendingPathComponent: + if ([[files objectAtIndex: i] isAbsolutePath]) + [nfiles addObject: [files objectAtIndex: i]]; + else + [nfiles addObject: [path stringByAppendingPathComponent: [files objectAtIndex: i]]]; } return nfiles; @@ -845,6 +848,15 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_ advancementImgd = cur; } + /* + Here, we simply need to make sure that we don't get any false matches + the first time a particular cache entry is used. Thus, we only need to + initialize the first entry. For all other entries, cachedGlyph[i] will + be 0, and that's a glyph that can't possibly hash to any entry except + entry #0, so it won't cause any false matches. + */ + cachedGlyph[0] = 1; + return self; } @@ -2098,11 +2110,11 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_ FT_Error error; if (glyph == NSControlGlyph - || glyph == GSAttachmentGlyph - || glyph == NSNullGlyph) + || glyph == GSAttachmentGlyph) return NSZeroSize; - glyph--; + if (glyph != NSNullGlyph) + glyph--; if (screenFont) { int entry = glyph % CACHE_SIZE; @@ -3143,6 +3155,7 @@ static int filters[3][7]= -(NSGlyph) glyphForCharacter: (unichar)ch { FTFontInfo *fi=fontInfo; + NSGlyph g; FTC_CMapDescRec cmap; @@ -3150,7 +3163,11 @@ static int filters[3][7]= cmap.u.encoding = ft_encoding_unicode; cmap.type = FTC_CMAP_BY_ENCODING; - return FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, ch) + 1; + g = FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, ch); + if (g) + return g + 1; + else + return NSNullGlyph; } -(NSString *) nameOfGlyph: (NSGlyph)glyph @@ -3385,3 +3402,4 @@ static char buf[1024]; /* !!TODO!! */ } @end +