📄 font.html
字号:
getDefaultFont</H3>
<PRE>
public static <A HREF="../../../javax/microedition/lcdui/Font.html">Font</A> <B>getDefaultFont</B>()</PRE>
<DL>
<DD>Gets the default font of the system.<DD><DL>
<DT><B>Returns:</B><DD>the default font</DL>
</DD>
</DL>
<HR>
<A NAME="getFont(int, int, int)"><!-- --></A><H3>
getFont</H3>
<PRE>
public static <A HREF="../../../javax/microedition/lcdui/Font.html">Font</A> <B>getFont</B>(int face, int style, int size)</PRE>
<DL>
<DD>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 <em>always</em> returns a valid font object, even if it is not a close match to the request.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>face</CODE> - one of <code>FACE_SYSTEM</code>, <code>FACE_MONOSPACE</code>, or <code>FACE_PROPORTIONAL</code><DD><CODE>style</CODE> - <code>STYLE_PLAIN</code>, or a combination of <code>STYLE_BOLD</code>, <code>STYLE_ITALIC</code>, and <code>STYLE_UNDERLINED</code><DD><CODE>size</CODE> - one of <code>SIZE_SMALL</code>, <code>SIZE_MEDIUM</code>, or <code>SIZE_LARGE</code><DT><B>Returns:</B><DD>instance the nearest font found<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>face</code>, <code>style</code>, or <code>size</code> are not legal values</DL>
</DD>
</DL>
<HR>
<A NAME="getStyle()"><!-- --></A><H3>
getStyle</H3>
<PRE>
public int <B>getStyle</B>()</PRE>
<DL>
<DD>Gets the style of the font. The value is an <code>OR'ed</code> combination of <code>STYLE_BOLD</code>, <code>STYLE_ITALIC</code>, and <code>STYLE_UNDERLINED</code>; or the value is zero (<code>STYLE_PLAIN</code>).<DD><DL>
<DT><B>Returns:</B><DD>style of the current font<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Font.html#isPlain()"><CODE>isPlain()</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Font.html#isBold()"><CODE>isBold()</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Font.html#isItalic()"><CODE>isItalic()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getSize()"><!-- --></A><H3>
getSize</H3>
<PRE>
public int <B>getSize</B>()</PRE>
<DL>
<DD>Gets the size of the font.<DD><DL>
<DT><B>Returns:</B><DD>one of <code>SIZE_SMALL</code>, <code>SIZE_MEDIUM</code>, <code>SIZE_LARGE</code></DL>
</DD>
</DL>
<HR>
<A NAME="getFace()"><!-- --></A><H3>
getFace</H3>
<PRE>
public int <B>getFace</B>()</PRE>
<DL>
<DD>Gets the face of the font.<DD><DL>
<DT><B>Returns:</B><DD>one of <code>FACE_SYSTEM</code>, <code>FACE_PROPORTIONAL</code>, <code>FACE_MONOSPACE</code></DL>
</DD>
</DL>
<HR>
<A NAME="isPlain()"><!-- --></A><H3>
isPlain</H3>
<PRE>
public boolean <B>isPlain</B>()</PRE>
<DL>
<DD>Returns <code>true</code> if the font is plain.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if font is plain<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Font.html#getStyle()"><CODE>getStyle()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="isBold()"><!-- --></A><H3>
isBold</H3>
<PRE>
public boolean <B>isBold</B>()</PRE>
<DL>
<DD>Returns <code>true</code> if the font is bold.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if font is bold<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Font.html#getStyle()"><CODE>getStyle()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="isItalic()"><!-- --></A><H3>
isItalic</H3>
<PRE>
public boolean <B>isItalic</B>()</PRE>
<DL>
<DD>Returns <code>true</code> if the font is italic.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if font is italic<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Font.html#getStyle()"><CODE>getStyle()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="isUnderlined()"><!-- --></A><H3>
isUnderlined</H3>
<PRE>
public boolean <B>isUnderlined</B>()</PRE>
<DL>
<DD>Returns <code>true</code> if the font is underlined.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if font is underlined<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Font.html#getStyle()"><CODE>getStyle()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getHeight()"><!-- --></A><H3>
getHeight</H3>
<PRE>
public int <B>getHeight</B>()</PRE>
<DL>
<DD>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.<DD><DL>
<DT><B>Returns:</B><DD>standard height of a line of text in this font (a non-negative value)</DL>
</DD>
</DL>
<HR>
<A NAME="getBaselinePosition()"><!-- --></A><H3>
getBaselinePosition</H3>
<PRE>
public int <B>getBaselinePosition</B>()</PRE>
<DL>
<DD>Gets the distance in pixels from the top of the text to the text's baseline.<DD><DL>
<DT><B>Returns:</B><DD>the distance in pixels from the top of the text to the text's baseline</DL>
</DD>
</DL>
<HR>
<A NAME="charWidth(char)"><!-- --></A><H3>
charWidth</H3>
<PRE>
public int <B>charWidth</B>(char ch)</PRE>
<DL>
<DD>Gets the advance width of the specified character in this Font. The advance width is the horizontal distance that would be occupied if <code>ch</code> were to be drawn using this <code>Font</code>, including inter-character spacing following <code>ch</code> necessary for proper positioning of subsequent text.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - the character to be measured<DT><B>Returns:</B><DD>the total advance width (a non-negative value)</DL>
</DD>
</DL>
<HR>
<A NAME="charsWidth(char[], int, int)"><!-- --></A><H3>
charsWidth</H3>
<PRE>
public int <B>charsWidth</B>(char[] ch, int offset, int length)</PRE>
<DL>
<DD>Returns the advance width of the characters in <code>ch</code>, 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 <code>Font</code>, including inter-character spacing following the characters necessary for proper positioning of subsequent text. <p>The <code>offset</code> and <code>length</code> parameters must specify a valid range of characters within the character array <code>ch</code>. The <code>offset</code> parameter must be within the range <code>[0..(ch.length)]</code>, inclusive. The <code>length</code> parameter must be a non-negative integer such that <code>(offset + length) <= ch.length</code>.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - the array of characters<DD><CODE>offset</CODE> - the index of the first character to measure<DD><CODE>length</CODE> - the number of characters to measure<DT><B>Returns:</B><DD>the width of the character range<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <code>offset</code> and <code>length</code> specify an invalid range<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>ch</code> is <code>null</code></DL>
</DD>
</DL>
<HR>
<A NAME="stringWidth(java.lang.String)"><!-- --></A><H3>
stringWidth</H3>
<PRE>
public int <B>stringWidth</B>(<A HREF="../../../java/lang/String.html">String</A> str)</PRE>
<DL>
<DD>Gets the total advance width for showing the specified <code>String</code> in this <code>Font</code>. The advance width is the horizontal distance that would be occupied if <code>str</code> were to be drawn using this <code>Font</code>, including inter-character spacing following <code>str</code> necessary for proper positioning of subsequent text.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - the <code>String</code> to be measured<DT><B>Returns:</B><DD>the total advance width<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>str</code> is <code>null</code></DL>
</DD>
</DL>
<HR>
<A NAME="substringWidth(java.lang.String, int, int)"><!-- --></A><H3>
substringWidth</H3>
<PRE>
public int <B>substringWidth</B>(<A HREF="../../../java/lang/String.html">String</A> str, int offset, int len)</PRE>
<DL>
<DD>Gets the total advance width for showing the specified substring in this <code>Font</code>. The advance width is the horizontal distance that would be occupied if the substring were to be drawn using this <code>Font</code>, including inter-character spacing following the substring necessary for proper positioning of subsequent text. <p> The <code>offset</code> and <code>len</code> parameters must specify a valid range of characters within <code>str</code>. The <code>offset</code> parameter must be within the range <code>[0..(str.length())]</code>, inclusive. The <code>len</code> parameter must be a non-negative integer such that <code>(offset + len) <= str.length()</code>. </p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - the <code>String</code> to be measured<DD><CODE>offset</CODE> - zero-based index of first character in the substring<DD><CODE>len</CODE> - length of the substring<DT><B>Returns:</B><DD>the total advance width<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/StringIndexOutOfBoundsException.html">StringIndexOutOfBoundsException</A></CODE> - if <code>offset</code> and <code>length</code> specify an invalid range<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>str</code> is <code>null</code></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Font.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<strong>MID Profile</strong></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/microedition/lcdui/Displayable.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/lcdui/Form.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Font.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<font size="-1"><a href="mailto:midp-feedback@risc.sps.mot.com">Submit a comment or suggestion</a> Version 2.0 of MID Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -