本文整理汇总了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());
}