diff --git a/ChangeLog b/ChangeLog index 5568ff9..da28441 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-11-26 12:58 Alexander Malmberg + + * Source/winlib/WIN32FontInfo.m, Source/xdps/AFMFileFontInfo.m, + Source/xlib/XGFont.m, Source/xlib/XftFontInfo.m: Update with new + screen font changes in backend/gui interface. + + Source/art/ftfont.m: Update with new interface. Add basic support + of screen fonts. + 2002-11-24 00:40 Alexander Malmberg * Source/x11/XWindowBuffer (-_exposeRect:): Round coordinates diff --git a/Source/art/ftfont.m b/Source/art/ftfont.m index 4f2a0de..f08f47a 100644 --- a/Source/art/ftfont.m +++ b/Source/art/ftfont.m @@ -59,6 +59,9 @@ #include FT_OUTLINE_H +/* TODO: finish screen font handling */ + + /* from the back-art-subpixel-text defaults key 0: normal rendering @@ -76,13 +79,14 @@ static BOOL anti_alias_by_default; @interface FTFontInfo : GSFontInfo { @public - const char *filename; FTC_ImageDesc imgd; FTC_ImageDesc fallback; FTFaceInfo *face_info; + BOOL screenFont; + /* Glyph generation */ NSGlyph ligature_ff,ligature_fi,ligature_fl,ligature_ffl,ligature_ffi; @@ -578,7 +582,9 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_ @implementation FTFontInfo -- initWithFontName: (NSString*)name matrix: (const float *)fmatrix +- initWithFontName: (NSString*)name + matrix: (const float *)fmatrix + screenFont: (BOOL)p_screenFont { FT_Face face; FT_Size size; @@ -594,10 +600,11 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_ self = [super init]; -/* NSDebugLLog(@"ftfont", @"[%@ -initWithFontName: %@ matrix: (%g %g %g %g %g %g)]\n", + NSDebugLLog(@"ftfont", @"[%@ -initWithFontName: %@ matrix: (%g %g %g %g %g %g)] %i\n", self, name, fmatrix[0], fmatrix[1], fmatrix[2], - fmatrix[3], fmatrix[4], fmatrix[5]);*/ + fmatrix[3], fmatrix[4], fmatrix[5], + screenFont); font_entry = [fcfg_all_fonts objectForKey: name]; if (!font_entry) @@ -624,8 +631,10 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_ imgd.font.pix_width = matrix[0]; imgd.font.pix_height = matrix[3]; + screenFont = p_screenFont; + rfi = font_entry->files; - if (font_entry->num_sizes && + if (screenFont && font_entry->num_sizes && ((imgd.font.pix_width == imgd.font.pix_height) || (imgd.font.pix_width == -imgd.font.pix_height))) { @@ -765,9 +774,10 @@ extern void GSToUnicode(); xy = matrix[2] * transform->matrix.m11 + matrix[3] * transform->matrix.m21; yy = matrix[2] * transform->matrix.m12 + matrix[3] * transform->matrix.m22; - /* if we're drawing 'normal' text (unscaled, unrotated, reasonable - size), we can and should use the sbit cache */ - if (fabs(xx - ((int)xx)) < 0.01 && fabs(yy - ((int)yy)) < 0.01 && + /* If we're drawing 'normal' text (unscaled, unrotated, reasonable + size), we can and should use the sbit cache for screen fonts. */ + if (screenFont && + fabs(xx - ((int)xx)) < 0.01 && fabs(yy - ((int)yy)) < 0.01 && fabs(xy) < 0.01 && fabs(yx) < 0.01 && xx < 72 && yy < 72 && xx > 0.5 && yy > 0.5) { @@ -1156,9 +1166,10 @@ extern void GSToUnicode(); xy = matrix[2] * transform->matrix.m11 + matrix[3] * transform->matrix.m21; yy = matrix[2] * transform->matrix.m12 + matrix[3] * transform->matrix.m22; - /* if we're drawing 'normal' text (unscaled, unrotated, reasonable - size), we can and should use the sbit cache */ - if (fabs(xx - ((int)xx)) < 0.01 && fabs(yy - ((int)yy)) < 0.01 && + /* If we're drawing 'normal' text (unscaled, unrotated, reasonable + size), we can and should use the sbit cache for screen fonts. */ + if (screenFont && + fabs(xx - ((int)xx)) < 0.01 && fabs(yy - ((int)yy)) < 0.01 && fabs(xy) < 0.01 && fabs(yx) < 0.01 && xx < 72 && yy < 72 && xx > 0.5 && yy > 0.5) { @@ -1888,6 +1899,7 @@ static int filters[3][7]= @end +/* TODO: this whole thing needs cleaning up */ @implementation FTFontInfo_subpixel -(void) drawString: (const char *)s diff --git a/Source/winlib/WIN32FontInfo.m b/Source/winlib/WIN32FontInfo.m index 4edc2b6..40eae82 100644 --- a/Source/winlib/WIN32FontInfo.m +++ b/Source/winlib/WIN32FontInfo.m @@ -36,8 +36,16 @@ @implementation WIN32FontInfo -- initWithFontName: (NSString*)name matrix: (const float *)fmatrix +- initWithFontName: (NSString*)name + matrix: (const float *)fmatrix + screenFont: (BOOL)screenFont { + if (screenFont) + { + RELEASE(self); + return nil; + } + [super init]; ASSIGN(fontName, name); memcpy(matrix, fmatrix, sizeof(matrix)); diff --git a/Source/xdps/AFMFileFontInfo.m b/Source/xdps/AFMFileFontInfo.m index a793846..83fc480 100644 --- a/Source/xdps/AFMFileFontInfo.m +++ b/Source/xdps/AFMFileFontInfo.m @@ -480,10 +480,18 @@ afmEnumerator (char* resourceType, char* resourceName, char* resourceFile, return self; } -- initWithFontName: (NSString*)name matrix: (const float *)fmatrix +- initWithFontName: (NSString*)name + matrix: (const float *)fmatrix + screenFont: (BOOL)screenFont { AFMFileFontInfo *fontInfo, *baseFontInfo; + if (screenFont) + { + RELEASE(self); + return nil; + } + RELEASE(self); /* Grab an unscaled font info and create a new scaled one. */ baseFontInfo = [[AFMFileFontInfo alloc] initUnscaledWithFontName: name]; diff --git a/Source/xlib/XGFont.m b/Source/xlib/XGFont.m index ce72687..4dfa400 100644 --- a/Source/xlib/XGFont.m +++ b/Source/xlib/XGFont.m @@ -100,8 +100,16 @@ static BOOL XGInitAtoms(Display *dpy) return font_info; } -- initWithFontName: (NSString*)name matrix: (const float *)fmatrix +- initWithFontName: (NSString*)name + matrix: (const float *)fmatrix + screenFont: (BOOL)screenFont { + if (screenFont) + { + RELEASE(self); + return nil; + } + [super init]; ASSIGN(fontName, name); memcpy(matrix, fmatrix, sizeof(matrix)); diff --git a/Source/xlib/XftFontInfo.m b/Source/xlib/XftFontInfo.m index 41d7dcc..18fb06d 100644 --- a/Source/xlib/XftFontInfo.m +++ b/Source/xlib/XftFontInfo.m @@ -53,8 +53,16 @@ static NSMutableDictionary *_globalFontDictionary = nil; @implementation XftFontInfo -- initWithFontName: (NSString*)name matrix: (const float *)fmatrix +- initWithFontName: (NSString*)name + matrix: (const float *)fmatrix + screenFont: (BOOL)screenFont { + if (screenFont) + { + RELEASE(self); + return nil; + } + [super init]; ASSIGN(fontName, name); memcpy(matrix, fmatrix, sizeof(matrix));