* Source/gsc/GSStreamContext.m (-GSShowGlyphs::): Implement to use

glyphshow if font gives back glyph names, otherwise use previous
hack.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@15919 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-02-10 04:32:38 +00:00
parent b1350d091a
commit 3cdcb6e0b9
2 changed files with 46 additions and 18 deletions

View file

@ -1,3 +1,9 @@
2003-02-09 Adam Fedor <fedor@gnu.org>
* Source/gsc/GSStreamContext.m (-GSShowGlyphs::): Implement to use
glyphshow if font gives back glyph names, otherwise use previous
hack.
2003-02-09 Fred Kiefer <FredKiefer@gmx.de>
* Source/gsc/GSStreamContext.m

View file

@ -43,6 +43,7 @@
@interface GSStreamContext (Private)
- (void) output: (const char*)s length: (size_t)length;
- (void) output: (const char*)s;
@end
@ -204,6 +205,7 @@
fprintf(gstream, "/%s findfont ", [[(GSFontInfo *)fontref fontName] cString]);
fprintf(gstream, "[%g %g %g %g %g %g] ", m[0], m[1], m[2], m[3], m[4], m[5]);
fprintf(gstream, " makefont setfont\n");
[super GSSetFont: fontref];
}
- (void) GSSetFontSize: (float)size
@ -213,22 +215,38 @@
- (void) GSShowText: (const char *)string : (size_t)length
{
[self notImplemented: _cmd];
fprintf(gstream, "(");
[self output:string length: length];
fprintf(gstream, ") show\n");
}
- (void) GSShowGlyphs: (const NSGlyph *)glyphs : (size_t)length
{
// HACK to get some print output until the new glyph text system is fully implemented
char string[length+1];
int i;
for (i = 0; i < length; i++)
{
string[i] = glyphs[i];
}
string[length] = 0;
[self DPSshow: string];
// [self notImplemented: _cmd];
GSFontInfo *font = gstate->font;
if ([font respondsToSelector: @selector(nameOfGlyph:)])
{
int i;
for (i = 0; i < length; i++)
{
fprintf(gstream, "/%s glyphshow\n",[font nameOfGlyph: glyphs[i]]);
}
}
else
{
/* If backend doesn't handle nameOfGlyph, assume the glyphs are
just mapped to characters. This is the case for the xlib backend
(at least for now). */
char string[length+1];
int i;
for (i = 0; i < length; i++)
{
string[i] = glyphs[i];
}
string[length] = 0;
[self DPSshow: string];
}
}
@ -768,13 +786,13 @@ writeHex(FILE *gstream, const unsigned char *data, int count)
@implementation GSStreamContext (Private)
- (void) output: (const char*)s
- (void) output: (const char*)s length: (size_t)length
{
const char *t = s;
int i;
while (*t)
for (i = 0; i < length; i++)
{
switch (*t)
switch (s[i])
{
case '(':
fputs("\\(", gstream);
@ -783,11 +801,15 @@ writeHex(FILE *gstream, const unsigned char *data, int count)
fputs("\\)", gstream);
break;
default:
fputc(*t, gstream);
fputc(s[i], gstream);
break;
}
t++;
}
}
- (void) output: (const char*)s
{
[self output: s length: strlen(s)];
}
@end