Added glyph methods needed for new text system.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@15850 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2003-02-02 01:22:10 +00:00
parent 422914a158
commit 7376de0848

View file

@ -99,6 +99,19 @@ static NSMutableDictionary *_globalFontDictionary = nil;
return extents.width;
}
- (float) widthOfGlyphs: (const NSGlyph *) glyphs lenght: (int) len
{
XGlyphInfo extents;
XftTextExtents16 ([XGServer currentXDisplay],
font_info,
glyphs,
len,
&extents);
return extents.width;
}
- (NSMultibyteGlyphPacking)glyphPacking
{
return NSTwoByteGlyphPacking;
@ -226,6 +239,54 @@ static NSMutableDictionary *_globalFontDictionary = nil;
XftDrawDestroy(xftdraw);
}
- (void) drawGlyphs: (const NSGlyph *) glyphs lenght: (int) len
onDisplay: (Display*) xdpy drawable: (Drawable) draw
with: (GC) xgcntxt at: (XPoint) xp
{
XftDraw *xftdraw;
XftColor xftcolor;
XColor dummyc;
XGCValues values;
XGGState *state = [(XGContext *)GSCurrentContext() currentGState];
Region xregion = [state xClipRegion];
int defaultScreen = DefaultScreen(xdpy);
Colormap colmap = DefaultColormap(xdpy, defaultScreen);
/* ready to draw */
xftdraw = XftDrawCreate(xdpy, draw,
DefaultVisual(xdpy, defaultScreen),
colmap);
if(xftdraw == NULL)
return;
/* sort out the drawing colour */
XGetGCValues(xdpy, xgcntxt,
GCForeground | GCBackground,
&values);
dummyc.pixel = values.foreground;
XQueryColor(xdpy, colmap, &dummyc);
xftcolor.color.red = dummyc.red;
xftcolor.color.green = dummyc.green;
xftcolor.color.blue = dummyc.blue;
xftcolor.color.alpha = 0xffff;
xftcolor.pixel = values.foreground;
// set up clipping
if(xregion != None)
{
XftDrawSetClip(xftdraw, xregion);
XDestroyRegion(xregion);
}
/* do it */
XftDrawString16(xftdraw, &xftcolor, font_info,
xp.x, xp.y, (XftChar16*)glyphs, len);
/* tidy up */
XftDrawDestroy(xftdraw);
}
- (void) draw: (const char*) s lenght: (int) len
onDisplay: (Display*) xdpy drawable: (Drawable) draw
with: (GC) xgcntxt at: (XPoint) xp