text=(const char *)env->GetStringUTFChars(str, NULL);
JNI::String text(str);
void Java_vdr_mhp_awt_MHPFontPeer_getTextMetrics(JNIEnv* env, jobject obj, jlong nativeData, jstring str, jdoubleArray java_metrics) {   IDirectFBFont *font = (IDirectFBFont *)nativeData;   jdouble *native_metrics;   const char *text;   DFBRectangle logicalRectangle;      if (!font) {      JNI::Exception::Throw(JNI::JavaLangNullPointerException, "IDirectFBFont is NULL");      return;   }      text=(const char *)env->GetStringUTFChars(str, NULL);      //GTK's implementation uses Pango which has similar semantics,   //such as a logical rectangle and an ink rectangle. I just do it as they did it.   font->GetStringExtents(text, env->GetStringUTFLength(str), &logicalRectangle, NULL);      native_metrics = env->GetDoubleArrayElements (java_metrics, NULL);   native_metrics[TEXT_METRICS_X_BEARING] = (double) logicalRectangle.x;        // = PANGO_PIXELS( ((double)log.x) );   native_metrics[TEXT_METRICS_Y_BEARING] = (double) logicalRectangle.y;        // = PANGO_PIXELS( ((double)log.y) );   native_metrics[TEXT_METRICS_WIDTH] = (double) logicalRectangle.w;        // = PANGO_PIXELS( ((double)log.width) );   native_metrics[TEXT_METRICS_HEIGHT] = (double) logicalRectangle.h;        // = PANGO_PIXELS( ((double)log.height) );   native_metrics[TEXT_METRICS_X_ADVANCE] = (double) (logicalRectangle.x + logicalRectangle.w);        // = PANGO_PIXELS( ((double) (log.x + log.width)) );   native_metrics[TEXT_METRICS_Y_ADVANCE] = (double) (logicalRectangle.y + logicalRectangle.h);        // = PANGO_PIXELS( ((double) (log.y + log.height)) );	    env->ReleaseDoubleArrayElements (java_metrics, native_metrics, 0);}