public FontBuilder reset() { Font df = sf.getDefaultFont(); this.families = new ArrayList<Expression>(); this.size = df.getSize(); this.style = df.getStyle(); this.weight = df.getWeight(); return this; }
public FontBuilder reset(Font font) { if (font == null) { return reset(); } this.families = font.getFamily() != null ? font.getFamily() : new ArrayList<Expression>(); this.size = font.getSize(); this.style = font.getStyle(); this.weight = font.getWeight(); unset = false; return this; }
String styleName = ((Literal) selectedFont.getStyle()).getValue().toString(); for (int index = 0; index < styles.length; index++) { if (styles[index].equalsIgnoreCase(styleName)) {
@Override protected void encode(Font font) { putName("font-family", font.getFontFamily()); put("font-size", font.getSize()); putName("font-style", font.getStyle()); putName("font-weight", font.getWeight()); } }
/** Null safe copy of a single font */ protected Font copy(Font font) { if (font == null) return font; List<Expression> fontFamily = copyExpressions(font.getFamily()); Expression fontStyle = copy(font.getStyle()); Expression fontWeight = copy(font.getWeight()); Expression fontSize = copy(font.getSize()); Font copy = sf.font(fontFamily, fontStyle, fontWeight, fontSize); return copy; }
/** * Checks if font style set. * * @return true, if is font name set */ public boolean isFontStyleSet() { return ((font != null) && (font.getStyle() != null)); }
@SuppressWarnings("deprecation") @Test public void font() throws Exception { List<Expression> family = new ArrayList<Expression>(); family.add(ff.literal("ariel")); family.add(ff.literal("Helvetica")); family.add(ff.literal("sanserif")); Expression style = ff.literal("noraml"); Expression weight = ff.literal("normal"); Expression size = ff.literal(12); Font font = sf.font(family, style, weight, size); assertEquals(family, font.getFamily()); assertEquals(style, font.getStyle()); // oblique or italic assertEquals(weight, font.getWeight()); // bold or normal assertEquals(size, font.getSize()); assertSame(font.getFontStyle(), font.getStyle()); assertSame(font.getFontFamily(), family.get(0)); assertSame(font.getFontWeight(), font.getWeight()); assertSame(font.getFontSize(), font.getSize()); FontImpl cast = FontImpl.cast(font); assertSame(cast, font); }
/** * Gets the font style. * * @return the fontStyle */ public String getFontStyle() { if (isFontStyleSet()) { return this.font.getStyle().toString(); } return NOT_SET_STRING; }
/** * Checks if is font style updated. * * @return the fontStyleUpdated */ public boolean isFontStyleUpdated() { return (font != null) && isSame(originalFontStyle, font.getStyle()); }
encodeCssParam("font-style", initialFont.getStyle()); encodeCssParam("font-weight", initialFont.getWeight()); end("Font"); encodeCssParam("font-family", font.getFamily().get(0)); encodeCssParam("font-size", font.getSize()); encodeCssParam("font-style", font.getStyle()); encodeCssParam("font-weight", font.getWeight()); end("Font");
assertEquals("Arial", Filters.asString(font.getFontFamily())); assertEquals(10, Filters.asInt(font.getSize())); assertEquals("normal", Filters.asString(font.getStyle())); assertEquals("bold", Filters.asString(font.getWeight()));
/** * Sets the original data. * * @param newFont the new original data */ private void setOriginalData(Font newFont) { this.originalFontName = newFont.getFamily(); this.originalFontStyle = newFont.getStyle(); this.originalFontWeight = newFont.getWeight(); this.originalFontSize = newFont.getSize(); }
assertEquals(12, Filters.asInt(font.getSize())); assertEquals("bold", Filters.asString(font.getWeight())); assertEquals("normal", Filters.asString(font.getStyle()));
assertEquals("Arial", Filters.asString(font.getFontFamily())); assertEquals(11, Filters.asInt(font.getSize())); assertEquals("normal", Filters.asString(font.getStyle())); assertEquals("bold", Filters.asString(font.getWeight()));
@Override protected void encode(Font font) { putName("font-family", font.getFontFamily()); put("font-size", font.getSize()); putName("font-style", font.getStyle()); putName("font-weight", font.getWeight()); } }
assertEquals(12, Filters.asInt(font.getSize())); assertEquals("bold", Filters.asString(font.getWeight())); assertEquals("normal", Filters.asString(font.getStyle()));
/** @param textSymbolizer */ private void populateFont(TextSymbolizer textSymbolizer) { Font font = textSymbolizer.getFont(); GroupConfigInterface group = getGroup(GroupIdEnum.FONT); group.enable(font != null); if (font != null) { fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_FAMILY, font); fieldConfigVisitor.populateField(FieldIdEnum.FONT_WEIGHT, font.getWeight()); fieldConfigVisitor.populateField(FieldIdEnum.FONT_STYLE, font.getStyle()); fieldConfigVisitor.populateField(FieldIdEnum.FONT_SIZE, font.getSize()); } fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_PREVIEW, font); }