mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Use new unicode functions for conversion
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13226 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fdad82ad07
commit
54f371d559
2 changed files with 21 additions and 16 deletions
|
@ -1,3 +1,8 @@
|
|||
2002-03-24 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSStringDrawing.m (drawRun): Use new unicode functions
|
||||
for string conversion (patch from yjchen@ms7.url.com.tw).
|
||||
|
||||
Mon Mar 25 00:12:05 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Source/GSSimpleLayoutManager.m ([-setNeedsDisplayForLineRange:inTextContainer:]):
|
||||
|
|
|
@ -210,29 +210,29 @@ drawRun(GSTextRun *run, NSPoint origin, GSDrawInfo *draw)
|
|||
*/
|
||||
if (run->kern == 0)
|
||||
{
|
||||
char buf[run->glyphCount + 1];
|
||||
unsigned i;
|
||||
NSStringEncoding enc = draw->enc;
|
||||
|
||||
// glyph is an unicode char value
|
||||
// if the font has non-standard encoding we need to remap it.
|
||||
if ((enc != NSASCIIStringEncoding) &&
|
||||
(enc != NSUnicodeStringEncoding))
|
||||
unichar u[run->glyphCount];
|
||||
char *r;
|
||||
unsigned l = run->glyphCount;
|
||||
unsigned s = 0;
|
||||
|
||||
for (i = 0; i < run->glyphCount; i++)
|
||||
u[i] = run->glyphs[i].glyph;
|
||||
|
||||
if (GSFromUnicode((unsigned char**)&r, &s, u, l, enc,
|
||||
NSDefaultMallocZone(), GSUniTerminate) == NO)
|
||||
{
|
||||
// FIXME: This only works for 8-Bit characters
|
||||
for (i = 0; i < run->glyphCount; i++)
|
||||
{
|
||||
buf[i] = encode_unitochar(run->glyphs[i].glyph, enc);
|
||||
}
|
||||
}
|
||||
else
|
||||
for (i = 0; i < run->glyphCount; i++)
|
||||
{
|
||||
buf[i] = run->glyphs[i].glyph;
|
||||
}
|
||||
buf[i] = '\0';
|
||||
[NSException raise: NSCharacterConversionException
|
||||
format: @"Can't convert to/from Unicode string."];
|
||||
}
|
||||
|
||||
DPSmoveto(draw->ctxt, origin.x, origin.y);
|
||||
DPSshow(draw->ctxt, buf);
|
||||
if (l)
|
||||
DPSshow(draw->ctxt, r);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue