本文整理匯總了Java中javafx.scene.text.Font.font方法的典型用法代碼示例。如果您正苦於以下問題:Java Font.font方法的具體用法?Java Font.font怎麽用?Java Font.font使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.text.Font
的用法示例。
在下文中一共展示了Font.font方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newFont
import javafx.scene.text.Font; //導入方法依賴的package包/類
private static Function newFont(Context context) {
return args -> {
val validator = Validator.with(args);
validator.check(1);
if (args[0].type() == Types.MAP) {
return new FontValue(FontValue.toFont((MapValue) args[0]));
}
return new FontValue(Font.font(args[0].asDouble()));
};
}
示例2: toFont
import javafx.scene.text.Font; //導入方法依賴的package包/類
public static Font toFont(MapValue mapValue) {
val map = mapValue.getMap();
val family = map.getOrDefault("family", new StringValue(Font.getDefault().getFamily())).asString();
val weight = map.getOrDefault("weight", NumberValue.of(FontWeight.NORMAL.getWeight())).asInt();
val isItalic = map.getOrDefault("italic", NumberValue.ZERO).asBoolean();
val posture = isItalic ? FontPosture.ITALIC : FontPosture.REGULAR;
val size = map.getOrDefault("size", NumberValue.MINUS_ONE).asDouble();
return Font.font(family, FontWeight.findByWeight(weight), posture, size);
}
示例3: initUiFont
import javafx.scene.text.Font; //導入方法依賴的package包/類
public static void initUiFont() {
List<String> fonts = Font.getFamilies();
if (fonts.contains("PingFang SC")) {
uiFont = Font.font("PingFang SC", 15);
} else if (fonts.contains("Microsoft YaHei UI")) {
uiFont = Font.font("Microsoft YaHei UI", 15);
} else if (fonts.contains("Ubuntu")) {
uiFont = Font.font("Ubuntu", 15);
} else if (fonts.contains("Segoe UI")) {
uiFont = Font.font("Segoe UI", 15);
}
}
示例4: initTextFont
import javafx.scene.text.Font; //導入方法依賴的package包/類
public static void initTextFont() {
List<String> fonts = Font.getFamilies();
if (fonts.contains("Consolas")) {
textFont = Font.font("Consolas", 15);
} else if (fonts.contains("Source Code Pro")) {
textFont = Font.font("Source Code Pro", 15);
} else if (fonts.contains("Fira Code")) {
textFont = Font.font("Fira Code", 15);
} else if (fonts.contains("DejaVu Sans Mono")) {
textFont = Font.font("DejaVu Sans Mono", 15);
}
}
示例5: init
import javafx.scene.text.Font; //導入方法依賴的package包/類
public static void init(List<Properties> properties) {
if (properties == null) {
properties = Collections.emptyList();
}
Options.debug = defined(properties, "viewer.debug");
Log.setting("viewer.debug", debug);
boolean color = defined(properties, "viewer.color");
if (System.getProperty("os.name", "windows").toLowerCase().contains("win")) {
Options.color = false;
}
if (color) {
Options.color = !Options.color;
}
Log.setting("viewer.color", Options.color);
String uiFont = get(properties, "viewer.fonts.ui");
if (uiFont != null) {
FontUtils.uiFont = Font.font(uiFont, 15);
} else {
FontUtils.initUiFont();
}
Log.setting("viewer.fonts.ui", FontUtils.uiFont);
String textFont = get(properties, "viewer.fonts.text");
if (textFont != null) {
FontUtils.textFont = Font.font(textFont, 15);
} else {
FontUtils.initTextFont();
}
Log.setting("viewer.fonts.text", FontUtils.textFont);
}
示例6: getFont
import javafx.scene.text.Font; //導入方法依賴的package包/類
public static Font getFont(String name) {
if (!Font.getFamilies().contains(name)) {
Alert a = new Alert(AlertType.WARNING);
a.setContentText("Could not find font " + name + ". Defaulting to system font.");
a.show();
}
return Font.font(name);
}
示例7: initializeFonts
import javafx.scene.text.Font; //導入方法依賴的package包/類
void initializeFonts() {
infoFont = Font.loadFont(ClassLoader.getSystemResource("Orbitron-Regular.ttf").toExternalForm(), mGridDimension * 0.75);
turnsFont = Font.loadFont(ClassLoader.getSystemResource("Orbitron-Regular.ttf").toExternalForm(), mGridDimension * 0.6);
playerFont = Font.font("Helvetica", FontWeight.NORMAL, mGridDimension * 0.45);
messageFont = Font.loadFont(ClassLoader.getSystemResource("Orbitron-Regular.ttf").toExternalForm(), mGridDimension * 0.35);
menuFont = Font.loadFont(ClassLoader.getSystemResource("Orbitron-Regular.ttf").toExternalForm(), mGridDimension * 0.35);
}
示例8: font
import javafx.scene.text.Font; //導入方法依賴的package包/類
public static Font font( final int size, final FontWeight weight ) {
return Font.font( "System", weight, size );
}
示例9: getDefaultFont
import javafx.scene.text.Font; //導入方法依賴的package包/類
public static Font getDefaultFont() {
return Font.font("Courier");
}
示例10: getSystemDefaultFont
import javafx.scene.text.Font; //導入方法依賴的package包/類
private static Font getSystemDefaultFont(){
return Font.font(Font.getDefault().getName(), Font.getDefault().getSize() * App.getInterfaceMultiplierSize());
}