14 #include <wtf/Assertions.h> 15 #include <wtf/text/WTFString.h> 16 #include <wtf/text/CString.h> 17 18 namespace WebCore { 19 20 void Font::platformInit() 21 { 22 JNIEnv* env = WebCore_GetJavaEnv(); 23 24 RefPtr<RQRef> jFont = m_platformData.nativeFontData(); 25 if (!jFont) 26 return; 27 28 static jmethodID getXHeight_mID = env->GetMethodID(PG_GetFontClass(env), 29 "getXHeight", "()F"); 30 ASSERT(getXHeight_mID); 31 m_fontMetrics.setXHeight(env->CallFloatMethod(*jFont, getXHeight_mID)); 32 CheckAndClearException(env); 33 34 static jmethodID getAscent_mID = env->GetMethodID(PG_GetFontClass(env), 35 "getAscent", "()F"); 36 ASSERT(getAscent_mID); 37 m_fontMetrics.setAscent(env->CallFloatMethod(*jFont, getAscent_mID)); 38 CheckAndClearException(env); 39 40 static jmethodID getDescent_mID = env->GetMethodID(PG_GetFontClass(env), 41 "getDescent", "()F"); 42 ASSERT(getDescent_mID); 43 m_fontMetrics.setDescent(env->CallFloatMethod(*jFont, getDescent_mID)); 44 CheckAndClearException(env); 45 46 static jmethodID getLineSpacing_mID = env->GetMethodID(PG_GetFontClass(env), 47 "getLineSpacing", "()F"); 48 ASSERT(getLineSpacing_mID); 49 m_fontMetrics.setLineSpacing(env->CallFloatMethod(*jFont, getLineSpacing_mID)); 50 CheckAndClearException(env); 51 52 static jmethodID getLineGap_mID = env->GetMethodID(PG_GetFontClass(env), 53 "getLineGap", "()F"); | 14 #include <wtf/Assertions.h> 15 #include <wtf/text/WTFString.h> 16 #include <wtf/text/CString.h> 17 18 namespace WebCore { 19 20 void Font::platformInit() 21 { 22 JNIEnv* env = WebCore_GetJavaEnv(); 23 24 RefPtr<RQRef> jFont = m_platformData.nativeFontData(); 25 if (!jFont) 26 return; 27 28 static jmethodID getXHeight_mID = env->GetMethodID(PG_GetFontClass(env), 29 "getXHeight", "()F"); 30 ASSERT(getXHeight_mID); 31 m_fontMetrics.setXHeight(env->CallFloatMethod(*jFont, getXHeight_mID)); 32 CheckAndClearException(env); 33 34 static jmethodID getCapHeight_mID = env->GetMethodID(PG_GetFontClass(env), 35 "getCapHeight", "()F"); 36 ASSERT(getCapHeight_mID); 37 m_fontMetrics.setCapHeight(env->CallFloatMethod(*jFont, getCapHeight_mID)); 38 CheckAndClearException(env); 39 40 static jmethodID getAscent_mID = env->GetMethodID(PG_GetFontClass(env), 41 "getAscent", "()F"); 42 ASSERT(getAscent_mID); 43 m_fontMetrics.setAscent(env->CallFloatMethod(*jFont, getAscent_mID)); 44 CheckAndClearException(env); 45 46 static jmethodID getDescent_mID = env->GetMethodID(PG_GetFontClass(env), 47 "getDescent", "()F"); 48 ASSERT(getDescent_mID); 49 m_fontMetrics.setDescent(env->CallFloatMethod(*jFont, getDescent_mID)); 50 CheckAndClearException(env); 51 52 static jmethodID getLineSpacing_mID = env->GetMethodID(PG_GetFontClass(env), 53 "getLineSpacing", "()F"); 54 ASSERT(getLineSpacing_mID); 55 m_fontMetrics.setLineSpacing(env->CallFloatMethod(*jFont, getLineSpacing_mID)); 56 CheckAndClearException(env); 57 58 static jmethodID getLineGap_mID = env->GetMethodID(PG_GetFontClass(env), 59 "getLineGap", "()F"); |