Convert glyph buffers to 16-bit buffers that the Xft functions can handle.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@15861 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-02-02 21:06:03 +00:00
parent 3d966981d2
commit ad3d8e3e35
3 changed files with 33 additions and 6 deletions

View file

@ -1,3 +1,16 @@
2003-02-02 22:00 Alexander Malmberg <alexander@malmberg.org>
* Source/art/ftfont.m (-initWithFontName:matrix:screenFont:): Use
better guess for x-height value.
* Source/x11/XGServerWindow.m: Use safer order of includes.
* Source/xlib/GSXftFontInfo.m (-widthOfGlyphs:lenght:,
-drawGlyphs:lenght:onDisplay:drawable:with:at:): Convert glyph
buffers to 16-bit buffers that the Xft functions can handle.
* Source/xlib/XGFont.m: Whitespace cleanups.
2003-01-31 Chris B. Vetter <chrisv@web4inc.com>
* Tools/gpbs.m (-dealloc): Remove observer.

View file

@ -102,10 +102,17 @@ static NSMutableDictionary *_globalFontDictionary = nil;
- (float) widthOfGlyphs: (const NSGlyph *) glyphs lenght: (int) len
{
XGlyphInfo extents;
unichar buf[len];
int i;
for (i = 0; i < len; i++)
{
buf[i] = glyphs[i];
}
XftTextExtents16 ([XGServer currentXDisplay],
font_info,
glyphs,
buf,
len,
&extents);
@ -251,6 +258,13 @@ static NSMutableDictionary *_globalFontDictionary = nil;
Region xregion = [state xClipRegion];
int defaultScreen = DefaultScreen(xdpy);
Colormap colmap = DefaultColormap(xdpy, defaultScreen);
unichar buf[len];
int i;
for (i = 0; i < len; i++)
{
buf[i] = glyphs[i];
}
/* ready to draw */
xftdraw = XftDrawCreate(xdpy, draw,
@ -281,7 +295,7 @@ static NSMutableDictionary *_globalFontDictionary = nil;
/* do it */
XftDrawString16(xftdraw, &xftcolor, font_info,
xp.x, xp.y, (XftChar16*)glyphs, len);
xp.x, xp.y, (XftChar16*)buf, len);
/* tidy up */
XftDrawDestroy(xftdraw);

View file

@ -217,9 +217,9 @@ static BOOL XGInitAtoms(Display *dpy)
// This font must already be active!
unsigned char buf[len];
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);
}
@ -244,9 +244,9 @@ static BOOL XGInitAtoms(Display *dpy)
{
unsigned char buf[len];
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);
}