mirror of
https://github.com/gnustep/libs-back.git
synced 2025-05-30 17:00:52 +00:00
Cleanup in xlib backend.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@22990 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ea2d620a27
commit
223c1779f4
7 changed files with 83 additions and 20 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2006-05-29 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/xlib/GSXftFontInfo.m (FcFontEnumerator
|
||||||
|
-defaultSystemFontName, -defaultBoldSystemFontName,
|
||||||
|
-defaultFixedPitchFontName): Added this methods which return
|
||||||
|
values similar to the art and cairo backend.
|
||||||
|
Removed compiler warnings from this file.
|
||||||
|
* Source/xlib/XGFontSetFontInfo.m (-dealloc): Call super dealloc.
|
||||||
|
* Source/xlib/XGGeometry.m
|
||||||
|
* Source/xlib/XGFont.m
|
||||||
|
* Source/xlib/XGGState.m:
|
||||||
|
* Tools/font_cacher.m:
|
||||||
|
Removed compiler warnings.
|
||||||
|
|
||||||
2006-05-27 Fred Kiefer <FredKiefer@gmx.de>
|
2006-05-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/x11/XGServerWindow.m (-_DPSsetcursor::): Don't set cursor
|
* Source/x11/XGServerWindow.m (-_DPSsetcursor::): Don't set cursor
|
||||||
|
|
|
@ -169,7 +169,7 @@ static NSArray *faFromFc(FcPattern *pat)
|
||||||
NSMutableArray *fcxft_allFontNames = [[NSMutableArray alloc] init];
|
NSMutableArray *fcxft_allFontNames = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
FcPattern *pat = FcPatternCreate();
|
FcPattern *pat = FcPatternCreate();
|
||||||
FcObjectSet *os = FcObjectSetBuild(FC_FAMILY, FC_SLANT, FC_WEIGHT, 0);
|
FcObjectSet *os = FcObjectSetBuild(FC_FAMILY, FC_SLANT, FC_WEIGHT, NULL);
|
||||||
FcFontSet *fs = FcFontList(0, pat, os);
|
FcFontSet *fs = FcFontList(0, pat, os);
|
||||||
|
|
||||||
FcPatternDestroy(pat);
|
FcPatternDestroy(pat);
|
||||||
|
@ -213,6 +213,33 @@ static NSArray *faFromFc(FcPattern *pat)
|
||||||
allFonts = fcxft_allFonts;
|
allFonts = fcxft_allFonts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(NSString *) defaultSystemFontName
|
||||||
|
{
|
||||||
|
if ([allFontNames containsObject: @"Bitstream Vera Sans"])
|
||||||
|
return @"Bitstream Vera Sans";
|
||||||
|
if ([allFontNames containsObject: @"FreeSans"])
|
||||||
|
return @"FreeSans";
|
||||||
|
return @"Helvetica";
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString *) defaultBoldSystemFontName
|
||||||
|
{
|
||||||
|
if ([allFontNames containsObject: @"Bitstream Vera Sans-Bold"])
|
||||||
|
return @"Bitstream Vera Sans-Bold";
|
||||||
|
if ([allFontNames containsObject: @"FreeSans-Bold"])
|
||||||
|
return @"FreeSans-Bold";
|
||||||
|
return @"Helvetica-Bold";
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString *) defaultFixedPitchFontName
|
||||||
|
{
|
||||||
|
if ([allFontNames containsObject: @"Bitstream Vera Sans Mono"])
|
||||||
|
return @"Bitstream Vera Sans Mono";
|
||||||
|
if ([allFontNames containsObject: @"FreeMono"])
|
||||||
|
return @"FreeMono";
|
||||||
|
return @"Courier";
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -274,7 +301,7 @@ static NSArray *faFromFc(FcPattern *pat)
|
||||||
- (float) widthOfGlyphs: (const NSGlyph *) glyphs length: (int) len
|
- (float) widthOfGlyphs: (const NSGlyph *) glyphs length: (int) len
|
||||||
{
|
{
|
||||||
XGlyphInfo extents;
|
XGlyphInfo extents;
|
||||||
unichar buf[len];
|
XftChar16 buf[len];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
|
@ -374,7 +401,7 @@ static NSArray *faFromFc(FcPattern *pat)
|
||||||
allowLossyConversion: YES];
|
allowLossyConversion: YES];
|
||||||
int length = [d length];
|
int length = [d length];
|
||||||
const char *cstr = (const char*)[d bytes];
|
const char *cstr = (const char*)[d bytes];
|
||||||
XGGState *state = [(XGContext *)GSCurrentContext() currentGState];
|
XGGState *state = (XGGState *)[(XGContext *)GSCurrentContext() currentGState];
|
||||||
XftDraw *xftdraw = [state xftDrawForDrawable: draw];
|
XftDraw *xftdraw = [state xftDrawForDrawable: draw];
|
||||||
XftColor xftcolor = [state xftColor];
|
XftColor xftcolor = [state xftColor];
|
||||||
|
|
||||||
|
@ -387,12 +414,12 @@ static NSArray *faFromFc(FcPattern *pat)
|
||||||
onDisplay: (Display*) xdpy drawable: (Drawable) draw
|
onDisplay: (Display*) xdpy drawable: (Drawable) draw
|
||||||
with: (GC) xgcntxt at: (XPoint) xp
|
with: (GC) xgcntxt at: (XPoint) xp
|
||||||
{
|
{
|
||||||
XGGState *state = [(XGContext *)GSCurrentContext() currentGState];
|
XGGState *state = (XGGState *)[(XGContext *)GSCurrentContext() currentGState];
|
||||||
XftDraw *xftdraw = [state xftDrawForDrawable: draw];
|
XftDraw *xftdraw = [state xftDrawForDrawable: draw];
|
||||||
XftColor xftcolor = [state xftColor];
|
XftColor xftcolor = [state xftColor];
|
||||||
unichar buf[len];
|
XftChar16 buf[len];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
buf[i] = glyphs[i];
|
buf[i] = glyphs[i];
|
||||||
|
@ -403,12 +430,12 @@ static NSArray *faFromFc(FcPattern *pat)
|
||||||
xp.x, xp.y, (XftChar16*)buf, len);
|
xp.x, xp.y, (XftChar16*)buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) draw: (const char*) s length: (int) len
|
- (void) draw: (const char*) s lenght: (int) len
|
||||||
onDisplay: (Display*) xdpy drawable: (Drawable) draw
|
onDisplay: (Display*) xdpy drawable: (Drawable) draw
|
||||||
with: (GC) xgcntxt at: (XPoint) xp
|
with: (GC) xgcntxt at: (XPoint) xp
|
||||||
{
|
{
|
||||||
int length = strlen(s);
|
int length = strlen(s);
|
||||||
XGGState *state = [(XGContext *)GSCurrentContext() currentGState];
|
XGGState *state = (XGGState *)[(XGContext *)GSCurrentContext() currentGState];
|
||||||
XftDraw *xftdraw = [state xftDrawForDrawable: draw];
|
XftDraw *xftdraw = [state xftDrawForDrawable: draw];
|
||||||
XftColor xftcolor = [state xftColor];
|
XftColor xftcolor = [state xftColor];
|
||||||
|
|
||||||
|
@ -427,7 +454,7 @@ static NSArray *faFromFc(FcPattern *pat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (float) widthOf: (const char*) s length: (int) len
|
- (float) widthOf: (const char*) s lenght: (int) len
|
||||||
{
|
{
|
||||||
XGlyphInfo extents;
|
XGlyphInfo extents;
|
||||||
|
|
||||||
|
@ -449,6 +476,7 @@ static NSArray *faFromFc(FcPattern *pat)
|
||||||
return extents.width;
|
return extents.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) setActiveFor: (Display*) xdpy gc: (GC) xgcntxt
|
- (void) setActiveFor: (Display*) xdpy gc: (GC) xgcntxt
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,12 +215,14 @@ static BOOL XGInitAtoms(Display *dpy)
|
||||||
with: (GC) xgcntxt at: (XPoint) xp
|
with: (GC) xgcntxt at: (XPoint) xp
|
||||||
{
|
{
|
||||||
// This font must already be active!
|
// This font must already be active!
|
||||||
unsigned char buf[len];
|
char buf[len];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
buf[i] = glyphs[i];
|
buf[i] = glyphs[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
XDrawString(xdpy, draw, xgcntxt, xp.x, xp.y, buf, len);
|
XDrawString(xdpy, draw, xgcntxt, xp.x, xp.y, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,12 +244,14 @@ static BOOL XGInitAtoms(Display *dpy)
|
||||||
|
|
||||||
- (float) widthOfGlyphs: (const NSGlyph *) glyphs length: (int) len
|
- (float) widthOfGlyphs: (const NSGlyph *) glyphs length: (int) len
|
||||||
{
|
{
|
||||||
unsigned char buf[len];
|
char buf[len];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
buf[i] = glyphs[i];
|
buf[i] = glyphs[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return XTextWidth(font_info, buf, len);
|
return XTextWidth(font_info, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,7 @@ static BOOL char_struct_for_glyph(NSGlyph glyph, XFontSet font_set,
|
||||||
XFreeFontSet(XSERVER, _font_set);
|
XFreeFontSet(XSERVER, _font_set);
|
||||||
_font_set = NULL;
|
_font_set = NULL;
|
||||||
}
|
}
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSSize) advancementForGlyph: (NSGlyph)glyph
|
- (NSSize) advancementForGlyph: (NSGlyph)glyph
|
||||||
|
@ -198,8 +199,8 @@ static BOOL char_struct_for_glyph(NSGlyph glyph, XFontSet font_set,
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawGlyphs: (const NSGlyph *)glyphs
|
- (void) drawGlyphs: (const NSGlyph *)glyphs
|
||||||
length: (int)len
|
lenght: (int)len
|
||||||
onDisplay: (Display *)dpy
|
onDisplay: (Display *)dpy
|
||||||
drawable: (Drawable)win
|
drawable: (Drawable)win
|
||||||
with: (GC)gc
|
with: (GC)gc
|
||||||
at: (XPoint)xp
|
at: (XPoint)xp
|
||||||
|
@ -215,7 +216,7 @@ static BOOL char_struct_for_glyph(NSGlyph glyph, XFontSet font_set,
|
||||||
}
|
}
|
||||||
|
|
||||||
- (float) widthOfGlyphs: (const NSGlyph *)glyphs
|
- (float) widthOfGlyphs: (const NSGlyph *)glyphs
|
||||||
length: (int)len
|
lenght: (int)len
|
||||||
{
|
{
|
||||||
UTF8Str ustr;
|
UTF8Str ustr;
|
||||||
float val;
|
float val;
|
||||||
|
|
|
@ -717,6 +717,8 @@ static Region emptyRegion;
|
||||||
do_copy = NO;
|
do_copy = NO;
|
||||||
comp_gcv.function = GXcopy;
|
comp_gcv.function = GXcopy;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
comp_gcv.function = GXcopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comp_gcv.function != GXcopy)
|
if (comp_gcv.function != GXcopy)
|
||||||
|
@ -957,7 +959,11 @@ static Region emptyRegion;
|
||||||
int x[count], w[count], y0, y1;
|
int x[count], w[count], y0, y1;
|
||||||
int yh = y * 2 + 1; // shift y of horizontal line
|
int yh = y * 2 + 1; // shift y of horizontal line
|
||||||
XPoint lastP, p1;
|
XPoint lastP, p1;
|
||||||
|
|
||||||
|
// To keep compiler happy
|
||||||
|
lastP.x = 0;
|
||||||
|
lastP.y = 0;
|
||||||
|
|
||||||
/* intersect horizontal line with path */
|
/* intersect horizontal line with path */
|
||||||
for (i = 0, cnt = 0; i < count - 1; i++)
|
for (i = 0, cnt = 0; i < count - 1; i++)
|
||||||
{
|
{
|
||||||
|
@ -1065,6 +1071,12 @@ static Region emptyRegion;
|
||||||
BOOL doit;
|
BOOL doit;
|
||||||
BOOL complex = NO;
|
BOOL complex = NO;
|
||||||
|
|
||||||
|
// To keep compiler happy
|
||||||
|
last_p.x = 0;
|
||||||
|
last_p.y = 0;
|
||||||
|
p.x = 0;
|
||||||
|
p.y = 0;
|
||||||
|
|
||||||
for (j = 0; j < count; j++)
|
for (j = 0; j < count; j++)
|
||||||
{
|
{
|
||||||
doit = NO;
|
doit = NO;
|
||||||
|
|
|
@ -48,16 +48,18 @@ accessibleRectForWindow (gswindow_device_t* win)
|
||||||
Display* xdpy = [XGServer currentXDisplay];
|
Display* xdpy = [XGServer currentXDisplay];
|
||||||
Window root;
|
Window root;
|
||||||
Window ignoreWindow;
|
Window ignoreWindow;
|
||||||
int x, y, w, h;
|
int x, y;
|
||||||
|
unsigned int w, h;
|
||||||
int ignoreInt;
|
int ignoreInt;
|
||||||
|
unsigned int ignoreUInt;
|
||||||
XRectangle winRect;
|
XRectangle winRect;
|
||||||
|
|
||||||
if (!XGetGeometry (xdpy, GET_XDRAWABLE (win),
|
if (!XGetGeometry (xdpy, GET_XDRAWABLE (win),
|
||||||
&root,
|
&root,
|
||||||
&x, &y,
|
&x, &y,
|
||||||
&w, &h,
|
&w, &h,
|
||||||
&ignoreInt,
|
&ignoreUInt,
|
||||||
&ignoreInt))
|
&ignoreUInt))
|
||||||
{
|
{
|
||||||
NSDebugLLog (@"XGGeometry", @"invalide Drawable in gswindow_device");
|
NSDebugLLog (@"XGGeometry", @"invalide Drawable in gswindow_device");
|
||||||
return XGMakeRect (0, 0, 0, 0);
|
return XGMakeRect (0, 0, 0, 0);
|
||||||
|
@ -75,7 +77,7 @@ accessibleRectForWindow (gswindow_device_t* win)
|
||||||
&root,
|
&root,
|
||||||
&ignoreInt, &ignoreInt,
|
&ignoreInt, &ignoreInt,
|
||||||
&w, &h,
|
&w, &h,
|
||||||
&ignoreInt, &ignoreInt))
|
&ignoreUInt, &ignoreUInt))
|
||||||
{
|
{
|
||||||
NSDebugLLog (@"XGGeometry", @"could not determine size of root");
|
NSDebugLLog (@"XGGeometry", @"could not determine size of root");
|
||||||
return XGMakeRect (0, 0, 0, 0);
|
return XGMakeRect (0, 0, 0, 0);
|
||||||
|
|
|
@ -408,9 +408,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fontDefSorter(NSArray *el1, NSArray *el2, void *context)
|
static NSComparisonResult fontDefSorter(id e1, id e2, void *context)
|
||||||
{
|
{
|
||||||
// This is not exactly the order the OpenStep specification states.
|
// This is not exactly the order the OpenStep specification states.
|
||||||
|
NSArray *el1 = (NSArray *)e1;
|
||||||
|
NSArray *el2 = (NSArray *)e2;
|
||||||
NSFontTraitMask t1 = [[el1 objectAtIndex: 3] unsignedIntValue];
|
NSFontTraitMask t1 = [[el1 objectAtIndex: 3] unsignedIntValue];
|
||||||
NSFontTraitMask t2 = [[el2 objectAtIndex: 3] unsignedIntValue];
|
NSFontTraitMask t2 = [[el2 objectAtIndex: 3] unsignedIntValue];
|
||||||
int w1 = [[el1 objectAtIndex: 2] intValue];
|
int w1 = [[el1 objectAtIndex: 2] intValue];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue