Hi everybody, Is there anybody who has worked on Fonts in j2me. Actually i want to write some text on the canvas screen using drawString() method of Graphics class but in the font of my choice. waiting for the reply.. Rishi [ August 29, 2002: Message edited by: Rishi Tyagi ]
posted 14 years ago
font are limited. you must first try to get a font, if available from the device. the method is static Font getFont (int face, int style, int size); e.g the 4 styles are: STYLE_BOLD, STYLE_ITALIC, STYLE_PLAIN, STYLE_UNDERLINED the sizes are: SIZE_LARGE, SIZE_MEDIUM, SIZE_SMALL the faces are: FACE_MONOSPACE, FACE_PROPORTIONAL,FACE_SYSTEM Font theFont=Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_LARGE); on the Graphics class you are using, use the method: void setFont(Font theFont) for example: g.setFont (theFont) then use the drawString() method as usual to draw the text.