本文整理了Java中org.geotools.styling.Font
类的一些代码示例,展示了Font
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Font
类的具体详情如下:
包路径:org.geotools.styling.Font
类名称:Font
[英]A system-independent object for holding SLD font information. This holds information on the text font to use in text processing. Font-family, font-style, font-weight and font-size.
[中]与系统无关的对象,用于保存SLD字体信息。它保存有关文本处理中使用的文本字体的信息。字体系列、字体样式、字体重量和字体大小。
代码示例来源:origin: geotools/geotools
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;
}
代码示例来源:origin: geotools/geotools
@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);
}
代码示例来源:origin: geotools/geotools
font.getFamily().set(0, exp);
familyFound = true;
} else {
font.getFamily().add(exp);
font.setStyle(exp);
font.setWeight(exp);
font.setSize(exp);
代码示例来源:origin: geotools/geotools
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;
}
代码示例来源:origin: geotools/geotools
@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());
}
}
代码示例来源:origin: robward-scisys/sldeditor
/**
* Sets the font.
*
* @param newFont the new font
*/
public void setFont(Font newFont) {
if (newFont != null) {
this.font = styleFactory.getDefaultFont();
font.getFamily().clear();
font.getFamily().addAll(newFont.getFamily());
font.setStyle(newFont.getStyle());
font.setWeight(newFont.getWeight());
font.setSize(newFont.getSize());
setOriginalData(newFont);
}
}
代码示例来源:origin: org.geotools/gt-widgets-swing-pending
public void setEdited(Font font){
this.font = font;
if(font != null){
guiFamily.setExpression(font.getFontFamily());
guiSize.setExpression(font.getFontSize());
guiStyle.setExpression(font.getFontStyle());
guiWeight.setExpression(font.getFontWeight());
}
}
代码示例来源:origin: geotools/geotools
/**
* Utility method to capture the default font in one place.
*
* @return
*/
static Font createDefault(FilterFactory filterFactory) {
Font font = new FontImpl();
try {
font.setSize(filterFactory.literal(Integer.valueOf(10)));
font.setStyle(filterFactory.literal("normal"));
font.setWeight(filterFactory.literal("normal"));
font.setFontFamily(filterFactory.literal("Serif"));
} catch (org.geotools.filter.IllegalFilterException ife) {
throw new RuntimeException("Error creating default", ife);
}
return font;
}
代码示例来源:origin: geotools/geotools
font.setSize(rescale(font.getSize()));
代码示例来源:origin: geotools/geotools
private java.awt.Font styleFont(
Object feature, Font curr, java.awt.Font javaFont, TextSymbolizer symbolizer) {
String reqStyle = evalToString(curr.getFontStyle(), feature, null);
String reqWeight = evalToString(curr.getFontWeight(), feature, null);
float size = evalToFloat(curr.getSize(), feature, 10);
代码示例来源:origin: geotools/geotools
if (firstFontFamily) {
font.getFamily().clear();
firstFontFamily = false;
font.getFamily().add(parseCssParameter(child));
} else if (res.equalsIgnoreCase("font-style")) {
font.setFontStyle(parseCssParameter(child));
} else if (res.equalsIgnoreCase("font-size")) {
font.setFontSize(parseCssParameter(child));
} else if (res.equalsIgnoreCase("font-weight")) {
font.setFontWeight(parseCssParameter(child));
代码示例来源:origin: geotools/geotools
int textSize = getPositiveValue(font.getSize());
int delta = -1;
if (text.getLabelPlacement() instanceof PointPlacement) {
代码示例来源:origin: geotools/geotools
for (Expression family : curr.getFamily()) {
String requestedFont = evalToString(family, feature, null);
java.awt.Font javaFont = FontCache.getDefaultInstance().getFont(requestedFont);
代码示例来源:origin: robward-scisys/sldeditor
/**
* Checks if font weight set.
*
* @return true, if is font name set
*/
public boolean isFontWeightSet() {
return ((font != null) && (font.getWeight() != null));
}
代码示例来源:origin: robward-scisys/sldeditor
/**
* Checks if font style set.
*
* @return true, if is font name set
*/
public boolean isFontStyleSet() {
return ((font != null) && (font.getStyle() != null));
}
代码示例来源:origin: org.geotools/gt-widgets-swing-pending
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, text, isSelected, hasFocus, row, column);
Font f = (Font) value;
java.awt.Font font = new java.awt.Font(f.getFontFamily().toString(), java.awt.Font.PLAIN, 12);
lbl.setFont(font);
return lbl;
}
}
代码示例来源:origin: stackoverflow.com
public class HeaderAndFooter extends PdfPageEventHelper {
private Font footerFont;
public HeaderAndFooter() {
super();
footerFont = getFontObj(BaseColor.LIGHT_GRAY, 15);
footerFont.setStyle(Font.ITALIC);
}
@Override
public void onEndPage(PdfWriter writer, Document document) {
PdfContentByte cb = writer.getDirectContent();
ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, new Phrase(String.format("Page %d", writer.getPageNumber()),footerFont), (document.left() + document.right())/2 , document.bottom()-20, 0);
}
}
代码示例来源:origin: stackoverflow.com
f1.setSize(16);
代码示例来源:origin: robward-scisys/sldeditor
/**
* Update font.
*
* @param fontData the font data
*/
public void updateFont(Font fontData) {
if ((fontData != null) && (font != null)) {
if (!fontData.getFamily().isEmpty()
&& (!(fontData.getFamily().equals(font.getFamily())))) {
font.getFamily().clear();
font.getFamily().addAll(fontData.getFamily());
}
if ((fontData.getWeight() != null)
&& (!(fontData.getWeight().equals(font.getWeight())))) {
font.setWeight(fontData.getWeight());
}
if ((fontData.getStyle() != null) && (!(fontData.getStyle().equals(font.getStyle())))) {
font.setStyle(fontData.getStyle());
}
if ((fontData.getSize() != null) && (!(fontData.getSize().equals(font.getSize())))) {
font.setSize(fontData.getSize());
}
}
}
代码示例来源:origin: org.geotools/gt-main
/** Null safe copy of a single font */
protected Font copy(Font font) {
if( font == null) return font;
Expression fontFamily = copy( font.getFontFamily() );
Expression fontStyle = copy( font.getFontStyle() );
Expression fontWeight = copy( font.getFontWeight() );
Expression fontSize = copy( font.getFontSize() );
Font copy = sf.createFont(fontFamily, fontStyle, fontWeight, fontSize);
return copy;
}
内容来源于网络,如有侵权,请联系作者删除!