Search in sources :

Example 1 with FontWeight

use of javafx.scene.text.FontWeight in project Gargoyle by callakrsos.

the class FontViewComposite method updateFontWeightByName.

/**
	 * FontWeight이름의 값을 이용, weight값으로 변환후 slider에 값을 update처리.
	 * @작성자 : KYJ
	 * @작성일 : 2016. 12. 2.
	 */
private void updateFontWeightByName() {
    if (ValueUtil.isNotEmpty(cbFontWeight.getValue())) {
        String fontWeight = cbFontWeight.getValue();
        /*
			 *  this code is bug  jdk 1.8.11- > FontWeight.findByName(fontWeight);
			 *  2016-12-02 by kyj.
			 */
        FontWeight findByName = findByName(fontWeight);
        int weight = findByName.getWeight();
        sliderFontWeight.setValue(weight);
    }
}
Also used : FontWeight(javafx.scene.text.FontWeight)

Example 2 with FontWeight

use of javafx.scene.text.FontWeight in project Gargoyle by callakrsos.

the class FontViewComposite method initialize.

@FXML
public void initialize() {
    Font defaultFont = FxUtil.FONTUtil.getDefaultFont();
    String name = defaultFont.getName();
    double size = defaultFont.getSize();
    String style = defaultFont.getStyle();
    FontStyle fontStyle = new FontStyle(defaultFont);
    FontWeight fontWeight = fontStyle.getWeight();
    int weight = fontWeight.getWeight();
    cbFontNames.setValue(name);
    cbFontStyles.setValue(style);
    sliderFontSize.setValue(size);
    sliderFontWeight.setValue(weight);
    loadFontNames();
    loadFontStyles();
    loadFontWeights();
    printSelectFontInfo(defaultFont);
    cbFontNames.valueProperty().addListener((oba, o, n) -> {
        printSelectFontInfo(Font.font(n));
        loadFont();
    });
    cbFontStyles.valueProperty().addListener((oba, o, n) -> {
        loadFont();
    });
    sliderFontSize.valueProperty().addListener((oba, o, n) -> {
        loadFont();
    });
    sliderFontWeight.valueProperty().addListener((oba, o, n) -> {
        loadFont();
    });
    cbFontWeight.valueProperty().addListener((oba, o, n) -> {
        updateFontWeightByName();
    });
    cbFontNames.setDisable(true);
}
Also used : FontWeight(javafx.scene.text.FontWeight) Font(javafx.scene.text.Font) FXML(javafx.fxml.FXML)

Example 3 with FontWeight

use of javafx.scene.text.FontWeight 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);
}
Also used : FontPosture(javafx.scene.text.FontPosture) FontWeight(javafx.scene.text.FontWeight) Font(javafx.scene.text.Font)

Aggregations

FontWeight (javafx.scene.text.FontWeight)3 Font (javafx.scene.text.Font)2 FXML (javafx.fxml.FXML)1 FontPosture (javafx.scene.text.FontPosture)1