natFont.cc (getStringWidth): Support 16-bit characters.
2003-04-19 Scott Gilbertson <scottg@mantatest.com> * libjava/gnu/gcj/xlib/natFont.cc (getStringWidth): Support 16-bit characters. * libjava/gnu/gcj/xlib/natGC.cc (drawString): Support 16-bit characters. From-SVN: r65820
This commit is contained in:
parent
6f572ac229
commit
3b2288059d
@ -1,3 +1,10 @@
|
||||
2003-04-19 Scott Gilbertson <scottg@mantatest.com>
|
||||
|
||||
* libjava/gnu/gcj/xlib/natFont.cc (getStringWidth): Support 16-bit
|
||||
characters.
|
||||
* libjava/gnu/gcj/xlib/natGC.cc (drawString): Support 16-bit
|
||||
characters.
|
||||
|
||||
2003-04-16 Richard Earnshaw <rearnsha@arm.com>
|
||||
|
||||
* java/lang/ieeefp.h: Handle ARM platforms that have pure-endian
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation
|
||||
/* Copyright (C) 2000, 2003 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
@ -69,13 +69,21 @@ jint gnu::gcj::xlib::Font::getStringWidth(java::lang::String* text)
|
||||
{
|
||||
XFontStruct* fontStruct = (XFontStruct*) structure;
|
||||
|
||||
// FIXME: make proper unicode conversion
|
||||
int len = JvGetStringUTFLength(text);
|
||||
char ctxt[len+1];
|
||||
JvGetStringUTFRegion(text, 0, text->length(), ctxt);
|
||||
ctxt[len] = '\0';
|
||||
int width = XTextWidth(fontStruct, ctxt, len);
|
||||
return width;
|
||||
// FIXME: Convert to the character set used in the font, which may
|
||||
// or may not be unicode. For now, treat everything as 16-bit and
|
||||
// use character codes directly, which should be OK for unicode or
|
||||
// 8-bit ascii fonts.
|
||||
jint length = text->length();
|
||||
jchar* txt = JvGetStringChars(text);
|
||||
XChar2b xwchars[length];
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
XChar2b* xc = &(xwchars[i]);
|
||||
jchar jc = txt[i];
|
||||
xc->byte1 = (jc >> 8) & 0xff;
|
||||
xc->byte2 = jc & 0xff;
|
||||
}
|
||||
return XTextWidth16(fontStruct, xwchars, length);
|
||||
}
|
||||
|
||||
void gnu::gcj::xlib::Font::finalize()
|
||||
|
@ -95,27 +95,25 @@ void gnu::gcj::xlib::GC::drawString(jstring text, jint x, jint y)
|
||||
::Drawable drawableXID = target->getXID();
|
||||
::GC gc = (::GC) structure;
|
||||
|
||||
/*
|
||||
FIXME: do something along the lines of the following instead:
|
||||
jint length = text->length();
|
||||
jchar* txt = JvGetStringChars(text);
|
||||
|
||||
jint length = text->length();
|
||||
jchar* txt = JvGetStringChars(text);
|
||||
|
||||
XChar2b xwchars[length];
|
||||
XChar2b xwchars[length];
|
||||
|
||||
// FIXME: Add convertion and caching
|
||||
// FIXME: Convert to the character set used in the font, which may
|
||||
// or may not be unicode. For now, treat everything as 16-bit and
|
||||
// use character codes directly, which should be OK for unicode or
|
||||
// 8-bit ascii fonts.
|
||||
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
XChar2b* xc = &(xwchars[i]);
|
||||
jchar jc = txt[i];
|
||||
xc->byte1 = jc & 0xff;
|
||||
xc->byte2 = jc >> 8;
|
||||
}
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
XChar2b* xc = &(xwchars[i]);
|
||||
jchar jc = txt[i];
|
||||
xc->byte1 = (jc >> 8) & 0xff;
|
||||
xc->byte2 = jc & 0xff;
|
||||
}
|
||||
XDrawString16(dpy, drawableXID, gc, x, y, xwchars, length);
|
||||
|
||||
XDrawString16(dpy, drawableXID, gc, x, y, xwchars, length);
|
||||
*/
|
||||
|
||||
// FIXME, temporary code:
|
||||
int len = JvGetStringUTFLength(text);
|
||||
char ctxt[len+1];
|
||||
|
Loading…
Reference in New Issue
Block a user