Package org.geotools.styling

Examples of org.geotools.styling.Font$Style


        notEq.setLabelPlacement(placement);
        assertEqualsContract(clone, notEq, textSymb);
    }

    public void testFont() {
        Font font = sf.getDefaultFont();
        Font clone = visitor.copy(font);
        assertCopy(font, clone);
        assertEqualsContract(font, clone);

        Font other = sf.createFont(ff.literal("other"),
                ff.literal("normal"),
                ff.literal("BOLD"),
                ff.literal(12));

        assertEqualsContract(clone, other, font);
View Full Code Here


       
        Function l = (Function) sym.getLabel();
        assertEquals("foobar (10)", l.evaluate(f1));
        //assertEquals("hospitalName", l);
       
        Font f = sym.getFont();
        assertEquals(2, f.getFamily().size());
        assertEquals("Arial", f.getFamily().get(0).evaluate(null, String.class));
        assertEquals("Sans-Serif", f.getFamily().get(1).evaluate(null, String.class));
        assertEquals("italic", f.getStyle().evaluate(null, String.class));
        assertEquals("10", f.getSize().evaluate(null, String.class));
       
        Fill fill = sym.getFill();
        assertEquals(Color.BLACK, fill.getColor().evaluate(null, Color.class));
    }
View Full Code Here

    }

    public void test() throws Exception {
        SLDMockData.font(document, document);

        Font font = (Font) parse();
        assertNotNull(font);
        assertEquals("Arial", Filters.asString(font.getFontFamily()));
        assertEquals("normal", Filters.asString(font.getFontStyle()));
        assertEquals("normal", Filters.asString(font.getFontWeight()));
        assertEquals(14, Filters.asInt(font.getFontSize()));
    }
View Full Code Here

        assertEquals(14, Filters.asInt(font.getFontSize()));
    }
   
    public void testDefaultFont() throws Exception {
        SLDMockData.element(SLD.FONT, document, document);
        Font font = (Font) parse();
        assertNotNull(font);
        assertEquals("Serif", Filters.asString(font.getFontFamily()));
        assertEquals("normal", Filters.asString(font.getFontStyle()));
        assertEquals("normal", Filters.asString(font.getFontWeight()));
        assertEquals(10, Filters.asInt(font.getFontSize()));
    }
View Full Code Here

     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        Font font = styleFactory.getDefaultFont();
       
        boolean familyFound = false;
        for (Iterator i = node.getChildValues(CssParameter.class).iterator(); i.hasNext();) {
            CssParameter css = (CssParameter) i.next();

            Expression exp = css.getExpression();
            if (exp == null) {
                continue;
            }

            if ("font-family".equals(css.getName())) {
                if(!familyFound) {
                    font.getFamily().set(0, exp);
                    familyFound = true;
                } else {
                    font.getFamily().add(exp);
                }
            }

            if ("font-style".equals(css.getName())) {
                font.setStyle(exp);
            }

            if ("font-weight".equals(css.getName())) {
                font.setWeight(exp);
            }

            if ("font-size".equals(css.getName())) {
                font.setSize(exp);
            }
        }

        return font;
    }
View Full Code Here

            }
        }
    }

    private void chooseLabelFont() {
        Font font = JFontChooser.showDialog(this, "Choose label font", labelFont);
        if (font != null) {
            labelFont = font;
        }
    }
View Full Code Here

        String fontName = this.font[0].getName();
        boolean fontBold = (this.font[0].getStyle() == SWT.BOLD);
        boolean fontItalic = (this.font[0].getStyle() == SWT.ITALIC);
        double fontSize = this.font[0].getHeight();
        Font gtFont = build.createFont(fontName, fontItalic, fontBold, fontSize);
        Fill fill = build.createFill(this.colour);

        LabelPlacement placement;
        if (pointPlacement) {
            // PointPlacement
View Full Code Here

     * @param symbolizer Text symbolizer information.
     * @return FontData[] of the font's fill, or null if unavailable.
     */
    public static FontData[] textFont( TextSymbolizer symbolizer ) {

        Font font = font(symbolizer);
        if (font == null)
            return null;

        FontData[] tempFD = new FontData[1];
        Expression fontFamilyExpression = font.getFamily().get(0);
        Expression sizeExpression = font.getSize();
        if (sizeExpression == null || fontFamilyExpression == null)
            return null;

        Double size = sizeExpression.evaluate(null, Double.class);

View Full Code Here

    }

    public static Font font( TextSymbolizer symbolizer ) {
        if (symbolizer == null)
            return null;
        Font font = symbolizer.getFont();
        return font;
    }
View Full Code Here

     *
     * @return a new Font object or {@code null} if the user cancelled the dialog
     */
    static Font showDialog(Component owner, String title, Font labelFont) {
        JFontChooser chooser = null;
        Font font = null;

        if (owner == null) {
            chooser = new JFontChooser((JFrame) null, title, labelFont);

        } else {
View Full Code Here

TOP

Related Classes of org.geotools.styling.Font$Style

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.