use of javafx.scene.text.FontPosture in project org.csstudio.display.builder by kasemir.
the class GraphicsUtils method convert.
/**
* Convert font
* @param font AWT font
* @return JFX font
*/
public static Font convert(final java.awt.Font font) {
final FontWeight weight = font.isBold() ? FontWeight.BOLD : FontWeight.NORMAL;
final FontPosture posture = font.isItalic() ? FontPosture.ITALIC : FontPosture.REGULAR;
return Font.font(font.getFamily(), weight, posture, font.getSize());
}
use of javafx.scene.text.FontPosture in project Zong by Xenoage.
the class JfxFontUtils method toJavaFXFont.
public static Font toJavaFXFont(FontInfo font) {
String family = font.getFamilies().get(0);
FontWeight weight = (font.getStyle().isSet(FontStyle.Bold) ? FontWeight.BOLD : FontWeight.NORMAL);
FontPosture posture = (font.getStyle().isSet(FontStyle.Italic) ? FontPosture.ITALIC : FontPosture.REGULAR);
double size = font.getSize();
return Font.font(family, weight, posture, size);
}
use of javafx.scene.text.FontPosture in project fxexperience2 by EricCanull.
the class FontPickerController method changeFont.
private void changeFont() {
try {
double size = numberFormat.parse(sizeComboBox.getValue()).doubleValue();
FontWeight weight = styleChoiceBox.getSelectionModel().isSelected(0) || styleChoiceBox.getSelectionModel().isSelected(1) ? FontWeight.BOLD : FontWeight.NORMAL;
FontPosture posture = styleChoiceBox.getSelectionModel().isSelected(1) || styleChoiceBox.getSelectionModel().isSelected(2) ? FontPosture.ITALIC : FontPosture.REGULAR;
String family = familyComboBox.getValue();
font.setValue(Font.font(family, weight, posture, size));
sampleFontText.setFont(font.get());
} catch (java.text.ParseException ex) {
Logger.getLogger(FontPickerController.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of javafx.scene.text.FontPosture in project Gargoyle by callakrsos.
the class FontViewComposite method loadFont.
/**
* @작성자 : KYJ
* @작성일 : 2016. 12. 2.
*/
private void loadFont() {
FontWeight fontWeight = FontWeight.findByWeight((int) sliderFontWeight.getValue());
FontPosture fontStyle = FontPosture.findByName(cbFontStyles.getValue());
double fontSize = sliderFontSize.getValue();
String fontName = cbFontNames.getValue();
LOGGER.debug("{} {} {} {}", fontName, fontWeight, fontStyle, fontSize);
Font font = Font.font(fontName, fontWeight, fontStyle, fontSize);
if (font != null)
lblPreviewText.setFont(font);
}
use of javafx.scene.text.FontPosture in project jphp by jphp-compiler.
the class UXFont method withNameAndSize.
protected Font withNameAndSize(String name, double size, Boolean bold, Boolean italic) {
Font font = getWrappedObject();
FontWeight weight = bold != null && bold ? FontWeight.BOLD : FontWeight.THIN;
FontPosture posture = italic != null && italic ? FontPosture.ITALIC : FontPosture.REGULAR;
if (font.getStyle().toUpperCase().contains("BOLD")) {
weight = FontWeight.BOLD;
}
if (font.getStyle().toUpperCase().contains("ITALIC")) {
posture = FontPosture.ITALIC;
}
return Font.font(name, weight, posture, size);
}
Aggregations