< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Font.cpp

Print this page




 266             compFont = GetComponentFonts(env, font);
 267             if (compFont != NULL) {
 268                 cfnum = env->GetArrayLength(compFont);
 269             }
 270         } else {
 271             compFont = NULL;
 272             cfnum = 0;
 273         }
 274 
 275         LPCWSTR wName = NULL;
 276 
 277         awtFont = new AwtFont(cfnum, env, font);
 278 
 279         awtFont->textAngle = angle;
 280         awtFont->awScale = awScale;
 281 
 282         if (cfnum > 0) {
 283             // Ask peer class for the text component font name
 284             jstring jTextComponentFontName = GetTextComponentFontName(env, font);
 285             if (jTextComponentFontName == NULL) {

 286                 return NULL;
 287             }
 288             LPCWSTR textComponentFontName = JNU_GetStringPlatformChars(env, jTextComponentFontName, NULL);
 289 
 290             awtFont->m_textInput = -1;
 291             for (int i = 0; i < cfnum; i++) {
 292                 // nativeName is a pair of platform fontname and its charset
 293                 // tied with a comma; "Times New Roman,ANSI_CHARSET".
 294                 jobject fontDescriptor = env->GetObjectArrayElement(compFont,
 295                                                                     i);
 296                 jstring nativeName =
 297                     (jstring)env->GetObjectField(fontDescriptor,
 298                                                  AwtFont::nativeNameID);
 299                 wName = JNU_GetStringPlatformChars(env, nativeName, NULL);
 300                 DASSERT(wName);
 301                 if (wName == NULL) {
 302                     wName = L"Arial";
 303                 }
 304 
 305                 //On NT platforms, if the font is not Symbol or Dingbats




 266             compFont = GetComponentFonts(env, font);
 267             if (compFont != NULL) {
 268                 cfnum = env->GetArrayLength(compFont);
 269             }
 270         } else {
 271             compFont = NULL;
 272             cfnum = 0;
 273         }
 274 
 275         LPCWSTR wName = NULL;
 276 
 277         awtFont = new AwtFont(cfnum, env, font);
 278 
 279         awtFont->textAngle = angle;
 280         awtFont->awScale = awScale;
 281 
 282         if (cfnum > 0) {
 283             // Ask peer class for the text component font name
 284             jstring jTextComponentFontName = GetTextComponentFontName(env, font);
 285             if (jTextComponentFontName == NULL) {
 286                 delete awtFont;
 287                 return NULL;
 288             }
 289             LPCWSTR textComponentFontName = JNU_GetStringPlatformChars(env, jTextComponentFontName, NULL);
 290 
 291             awtFont->m_textInput = -1;
 292             for (int i = 0; i < cfnum; i++) {
 293                 // nativeName is a pair of platform fontname and its charset
 294                 // tied with a comma; "Times New Roman,ANSI_CHARSET".
 295                 jobject fontDescriptor = env->GetObjectArrayElement(compFont,
 296                                                                     i);
 297                 jstring nativeName =
 298                     (jstring)env->GetObjectField(fontDescriptor,
 299                                                  AwtFont::nativeNameID);
 300                 wName = JNU_GetStringPlatformChars(env, nativeName, NULL);
 301                 DASSERT(wName);
 302                 if (wName == NULL) {
 303                     wName = L"Arial";
 304                 }
 305 
 306                 //On NT platforms, if the font is not Symbol or Dingbats


< prev index next >