diff --git a/ChangeLog b/ChangeLog index 34a444b..a0be0fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-05-29 Fred Kiefer + + * 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 * Source/x11/XGServerWindow.m (-_DPSsetcursor::): Don't set cursor diff --git a/Source/xlib/GSXftFontInfo.m b/Source/xlib/GSXftFontInfo.m index 947938d..f72c39c 100644 --- a/Source/xlib/GSXftFontInfo.m +++ b/Source/xlib/GSXftFontInfo.m @@ -169,7 +169,7 @@ static NSArray *faFromFc(FcPattern *pat) NSMutableArray *fcxft_allFontNames = [[NSMutableArray alloc] init]; 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); FcPatternDestroy(pat); @@ -213,6 +213,33 @@ static NSArray *faFromFc(FcPattern *pat) 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 #endif @@ -274,7 +301,7 @@ static NSArray *faFromFc(FcPattern *pat) - (float) widthOfGlyphs: (const NSGlyph *) glyphs length: (int) len { XGlyphInfo extents; - unichar buf[len]; + XftChar16 buf[len]; int i; for (i = 0; i < len; i++) @@ -374,7 +401,7 @@ static NSArray *faFromFc(FcPattern *pat) allowLossyConversion: YES]; int length = [d length]; const char *cstr = (const char*)[d bytes]; - XGGState *state = [(XGContext *)GSCurrentContext() currentGState]; + XGGState *state = (XGGState *)[(XGContext *)GSCurrentContext() currentGState]; XftDraw *xftdraw = [state xftDrawForDrawable: draw]; XftColor xftcolor = [state xftColor]; @@ -387,12 +414,12 @@ static NSArray *faFromFc(FcPattern *pat) onDisplay: (Display*) xdpy drawable: (Drawable) draw with: (GC) xgcntxt at: (XPoint) xp { - XGGState *state = [(XGContext *)GSCurrentContext() currentGState]; + XGGState *state = (XGGState *)[(XGContext *)GSCurrentContext() currentGState]; XftDraw *xftdraw = [state xftDrawForDrawable: draw]; XftColor xftcolor = [state xftColor]; - unichar buf[len]; + XftChar16 buf[len]; int i; - + for (i = 0; i < len; i++) { buf[i] = glyphs[i]; @@ -403,12 +430,12 @@ static NSArray *faFromFc(FcPattern *pat) 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 with: (GC) xgcntxt at: (XPoint) xp { int length = strlen(s); - XGGState *state = [(XGContext *)GSCurrentContext() currentGState]; + XGGState *state = (XGGState *)[(XGContext *)GSCurrentContext() currentGState]; XftDraw *xftdraw = [state xftDrawForDrawable: draw]; 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; @@ -449,6 +476,7 @@ static NSArray *faFromFc(FcPattern *pat) return extents.width; } + - (void) setActiveFor: (Display*) xdpy gc: (GC) xgcntxt { } diff --git a/Source/xlib/XGFont.m b/Source/xlib/XGFont.m index 6b04ebf..5a84eee 100644 --- a/Source/xlib/XGFont.m +++ b/Source/xlib/XGFont.m @@ -215,12 +215,14 @@ static BOOL XGInitAtoms(Display *dpy) with: (GC) xgcntxt at: (XPoint) xp { // This font must already be active! - unsigned char buf[len]; + char buf[len]; int i; + for (i = 0; i < len; i++) { buf[i] = glyphs[i]; } + 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 { - unsigned char buf[len]; + char buf[len]; int i; + for (i = 0; i < len; i++) { buf[i] = glyphs[i]; } + return XTextWidth(font_info, buf, len); } diff --git a/Source/xlib/XGFontSetFontInfo.m b/Source/xlib/XGFontSetFontInfo.m index 2d089e9..38a6ed5 100644 --- a/Source/xlib/XGFontSetFontInfo.m +++ b/Source/xlib/XGFontSetFontInfo.m @@ -153,6 +153,7 @@ static BOOL char_struct_for_glyph(NSGlyph glyph, XFontSet font_set, XFreeFontSet(XSERVER, _font_set); _font_set = NULL; } + [super dealloc]; } - (NSSize) advancementForGlyph: (NSGlyph)glyph @@ -198,8 +199,8 @@ static BOOL char_struct_for_glyph(NSGlyph glyph, XFontSet font_set, } - (void) drawGlyphs: (const NSGlyph *)glyphs - length: (int)len - onDisplay: (Display *)dpy + lenght: (int)len + onDisplay: (Display *)dpy drawable: (Drawable)win with: (GC)gc at: (XPoint)xp @@ -215,7 +216,7 @@ static BOOL char_struct_for_glyph(NSGlyph glyph, XFontSet font_set, } - (float) widthOfGlyphs: (const NSGlyph *)glyphs - length: (int)len + lenght: (int)len { UTF8Str ustr; float val; diff --git a/Source/xlib/XGGState.m b/Source/xlib/XGGState.m index 41faa3f..10da17a 100644 --- a/Source/xlib/XGGState.m +++ b/Source/xlib/XGGState.m @@ -717,6 +717,8 @@ static Region emptyRegion; do_copy = NO; comp_gcv.function = GXcopy; break; + default: + comp_gcv.function = GXcopy; } if (comp_gcv.function != GXcopy) @@ -957,7 +959,11 @@ static Region emptyRegion; int x[count], w[count], y0, y1; int yh = y * 2 + 1; // shift y of horizontal line XPoint lastP, p1; - + + // To keep compiler happy + lastP.x = 0; + lastP.y = 0; + /* intersect horizontal line with path */ for (i = 0, cnt = 0; i < count - 1; i++) { @@ -1065,6 +1071,12 @@ static Region emptyRegion; BOOL doit; 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++) { doit = NO; diff --git a/Source/xlib/XGGeometry.m b/Source/xlib/XGGeometry.m index 19388b0..42781a5 100644 --- a/Source/xlib/XGGeometry.m +++ b/Source/xlib/XGGeometry.m @@ -48,16 +48,18 @@ accessibleRectForWindow (gswindow_device_t* win) Display* xdpy = [XGServer currentXDisplay]; Window root; Window ignoreWindow; - int x, y, w, h; + int x, y; + unsigned int w, h; int ignoreInt; + unsigned int ignoreUInt; XRectangle winRect; if (!XGetGeometry (xdpy, GET_XDRAWABLE (win), &root, &x, &y, &w, &h, - &ignoreInt, - &ignoreInt)) + &ignoreUInt, + &ignoreUInt)) { NSDebugLLog (@"XGGeometry", @"invalide Drawable in gswindow_device"); return XGMakeRect (0, 0, 0, 0); @@ -75,7 +77,7 @@ accessibleRectForWindow (gswindow_device_t* win) &root, &ignoreInt, &ignoreInt, &w, &h, - &ignoreInt, &ignoreInt)) + &ignoreUInt, &ignoreUInt)) { NSDebugLLog (@"XGGeometry", @"could not determine size of root"); return XGMakeRect (0, 0, 0, 0); diff --git a/Tools/font_cacher.m b/Tools/font_cacher.m index bf1911a..f2ca227 100644 --- a/Tools/font_cacher.m +++ b/Tools/font_cacher.m @@ -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. + NSArray *el1 = (NSArray *)e1; + NSArray *el2 = (NSArray *)e2; NSFontTraitMask t1 = [[el1 objectAtIndex: 3] unsignedIntValue]; NSFontTraitMask t2 = [[el2 objectAtIndex: 3] unsignedIntValue]; int w1 = [[el1 objectAtIndex: 2] intValue];