mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-24 12:21:34 +00:00
Update with new backend/gui interface for screen fonts. Add basic screen font support to back-art.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/text-system-branch@15114 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1dfd5187a1
commit
108095b159
6 changed files with 68 additions and 15 deletions
|
@ -1,3 +1,12 @@
|
|||
2002-11-26 12:58 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* 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 <alexander@malmberg.org>
|
||||
|
||||
* Source/x11/XWindowBuffer (-_exposeRect:): Round coordinates
|
||||
|
|
|
@ -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 <FTFontInfo>
|
||||
{
|
||||
@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
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue