tags:

views:

20

answers:

1

Hi, Hope you all will be fine. Can any one tell me how can i get the fonts installed or supported in the mobile. And suppose urdu font supported by the mobile then i set a condition like this.

[code]

import java.lang.*;

String  value;
String  key = "microedition.font"; // not real need value it's just to show what i want

value   = System.getProperty( key );

    If (value == urdu){
        txtArea2.getStyle.setFont(value);
    } else {
      System.out.println("Urdu not supported);
      }

[/code]

is it possible to do something like this.

Thank you.

+1  A: 

Hello, MIDP 2.x defines 3 faces of font with 3 sizes + 3 styles.

  • FACE_MONOSPACE
  • FACE_PROPORTIONAL
  • FACE_SYSTEM
  • SIZE_LARGE
  • SIZE_MEDIUM
  • SIZE_SMALL
  • STYLE_BOLD
  • STYLE_ITALIC
  • STYLE_UNDERLINED

You can choose font by using these values as like the below code:

Font f = Font.getFont(FACE_SYSTEM | SIZE_MEDIUM | STYLE_ITALIC);

From MIDP 3.0, you can assign font name with installed font or downloaded font. as like:

Font[] f = Font.getAvailableFonts(); // Get available fonts
Font a = Font.getFont("Andale Mono", STYLE_ITALIC, 10); // Get specific font

Unfortunately, there is no development tools for MIDP3 now.

Wonil
Thanks for your reply. But my problem has solved with FACE_SYSTEM. I think FACE_SYSTEM uses system font(font supported/installed by your mobile). Firstly i was using FACE_PROPORTIONAL but when i change it to FACE_SYSTEM every thing going to work fine.Thanks :)
Basit