Java Doc for Font.java in  » 6.0-JDK-Modules » j2me » javax » microedition » lcdui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.lcdui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.microedition.lcdui.Font

Font
final public class Font (Code)
The Font class represents fonts and font metrics. Fonts cannot be created by applications. Instead, applications query for fonts based on font attributes and the system will attempt to provide a font that matches the requested attributes as closely as possible.

A Font's attributes are style, size, and face. Values for attributes must be specified in terms of symbolic constants. Values for the style attribute may be combined using the bit-wise OR operator, whereas values for the other attributes may not be combined. For example, the value

STYLE_BOLD | STYLE_ITALIC

may be used to specify a bold-italic font; however

SIZE_LARGE | SIZE_SMALL

is illegal.

The values of these constants are arranged so that zero is valid for each attribute and can be used to specify a reasonable default font for the system. For clarity of programming, the following symbolic constants are provided and are defined to have values of zero:

  • STYLE_PLAIN
  • SIZE_MEDIUM
  • FACE_SYSTEM

Values for other attributes are arranged to have disjoint bit patterns in order to raise errors if they are inadvertently misused (for example, using FACE_PROPORTIONAL where a style is required). However, the values for the different attributes are not intended to be combined with each other.


since:
   MIDP 1.0


Field Summary
final public static  intFACE_MONOSPACE
     The "monospace" font face.
final public static  intFACE_PROPORTIONAL
     The "proportional" font face.
final public static  intFACE_SYSTEM
     The "system" font face.
final public static  intFONT_INPUT_TEXT
     Font specifier used by the implementation to draw text input by a user.
final public static  intFONT_STATIC_TEXT
     Default font specifier used to draw Item and Screen contents.
final public static  intSIZE_LARGE
     The "large" system-dependent font size.
final public static  intSIZE_MEDIUM
     The "medium" system-dependent font size.
final public static  intSIZE_SMALL
     The "small" system-dependent font size.
final public static  intSTYLE_BOLD
     The bold style constant.
final public static  intSTYLE_ITALIC
     The italicized style constant.
final public static  intSTYLE_PLAIN
     The plain style constant.
final public static  intSTYLE_UNDERLINED
     The underlined style constant.


Method Summary
native public  intcharWidth(char ch)
     Gets the advance width of the specified character in this Font.
native public  intcharsWidth(char[] ch, int offset, int length)
     Returns the advance width of the characters in ch, starting at the specified offset and for the specified number of characters (length). The advance width is the horizontal distance that would be occupied if the characters were to be drawn using this Font, including inter-character spacing following the characters necessary for proper positioning of subsequent text.

The offset and length parameters must specify a valid range of characters within the character array ch.

public  intgetBaselinePosition()
     Gets the distance in pixels from the top of the text to the text's baseline.
public static  FontgetDefaultFont()
     Gets the default font of the system.
public  intgetFace()
     Gets the face of the font.
public static  FontgetFont(int fontSpecifier)
     Gets the Font used by the high level user interface for the fontSpecifier passed in.
public static  FontgetFont(int inp_face, int inp_style, int inp_size)
     Obtains an object representing a font having the specified face, style, and size.
public  intgetHeight()
     Gets the standard height of a line of text in this font.
public  intgetSize()
     Gets the size of the font.
public  intgetStyle()
     Gets the style of the font.
public  booleanisBold()
     Returns true if the font is bold.
public  booleanisItalic()
     Returns true if the font is italic.
public  booleanisPlain()
     Returns true if the font is plain.
public  booleanisUnderlined()
     Returns true if the font is underlined.
native public  intstringWidth(java.lang.String str)
     Gets the total advance width for showing the specified String in this Font.
native public  intsubstringWidth(String str, int offset, int len)
     Gets the total advance width for showing the specified substring in this Font. The advance width is the horizontal distance that would be occupied if the substring were to be drawn using this Font, including inter-character spacing following the substring necessary for proper positioning of subsequent text.

The offset and len parameters must specify a valid range of characters within str.


Field Detail
FACE_MONOSPACE
final public static int FACE_MONOSPACE(Code)
The "monospace" font face.

Value 32 is assigned to FACE_MONOSPACE.




FACE_PROPORTIONAL
final public static int FACE_PROPORTIONAL(Code)
The "proportional" font face.

Value 64 is assigned to FACE_PROPORTIONAL.




FACE_SYSTEM
final public static int FACE_SYSTEM(Code)
The "system" font face.

Value 0 is assigned to FACE_SYSTEM.




FONT_INPUT_TEXT
final public static int FONT_INPUT_TEXT(Code)
Font specifier used by the implementation to draw text input by a user. FONT_INPUT_TEXT has the value 1.
See Also:   Font.getFont(int fontSpecifier)



FONT_STATIC_TEXT
final public static int FONT_STATIC_TEXT(Code)
Default font specifier used to draw Item and Screen contents. FONT_STATIC_TEXT has the value 0.
See Also:   Font.getFont(int fontSpecifier)



SIZE_LARGE
final public static int SIZE_LARGE(Code)
The "large" system-dependent font size.

Value 16 is assigned to SIZE_LARGE.




SIZE_MEDIUM
final public static int SIZE_MEDIUM(Code)
The "medium" system-dependent font size.

Value 0 is assigned to STYLE_MEDIUM.




SIZE_SMALL
final public static int SIZE_SMALL(Code)
The "small" system-dependent font size.

Value 8 is assigned to STYLE_SMALL.




STYLE_BOLD
final public static int STYLE_BOLD(Code)
The bold style constant. This may be combined with the other style constants for mixed styles.

Value 1 is assigned to STYLE_BOLD.




STYLE_ITALIC
final public static int STYLE_ITALIC(Code)
The italicized style constant. This may be combined with the other style constants for mixed styles.

Value 2 is assigned to STYLE_ITALIC.




STYLE_PLAIN
final public static int STYLE_PLAIN(Code)
The plain style constant. This may be combined with the other style constants for mixed styles.

Value 0 is assigned to STYLE_PLAIN.




STYLE_UNDERLINED
final public static int STYLE_UNDERLINED(Code)
The underlined style constant. This may be combined with the other style constants for mixed styles.

Value 4 is assigned to STYLE_UNDERLINED.






Method Detail
charWidth
native public int charWidth(char ch)(Code)
Gets the advance width of the specified character in this Font. The advance width is the horizontal distance that would be occupied if ch were to be drawn using this Font, including inter-character spacing following ch necessary for proper positioning of subsequent text.
Parameters:
  ch - the character to be measured the total advance width (a non-negative value)



charsWidth
native public int charsWidth(char[] ch, int offset, int length)(Code)
Returns the advance width of the characters in ch, starting at the specified offset and for the specified number of characters (length). The advance width is the horizontal distance that would be occupied if the characters were to be drawn using this Font, including inter-character spacing following the characters necessary for proper positioning of subsequent text.

The offset and length parameters must specify a valid range of characters within the character array ch. The offset parameter must be within the range [0..(ch.length)], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= ch.length.


Parameters:
  ch - the array of characters
Parameters:
  offset - the index of the first character to measure
Parameters:
  length - the number of characters to measure the width of the character range
throws:
  ArrayIndexOutOfBoundsException - if offset andlength specify aninvalid range
throws:
  NullPointerException - if ch is null



getBaselinePosition
public int getBaselinePosition()(Code)
Gets the distance in pixels from the top of the text to the text's baseline. the distance in pixels from the top of the text to the text'sbaseline



getDefaultFont
public static Font getDefaultFont()(Code)
Gets the default font of the system. the default font



getFace
public int getFace()(Code)
Gets the face of the font. one of FACE_SYSTEM,FACE_PROPORTIONAL, FACE_MONOSPACE



getFont
public static Font getFont(int fontSpecifier)(Code)
Gets the Font used by the high level user interface for the fontSpecifier passed in. It should be used by subclasses of CustomItem and Canvas to match user interface on the device.
Parameters:
  fontSpecifier - one of FONT_INPUT_TEXT, orFONT_STATIC_TEXT font that corresponds to the passed in font specifier
throws:
  IllegalArgumentException - if fontSpecifier is not a valid fontSpecifier



getFont
public static Font getFont(int inp_face, int inp_style, int inp_size)(Code)
Obtains an object representing a font having the specified face, style, and size. If a matching font does not exist, the system will attempt to provide the closest match. This method always returns a valid font object, even if it is not a close match to the request.
Parameters:
  inp_face - one of FACE_SYSTEM,FACE_MONOSPACE, or FACE_PROPORTIONAL
Parameters:
  inp_style - STYLE_PLAIN, or a combination ofSTYLE_BOLD,STYLE_ITALIC, and STYLE_UNDERLINED
Parameters:
  inp_size - one of SIZE_SMALL, SIZE_MEDIUM,or SIZE_LARGE instance the nearest font found
throws:
  IllegalArgumentException - if face, style, or size are notlegal values



getHeight
public int getHeight()(Code)
Gets the standard height of a line of text in this font. This value includes sufficient spacing to ensure that lines of text painted this distance from anchor point to anchor point are spaced as intended by the font designer and the device. This extra space (leading) occurs below the text. standard height of a line of text in this font (a non-negative value)



getSize
public int getSize()(Code)
Gets the size of the font. one of SIZE_SMALL, SIZE_MEDIUM,SIZE_LARGE



getStyle
public int getStyle()(Code)
Gets the style of the font. The value is an OR'ed combination of STYLE_BOLD, STYLE_ITALIC, and STYLE_UNDERLINED; or the value is zero (STYLE_PLAIN). style of the current font
See Also:   Font.isPlain()
See Also:   Font.isBold()
See Also:   Font.isItalic()



isBold
public boolean isBold()(Code)
Returns true if the font is bold.
See Also:   Font.getStyle() true if font is bold



isItalic
public boolean isItalic()(Code)
Returns true if the font is italic.
See Also:   Font.getStyle() true if font is italic



isPlain
public boolean isPlain()(Code)
Returns true if the font is plain.
See Also:   Font.getStyle() true if font is plain



isUnderlined
public boolean isUnderlined()(Code)
Returns true if the font is underlined.
See Also:   Font.getStyle() true if font is underlined



stringWidth
native public int stringWidth(java.lang.String str)(Code)
Gets the total advance width for showing the specified String in this Font. The advance width is the horizontal distance that would be occupied if str were to be drawn using this Font, including inter-character spacing following str necessary for proper positioning of subsequent text.
Parameters:
  str - the String to be measured the total advance width
throws:
  NullPointerException - if str is null



substringWidth
native public int substringWidth(String str, int offset, int len)(Code)
Gets the total advance width for showing the specified substring in this Font. The advance width is the horizontal distance that would be occupied if the substring were to be drawn using this Font, including inter-character spacing following the substring necessary for proper positioning of subsequent text.

The offset and len parameters must specify a valid range of characters within str. The offset parameter must be within the range [0..(str.length())], inclusive. The len parameter must be a non-negative integer such that (offset + len) <= str.length().


Parameters:
  str - the String to be measured
Parameters:
  offset - zero-based index of first character in the substring
Parameters:
  len - length of the substring the total advance width
throws:
  StringIndexOutOfBoundsException - if offset andlength specify aninvalid range
throws:
  NullPointerException - if str is null



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.