<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_191) on Wed Oct 31 14:02:13 UTC 2018 --> <title>Font (JavaFX 8)</title> <meta name="date" content="2018-10-31"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Font (JavaFX 8)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":10,"i10":9,"i11":9,"i12":10,"i13":10,"i14":10,"i15":10,"i16":9,"i17":9,"i18":10}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Font.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">JavaFX 8</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev Class</li> <li><a href="../../../javafx/scene/text/FontPosture.html" title="enum in javafx.scene.text"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?javafx/scene/text/Font.html" target="_top">Frames</a></li> <li><a href="Font.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li><a href="#constructor.summary">Constr</a> | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li><a href="#constructor.detail">Constr</a> | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">javafx.scene.text</div> <h2 title="Class Font" class="title">Class Font</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>javafx.scene.text.Font</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public final class <span class="typeNameLabel">Font</span> extends java.lang.Object</pre> <div class="block"><p>The <code>Font</code> class represents fonts, which are used to render text on screen. <p> The size of a <code>Font</code> is described as being specified in points which are a real world measurement of approximately 1/72 inch. <p> Given that fonts scale with the rendering transform as determined by the transform attributes of a <code>Node</code> using the <code>Font</code> and its ancestors, the size will actually be relative to the local coordinate space of the node, which should provide coordinates similar to the size of a point if no scaling transforms are present in the environment of the node. Note that the real world distances specified by the default coordinate system only approximate point sizes as a rule of thumb and are typically defaulted to screen pixels for most displays. <p> For more information see <a href="../../../javafx/scene/Node.html" title="class in javafx.scene"><code>Node</code></a> for more information on the default coordinate system</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>JavaFX 2.0</dd> </dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd"> </span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#Font-double-">Font</a></span>(double size)</code> <div class="block">Constructs a font using the default face "System".</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#Font-java.lang.String-double-">Font</a></span>(java.lang.String name, double size)</code> <div class="block">Constructs a font using the specified full face name and size</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#equals-java.lang.Object-">equals</a></span>(java.lang.Object obj)</code> <div class="block">Indicates whether some other object is "equal to" this one.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#font-double-">font</a></span>(double size)</code> <div class="block">Searches for an appropriate font based on the default font family name and given font size.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#font-java.lang.String-">font</a></span>(java.lang.String family)</code> <div class="block">Searches for an appropriate font based on the given font family name and default font size.</div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#font-java.lang.String-double-">font</a></span>(java.lang.String family, double size)</code> <div class="block">Searches for an appropriate font based on the font family name and size.</div> </td> </tr> <tr id="i4" class="altColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#font-java.lang.String-javafx.scene.text.FontPosture-double-">font</a></span>(java.lang.String family, <a href="../../../javafx/scene/text/FontPosture.html" title="enum in javafx.scene.text">FontPosture</a> posture, double size)</code> <div class="block">Searches for an appropriate font based on the font family name and posture style.</div> </td> </tr> <tr id="i5" class="rowColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#font-java.lang.String-javafx.scene.text.FontWeight-double-">font</a></span>(java.lang.String family, <a href="../../../javafx/scene/text/FontWeight.html" title="enum in javafx.scene.text">FontWeight</a> weight, double size)</code> <div class="block">Searches for an appropriate font based on the font family name and weight style.</div> </td> </tr> <tr id="i6" class="altColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#font-java.lang.String-javafx.scene.text.FontWeight-javafx.scene.text.FontPosture-double-">font</a></span>(java.lang.String family, <a href="../../../javafx/scene/text/FontWeight.html" title="enum in javafx.scene.text">FontWeight</a> weight, <a href="../../../javafx/scene/text/FontPosture.html" title="enum in javafx.scene.text">FontPosture</a> posture, double size)</code> <div class="block">Searches for an appropriate font based on the font family name and weight and posture style.</div> </td> </tr> <tr id="i7" class="rowColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#getDefault--">getDefault</a></span>()</code> <div class="block">Gets the default font which will be from the family "System", and typically the style "Regular", and be of a size consistent with the user's desktop environment, to the extent that can be determined.</div> </td> </tr> <tr id="i8" class="altColor"> <td class="colFirst"><code>static java.util.List<java.lang.String></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#getFamilies--">getFamilies</a></span>()</code> <div class="block">Gets all the font families installed on the user's system, including any application fonts or SDK fonts.</div> </td> </tr> <tr id="i9" class="rowColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#getFamily--">getFamily</a></span>()</code> <div class="block">Returns the family of this font.</div> </td> </tr> <tr id="i10" class="altColor"> <td class="colFirst"><code>static java.util.List<java.lang.String></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#getFontNames--">getFontNames</a></span>()</code> <div class="block">Gets the names of all fonts that are installed on the users system, including any application fonts and SDK fonts.</div> </td> </tr> <tr id="i11" class="rowColor"> <td class="colFirst"><code>static java.util.List<java.lang.String></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#getFontNames-java.lang.String-">getFontNames</a></span>(java.lang.String family)</code> <div class="block">Gets the names of all fonts in the specified font family that are installed on the users system, including any application fonts and SDK fonts.</div> </td> </tr> <tr id="i12" class="altColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#getName--">getName</a></span>()</code> <div class="block">The full font name.</div> </td> </tr> <tr id="i13" class="rowColor"> <td class="colFirst"><code>double</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#getSize--">getSize</a></span>()</code> <div class="block">The point size for this font.</div> </td> </tr> <tr id="i14" class="altColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#getStyle--">getStyle</a></span>()</code> <div class="block">The font specified string describing the style within the font family.</div> </td> </tr> <tr id="i15" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#hashCode--">hashCode</a></span>()</code> <div class="block">Returns a hash code for this <code>Font</code> object.</div> </td> </tr> <tr id="i16" class="altColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#loadFont-java.io.InputStream-double-">loadFont</a></span>(java.io.InputStream in, double size)</code> <div class="block">Loads a font resource from the specified input stream.</div> </td> </tr> <tr id="i17" class="rowColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#loadFont-java.lang.String-double-">loadFont</a></span>(java.lang.String urlStr, double size)</code> <div class="block">Loads a font resource from the specified URL.</div> </td> </tr> <tr id="i18" class="altColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/text/Font.html#toString--">toString</a></span>()</code> <div class="block">Converts this <code>Font</code> object to a <code>String</code> representation.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.Object</h3> <code>clone, finalize, getClass, notify, notifyAll, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="Font-double-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>Font</h4> <pre>public Font(double size)</pre> <div class="block">Constructs a font using the default face "System". The underlying font used is determined by the implementation based on the typical UI font for the current UI environment.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>size</code> - the font size to use</dd> </dl> </li> </ul> <a name="Font-java.lang.String-double-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>Font</h4> <pre>public Font(java.lang.String name, double size)</pre> <div class="block">Constructs a font using the specified full face name and size</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>name</code> - full name of the font.</dd> <dd><code>size</code> - the font size to use</dd> </dl> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getDefault--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDefault</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> getDefault()</pre> <div class="block">Gets the default font which will be from the family "System", and typically the style "Regular", and be of a size consistent with the user's desktop environment, to the extent that can be determined.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The default font.</dd> </dl> </li> </ul> <a name="getFamilies--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getFamilies</h4> <pre>public static java.util.List<java.lang.String> getFamilies()</pre> <div class="block">Gets all the font families installed on the user's system, including any application fonts or SDK fonts. This call has performance considerations as looking up all of the fonts may be an expensive operation the first time.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The list containing all available font families.</dd> </dl> </li> </ul> <a name="getFontNames--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getFontNames</h4> <pre>public static java.util.List<java.lang.String> getFontNames()</pre> <div class="block">Gets the names of all fonts that are installed on the users system, including any application fonts and SDK fonts. This call has performance considerations as looking up all of the fonts may be an expensive operation the first time.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The list containing all available fonts.</dd> </dl> </li> </ul> <a name="getFontNames-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getFontNames</h4> <pre>public static java.util.List<java.lang.String> getFontNames(java.lang.String family)</pre> <div class="block">Gets the names of all fonts in the specified font family that are installed on the users system, including any application fonts and SDK fonts. This call has performance considerations as looking up all of the fonts may be an expensive operation the first time.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The list containing the fonts for the given family.</dd> </dl> </li> </ul> <a name="font-java.lang.String-javafx.scene.text.FontWeight-javafx.scene.text.FontPosture-double-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>font</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> font(java.lang.String family, <a href="../../../javafx/scene/text/FontWeight.html" title="enum in javafx.scene.text">FontWeight</a> weight, <a href="../../../javafx/scene/text/FontPosture.html" title="enum in javafx.scene.text">FontPosture</a> posture, double size)</pre> <div class="block">Searches for an appropriate font based on the font family name and weight and posture style. This method is not guaranteed to return a specific font, but does its best to find one that fits the specified requirements. <p> A null or empty value for family allows the implementation to select any suitable font.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>family</code> - The family of the font</dd> <dd><code>weight</code> - The weight of the font</dd> <dd><code>posture</code> - The posture or posture of the font</dd> <dd><code>size</code> - The point size of the font. This can be a fractional value, but must not be negative. If the size is < 0 the default size will be used.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The font that best fits the specified requirements.</dd> </dl> </li> </ul> <a name="font-java.lang.String-javafx.scene.text.FontWeight-double-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>font</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> font(java.lang.String family, <a href="../../../javafx/scene/text/FontWeight.html" title="enum in javafx.scene.text">FontWeight</a> weight, double size)</pre> <div class="block">Searches for an appropriate font based on the font family name and weight style. This method is not guaranteed to return a specific font, but does its best to find one that fits the specified requirements. A null or empty value for family allows the implementation to select any suitable font.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>family</code> - The family of the font</dd> <dd><code>weight</code> - The weight of the font</dd> <dd><code>size</code> - The point size of the font. This can be a fractional value, but must not be negative. If the size is < 0 the default size will be used.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The font that best fits the specified requirements.</dd> </dl> </li> </ul> <a name="font-java.lang.String-javafx.scene.text.FontPosture-double-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>font</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> font(java.lang.String family, <a href="../../../javafx/scene/text/FontPosture.html" title="enum in javafx.scene.text">FontPosture</a> posture, double size)</pre> <div class="block">Searches for an appropriate font based on the font family name and posture style. This method is not guaranteed to return a specific font, but does its best to find one that fits the specified requirements. A null or empty value for family allows the implementation to select any suitable font.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>family</code> - The family of the font</dd> <dd><code>posture</code> - The posture or posture of the font</dd> <dd><code>size</code> - The point size of the font. This can be a fractional value, but must not be negative. If the size is < 0 the default size will be used.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The font that best fits the specified requirements.</dd> </dl> </li> </ul> <a name="font-java.lang.String-double-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>font</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> font(java.lang.String family, double size)</pre> <div class="block">Searches for an appropriate font based on the font family name and size. This method is not guaranteed to return a specific font, but does its best to find one that fits the specified requirements. A null or empty value for family allows the implementation to select any suitable font.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>family</code> - The family of the font</dd> <dd><code>size</code> - The point size of the font. This can be a fractional value, but must not be negative. If the size is < 0 the default size will be used.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The font that best fits the specified requirements.</dd> </dl> </li> </ul> <a name="font-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>font</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> font(java.lang.String family)</pre> <div class="block">Searches for an appropriate font based on the given font family name and default font size. This method is not guaranteed to return a specific font, but does its best to find one that fits the specified requirements. A null or empty value for family allows the implementation to select any suitable font.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>family</code> - The family of the font</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The font that best fits the specified requirements.</dd> </dl> </li> </ul> <a name="font-double-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>font</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> font(double size)</pre> <div class="block">Searches for an appropriate font based on the default font family name and given font size. This method is not guaranteed to return a specific font, but does its best to find one that fits the specified requirements.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>size</code> - The point size of the font. This can be a fractional value, but must not be negative. If the size is < 0 the default size will be used.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The font that best fits the specified requirements.</dd> </dl> </li> </ul> <a name="getName--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getName</h4> <pre>public final java.lang.String getName()</pre> <div class="block">The full font name. This name includes both the family name and the style variant within that family. For example, for a plain Arial font this would be "Arial Regular" and for a bolded Arial font this would be "Arial Bold". The precise name to use when loading a font is defined within each font file as the full font name. For example, "Proxima Nova ExtraCondensed Bold Italic" would refer to a specific Proxima Nova font. A null or empty name allows the implementation to select any suitable font. <p> There is a single unified way to load all of application supplied (via <code>Font.loadFont()</code>, JavaFX runtime delivered fonts, and system installed fonts. Simply create the font by specifying the full name of the font you want to load. If the specific font cannot be located, then a fallback or default font will be used. The "name" will be updated to reflect the actual name of the font being used. A load failure condition can be discovered by checking the name of the Font with the name you tried to load. <p> Note that if you wish to locate a font by font family and style then you can use one of the <a href="../../../javafx/scene/text/Font.html#font-java.lang.String-javafx.scene.text.FontWeight-javafx.scene.text.FontPosture-double-"><code>font(java.lang.String, javafx.scene.text.FontWeight, javafx.scene.text.FontPosture, double)</code></a> factory methods defined in this class.</div> <dl> <dt><span class="simpleTagLabel">Default value:</span></dt> <dd>empty string</dd> </dl> </li> </ul> <a name="getFamily--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getFamily</h4> <pre>public final java.lang.String getFamily()</pre> <div class="block">Returns the family of this font.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The family of this font.</dd> </dl> </li> </ul> <a name="getStyle--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getStyle</h4> <pre>public final java.lang.String getStyle()</pre> <div class="block">The font specified string describing the style within the font family.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The style name of this font.</dd> </dl> </li> </ul> <a name="getSize--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getSize</h4> <pre>public final double getSize()</pre> <div class="block">The point size for this font. This may be a fractional value such as <code>11.5</code>. If the specified value is < 0 the default size will be used.</div> <dl> <dt><span class="simpleTagLabel">Default value:</span></dt> <dd>12</dd> </dl> </li> </ul> <a name="loadFont-java.lang.String-double-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>loadFont</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> loadFont(java.lang.String urlStr, double size)</pre> <div class="block">Loads a font resource from the specified URL. If the load is successful such that the location is readable, and it represents a supported font format then a <code>Font</code> object will be returned. <p> If the application does not have the proper permission then this method will return the default system font with the specified font size. <p> Any failure such as a malformed URL being unable to locate or read from the resource, or if it doesn't represent a font, will result in a <code>null</code> return. It is the application's responsibility to check this before use. <p> On a successful (non-null) return the font will be registered with the FX graphics system for creation by available constructors and factory methods, and the application should use it in this manner rather than calling this method again, which would repeat the overhead of downloading and installing the font. <p> The font <code>size</code> parameter is a convenience so that in typical usage the application can directly use the returned (non-null) font rather than needing to create one via a constructor. Invalid sizes are those <=0 and will result in a default size. <p> If the URL represents a local disk file, then no copying is performed and the font file is required to persist for the lifetime of the application. Updating the file in any manner will result in unspecified and likely undesired behaviours.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>urlStr</code> - from which to load the font, specified as a String.</dd> <dd><code>size</code> - of the returned font.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the Font, or null if the font cannot be created.</dd> </dl> </li> </ul> <a name="loadFont-java.io.InputStream-double-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>loadFont</h4> <pre>public static <a href="../../../javafx/scene/text/Font.html" title="class in javafx.scene.text">Font</a> loadFont(java.io.InputStream in, double size)</pre> <div class="block">Loads a font resource from the specified input stream. If the load is successful such that the stream can be fully read, and it represents a supported font format then a <code>Font</code> object will be returned. <p> If the application does not have the proper permission then this method will return the default system font with the specified font size. <p> Any failure such as abbreviated input, or an unsupported font format will result in a <code>null</code> return. It is the application's responsibility to check this before use. <p> On a successful (non-null) return the font will be registered with the FX graphics system for creation by available constructors and factory methods, and the application should use it in this manner rather than calling this method again, which would repeat the overhead of re-reading and installing the font. <p> The font <code>size</code> parameter is a convenience so that in typical usage the application can directly use the returned (non-null) font rather than needing to create one via a constructor. Invalid sizes are those <=0 and will result in a default size. <p> This method does not close the input stream.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>in</code> - stream from which to load the font.</dd> <dd><code>size</code> - of the returned font.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the Font, or null if the font cannot be created.</dd> </dl> </li> </ul> <a name="toString--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>toString</h4> <pre>public java.lang.String toString()</pre> <div class="block">Converts this <code>Font</code> object to a <code>String</code> representation. The String representation is for informational use only and will change. Do not use this string representation for any programmatic purpose.</div> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>toString</code> in class <code>java.lang.Object</code></dd> </dl> </li> </ul> <a name="equals-java.lang.Object-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>equals</h4> <pre>public boolean equals(java.lang.Object obj)</pre> <div class="block">Indicates whether some other object is "equal to" this one.</div> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>equals</code> in class <code>java.lang.Object</code></dd> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>obj</code> - the reference object with which to compare.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd><code>true</code> if this object is equal to the <code>obj</code> argument; <code>false</code> otherwise.</dd> </dl> </li> </ul> <a name="hashCode--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>hashCode</h4> <pre>public int hashCode()</pre> <div class="block">Returns a hash code for this <code>Font</code> object.</div> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>hashCode</code> in class <code>java.lang.Object</code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a hash code for this <code>Font</code> object.</dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Font.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">JavaFX 8</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev Class</li> <li><a href="../../../javafx/scene/text/FontPosture.html" title="enum in javafx.scene.text"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?javafx/scene/text/Font.html" target="_top">Frames</a></li> <li><a href="Font.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li><a href="#constructor.summary">Constr</a> | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li><a href="#constructor.detail">Constr</a> | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><font size="-1"><a href="http://bugreport.java.com/bugreport/" target="_blank">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="https://docs.oracle.com/javase/8/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> <a href="https://docs.oracle.com/javase/8/docs/legal/cpyr.html" target="_blank">Copyright</a> © 2008, 2018, Oracle and/or its affiliates. All rights reserved. Use is subject to <a href="http://download.oracle.com/otndocs/jcp/java_se-8-mrel-spec/license.html" target="_blank">license terms</a>. Also see the <a target="_blank" href="http://www.oracle.com/technetwork/java/redist-137594.html" target="_blank">documentation redistribution policy</a>.</font></small></p> </body> </html>