Support drawing of glyphs for new text system

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@15899 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-02-06 12:09:17 +00:00
parent 00477f2f07
commit 71287aef45
4 changed files with 51 additions and 2 deletions

View file

@ -1,6 +1,9 @@
2003-02-06 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/gpbs.m (ihandler): Fix for mingw, which doesn't have kill()
* Headers/winlib/WIN32FontInfo.h: New method to draw glyphs
* Source/winlib/WIN32FontInfo.m: New method to draw glyphs
* Source/winlib/WIN32GState.m: New method to draw glyphs
2003-02-02 22:00 Alexander Malmberg <alexander@malmberg.org>

View file

@ -35,6 +35,10 @@
- (void) draw: (const char*)s lenght: (int)len
onDC: (HDC)hdc at: (POINT)p;
- (void) drawGlyphs: (const NSGlyph*)s
length: (int)len
onDC: (HDC)hdc
at: (POINT)p;
@end
#endif/* _WIN32FontInfo_h_INCLUDE */

View file

@ -69,7 +69,7 @@
[super dealloc];
}
- (float) widthOf: (const char*) s lenght: (int) len
- (float) widthOf: (const char*) s length: (int) len
{
SIZE size;
HDC hdc;
@ -92,7 +92,7 @@
s = [string cString];
len = strlen(s);
return [self widthOf: s lenght: len];
return [self widthOf: s length: len];
}
- (NSMultibyteGlyphPacking)glyphPacking
@ -179,6 +179,28 @@
SelectObject(hdc, old);
}
- (void) drawGlyphs: (const NSGlyph*)s
length: (int)len
onDC: (HDC)hdc
at: (POINT)p
{
HFONT old;
WORD buf[len];
int i;
/*
* For now, assume that a glyph is a unicode character and can be
* stored in a windows WORD
*/
for (i = 0; i < len; i++)
{
buf[i] = s[i];
}
old = SelectObject(hdc, hFont);
TextOutW(hdc, p.x, p.y - ascender, buf, len);
SelectObject(hdc, old);
}
@end
@implementation WIN32FontInfo (Private)

View file

@ -714,6 +714,26 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
onDC: hDC at: p];
[self releaseHDC: hDC];
}
- (void) GSShowGlyphs: (const NSGlyph *)glyphs : (size_t)length
{
NSPoint current = [path currentPoint];
POINT p;
HDC hDC;
hDC = [self getHDC];
if (!hDC)
{
return;
}
p = GSWindowPointToMS(self, current);
[(WIN32FontInfo*)font drawGlyphs: glyphs
length: length
onDC: hDC
at: p];
[self releaseHDC: hDC];
}
@end
@implementation WIN32GState (GStateOps)