Package javafx.scene.text

Examples of javafx.scene.text.Font


    }


    @Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
        final String labelText = label.getText();
        final Font font = label.getFont();
        double textWidth = Utils.computeTextWidth(font, labelText, 0);

        return leftInset + textWidth + thumbArea.prefWidth(-1) + rightInset;
    }
View Full Code Here


        return leftInset + textWidth + thumbArea.prefWidth(-1) + rightInset;
    }

    @Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
        final Font font = label.getFont();
        final String labelText = label.getText();
        final double textHeight = Utils.computeTextHeight(font, labelText, 0, label.getLineSpacing(), label.getBoundsType());

        return topInset + Math.max(thumb.prefHeight(-1), textHeight) + bottomInset;
    }
View Full Code Here

        return topInset + Math.max(thumb.prefHeight(-1), textHeight) + bottomInset;
    }

    @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
        final String labelText = label.getText();
        final Font font = label.getFont();
        double textWidth = Utils.computeTextWidth(font, labelText, 0);

        return leftInset + textWidth + 20 + thumbArea.prefWidth(-1) + rightInset;
    }
View Full Code Here

        return leftInset + textWidth + 20 + thumbArea.prefWidth(-1) + rightInset;
    }

    @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
    {
        final Font font = label.getFont();
        final String labelText = label.getText();
        final double textHeight = Utils.computeTextHeight(font, labelText, 0, label.getLineSpacing(), label.getBoundsType());

        return topInset + Math.max(thumb.prefHeight(-1), textHeight) + bottomInset;
    }
View Full Code Here

        checkRealFont(TestFonts.TEST_REAL_FONT_1);
        checkRealFont(TestFonts.TEST_REAL_FONT_2);
    }

    private void checkRealFont(final FontItem fontItem) {
        final Font font = fontItem.get();
        final AbstractBaseFont rf = (AbstractBaseFont) ResourceBuilders.FONT_BUILDER.getParam(fontItem);

        assertNotNull(font);
        assertEquals(font.getName(), rf.name().name());
        assertEquals(font.getSize(), rf.size(), 0.0);
    }
View Full Code Here

        checkFamilyFont(TestFonts.TEST_FAMILY_FONT_3);
        checkFamilyFont(TestFonts.TEST_FAMILY_FONT_4);
    }

    private void checkFamilyFont(final FontItem fontItem) {
        final Font font = fontItem.get();
        final FamilyFont ff = (FamilyFont) ResourceBuilders.FONT_BUILDER.getParam(fontItem);

        Assert.assertNotNull(font);

        final String[] names = font.getName().split(" ");
        int i = 0;
        assertThat(names[i++]).isEqualToIgnoringCase(ff.family());

        if (FontWeight.NORMAL != ff.weight()) {
            assertThat(names[i++]).isEqualToIgnoringCase(ff.weight().name());
        }

        if (FontPosture.REGULAR != ff.posture()) {
            assertThat(names[i++]).isEqualToIgnoringCase(ff.posture().name());
        }
        assertEquals(font.getSize(), ff.size(), 0.0);
    }
View Full Code Here

                    srcs.append(line);
                    srcs.append('\n');
                }
            }
            if (fontUrl != null) {
                Font font = Font.loadFont(fontUrl, 10);
                fontName = font.getFamily();
            } else {
                System.err.println("Failed to find any supported fonts "
                        + "(TTF or OTF) in CSS src:\n"+srcs.toString());
            }
        } catch (IOException ex) {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    protected Font buildResource(final FontItem fontItem, final FontParams jrFont) {
        Font font = null;
        if (jrFont instanceof RealFont) {
            // Build the requested font
            font = buildRealFont((RealFont) jrFont);
        } else if (jrFont instanceof FamilyFont) {
            // Build a family like font
View Full Code Here

     * @param familyFont the family font enum
     *
     * @return the javafx font
     */
    private Font buildFamilyFont(final FamilyFont familyFont) {
        Font font = null;
        if (familyFont.posture() == null && familyFont.weight() == null) {
            font = Font.font(transformFontName(familyFont.family()), familyFont.size());
        } else if (familyFont.posture() == null) {
            font = Font.font(transformFontName(familyFont.family()), familyFont.weight(), familyFont.size());
        } else if (familyFont.weight() == null) {
View Full Code Here

    private void checkFontStatus(final FontParams realFont) {

        // Try to load system fonts
        final List<String> fonts = Font.getFontNames(transformFontName(realFont.name().name()));

        Font font;
        if (fonts.isEmpty()) {

            // This variable will hold the 2 alternative font names
            String fontName = JRebirthParameters.FONT_FOLDER.get() + Resources.PATH_SEP + transformFontName(realFont.name().name()) + JRebirthParameters.TRUE_TYPE_FONT_EXTENSION.get();
View Full Code Here

TOP

Related Classes of javafx.scene.text.Font

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.