/* Font.cxx * * Copyright (c) 2003, Tuomas J. Lukka * This file is part of LibVob. * * LibVob is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibVob is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with LibVob; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * */ /* * Written by Tuomas J. Lukka */ #include #include #include #include #include #include #include "org_nongnu_libvob_gl_GL.h" #include "vobjnidef.hxx" namespace Vob { namespace JNI { extern "C" { jf( jint , createFontImpl) (JNIEnv *env, jclass, jstring file, jint pt) { DBG(dbg) << "creatFontImpl\n"; setWindow(); std::string utf = jstr2stdstr(env, file); GLMosaicText::Font *gf0 = new GLMosaicText::FTFont(utf.c_str(), pt); GLMosaicText::Font *gf = new GLMosaicText::Font_Bordered( gf0, 10); RealFont *f = new RealFont(gf); releaseWindow(); return textrenderers.add(f); } jf( jfloat , getFontHeight) (JNIEnv *, jclass, jint i) { return textrenderers.get(i)->f->getLineHeight(); } jf( jfloat , getFontYOffs) (JNIEnv *, jclass, jint i) { return textrenderers.get(i)->f->getLineOffset(); } jf( void , deleteFont) (JNIEnv *, jclass, jint i) { textrenderers.remove(i); } jf( void , putFontWidths) (JNIEnv *env, jclass, jint fontId, jfloatArray widths) { int arrayLength = env->GetArrayLength(widths); jfloat *w = env->GetFloatArrayElements(widths, 0); RealFont *font = textrenderers.get(fontId); for(int i=0; igetGlyphWidth(i); } env->ReleaseFloatArrayElements(widths, w, 0); } } } }