Spec-Zone .ru
спецификации, руководства, описания, API

JavaFX: Bringing Rich Experiences To All the Screens Of Your Life

Profile: desktop, common

Overview

The Font class represents fonts, which are used to render text on screen. Do not extend this class. It should be considered final.

Profile: common

Script Variable Summary

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicDEFAULTFont

The default font for this platform.

The default font for this platform. This is used whenever a font is not specifically set on a Text node.

 

Variable Summary

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
public-initautoKernBooleantrue

Indicates that automatic kerning (as described in the font) should be used.

Indicates that automatic kerning (as described in the font) should be used. Kerning is used to adjust the distance between certain glyph sequences for a more pleasing visual result. This is on by default.

true

Profile: desktop

 
public-initemboldenBooleanfalse

Emboldens the font algorithmically.

Emboldens the font algorithmically. Any font, regardless of its weight, will be made heavier if embolden is true. For example, a "regular" weighted font would become "bold", and a "bold" weighted font would become "extra bold". This variable affects the way the font is rendered, but does not affect the name, family, or style.

false

Profile: desktop

 
public-readfamilyString

The family of this font.

The family of this font. This is a readonly property initialized when the font is created.

Profile: common

 
public-initletterSpacingNumber0

Also known as tracking, letterSpacing is the amount of extra space to insert between letters or glyphs when rendering text.

Also known as tracking, letterSpacing is the amount of extra space to insert between letters or glyphs when rendering text. Increasing this value will cause the letters to be rendered further apart, while decreasing this value will cause the letters to run into each other. The default value of "0" indicates that no additional letter spacing should be used. Positive values spread the letters apart while negative values bring them closer together.

0

Profile: desktop

 
public-initligaturesBooleantrue

Describes whether any font ligatures should be used.

Describes whether any font ligatures should be used. A ligature is a special glyph used to represent what are normally multiple glyphs, and is typically used to make a font look better.

true

Profile: desktop

 
public-initnameStringempty string

The full font name.

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" or "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.

There is a single unified way to load both embedded and device fonts. Simply create the font by specifying the full name of the font you want to load. This class will first search for an embedded font by this name. If not found, then it will check a list of known fonts shipped with JavaFX. If the font is still not found, then system fonts will be checked. If the specific font still cannot be located, then a fallback 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.

All other properties (such as size, letterSpacing, ligatures, etc) are used by the font to produce the correct set of glyphs and metrics for rendering text with this font, bu are not used for selecting the actual font to use.

Note that if you wish to locate a font by font family and style then you can use one of the font script functions defined in this script.

empty string

Profile: common

 
public-initobliqueBooleanfalse

Obliques the font algorithmically.

Obliques the font algorithmically. Any font, regardless of its posture, will be made more oblique if this variable is true. For example, a "regular" postured font will become "oblique" and an already italic or obliqued font will become even more oblique. This variable affects the way the font is rendered, but does not affect the name, family, or style.

false

Profile: desktop

 
public-initpositionFontPositionnull

Indicates whether this font is regular, superscript, or subscript.

Indicates whether this font is regular, superscript, or subscript. A null value is interpreted as regular.

null

Profile: desktop

 
public-initsizeNumber12

The point size for this font.

The point size for this font. This may be a fractional value such as 11.5.

12

Profile: common

 
public-readstyleString

The style within the font family that this font belongs to.

The style within the font family that this font belongs to. This is a readonly property initialized when the font is created. family + style = name.

Profile: common

 

Inherited Variables

Script Function Summary

public font(family: java.lang.String, weight: FontWeight, posture: FontPosture, size: Number) : Font

Searches for an appropriate font based on the font family name and weight and posture style.

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.

Parameters
family
The family of the font
weight
The weight of the font
posture
The posture or posture of the font
size
The point size of the font. This can be a fractional value
Returns
Font

Profile: common

 
public font(family: java.lang.String, weight: FontWeight, size: Number) : Font

Searches for an appropriate font based on the font family name and weight style.

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.

Parameters
family
The family of the font
weight
The weight of the font
size
The point size of the font. This can be a fractional value
Returns
Font

Profile: common

 
public font(family: java.lang.String, posture: FontPosture, size: Number) : Font

Searches for an appropriate font based on the font family name and posture style.

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.

Parameters
family
The family of the font
posture
The posture or posture of the font
size
The point size of the font. This can be a fractional value
Returns
Font

Profile: common

 
public font(family: java.lang.String, size: Number) : Font

Searches for an appropriate font based on the font family name and size.

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.

Parameters
family
The family of the font
size
The point size of the font. This can be a fractional value
Returns
Font

Profile: common

 
public getFamilies() : java.lang.Object[]

Gets all the font families installed on the user's system, including any embedded fonts or SDK fonts.

Gets all the font families installed on the user's system, including any embedded fonts or SDK fonts.

Returns
Object[]

Profile: common

 
public getFontNames() : java.lang.Object[]

Gets the names of all fonts that are installed on the users system, including any embedded fonts and SDK fonts.

Gets the names of all fonts that are installed on the users system, including any embedded fonts and SDK fonts.

Returns
Object[]

Profile: common

 
public getFontNames(family: java.lang.String) : java.lang.Object[]

Gets the names of all fonts in the specified font family that are installed on the users system, including any embedded fonts and SDK fonts.

Gets the names of all fonts in the specified font family that are installed on the users system, including any embedded fonts and SDK fonts.

Parameters
family
Returns
Object[]

Profile: common

 

Function Summary

public equals(obj: java.lang.Object) : Boolean
Parameters
obj
Returns
Boolean
 
public hashCode() : Integer
Returns
Integer
 
public impl_getNativeFont() : java.lang.Object
Returns
Object
 
public impl_setNativeFont(f: java.lang.Object, nam: java.lang.String, fam: java.lang.String, styl: java.lang.String) : Void
Parameters
f
nam
fam
styl
 
public toString() : java.lang.String

Converts this Font object to a String representation.

Converts this Font object to a String representation. The String representation is for informational use only and will change. Do not use this string representation for any programmatic purpose.

Returns
String

Profile: common

 

Inherited Functions