X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libjava%2Fgnu%2Fgcj%2Fxlib%2FnatFont.cc;fp=libjava%2Fgnu%2Fgcj%2Fxlib%2FnatFont.cc;h=0000000000000000000000000000000000000000;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=7bfea7b17f89c8d0e93beda0c15de587b036b28b;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libjava/gnu/gcj/xlib/natFont.cc b/libjava/gnu/gcj/xlib/natFont.cc deleted file mode 100644 index 7bfea7b1..00000000 --- a/libjava/gnu/gcj/xlib/natFont.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -#include - -#include -#include -#include - -#include -#include -#include - -gnu::gcj::RawData* gnu::gcj::xlib::Font::loadFont(Display* display, - jstring lfdNamePattern) -{ - ::Display* dpy = (::Display*) display->display; - int len = JvGetStringUTFLength(lfdNamePattern); - char cName[len+1]; - JvGetStringUTFRegion(lfdNamePattern, 0, lfdNamePattern->length(), - cName); - cName[len] = '\0'; - - XFontStruct* fontStruct = XLoadQueryFont(dpy, cName); - if (fontStruct == 0) - { - throw new XException(JvNewStringLatin1("font not found")); - } - - return reinterpret_cast(fontStruct); -} - -jint gnu::gcj::xlib::Font::getXIDFromStruct(gnu::gcj::RawData* structure) -{ - XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->fid; -} - -jint gnu::gcj::xlib::Font::getMaxAscent() -{ - XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->max_bounds.ascent; -} - -jint gnu::gcj::xlib::Font::getMaxDescent() -{ - XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->max_bounds.descent; -} - -jint gnu::gcj::xlib::Font::getAscent() -{ - XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->ascent; -} - -jint gnu::gcj::xlib::Font::getDescent() -{ - XFontStruct* fontStruct = (XFontStruct*) structure; - return fontStruct->ascent; -} - -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; -} - -void gnu::gcj::xlib::Font::finalize() -{ - if (structure != 0) - { - ::Display* dpy = (::Display*) display->display; - XFontStruct* fontStruct = (XFontStruct*) structure; - int result = XFreeFont(dpy, fontStruct); - - if (result == BadFont) - throw new XException(display, result); - - structure = 0; xid = 0; - } -} -