org.geotools.styling.Font.getWeight()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.geotools.styling.Font.getWeight()方法的一些代码示例,展示了Font.getWeight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Font.getWeight()方法的具体详情如下:
包路径:org.geotools.styling.Font
类名称:Font
方法名:getWeight

Font.getWeight介绍

[英]The "font-weight" SVG parameter should be "normal" or "bold".

If null the default should be considered as "normal"
[中]SVG参数“font-weight”应为“normal”或“bold”。
如果为空,则默认值应视为“正常”

代码示例

代码示例来源: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

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

Expression referenceSize = reference.getSize();
Expression referenceStyle = reference.getStyle();
Expression referenceWeight = reference.getWeight();
for (int i = 1; i < fonts.size(); i++) {
  Font f = fonts.get(i);
    return false;
  Expression weight = f.getWeight();
  if (!expressionEquals(referenceWeight, weight, DEFAULT_FONT.getWeight())) {
    return false;

代码示例来源:origin: geotools/geotools

String weightName = ((Literal) selectedFont.getWeight()).getValue().toString();
for (int index = 0; index < weights.length; index++) {
  if (weights[index].equalsIgnoreCase(weightName)) {

代码示例来源: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: geotools/geotools

/** 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;
}

代码示例来源: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: 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: robward-scisys/sldeditor

/**
 * Gets the font weight.
 *
 * @return the fontWeight
 */
public String getFontWeight() {
  if (isFontWeightSet()) {
    return this.font.getWeight().toString();
  }
  return NOT_SET_STRING;
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Checks if is font weight updated.
 *
 * @return the fontWeightUpdated
 */
public boolean isFontWeightUpdated() {
  return (font != null) && isSame(originalFontWeight, font.getWeight());
}

代码示例来源:origin: geotools/geotools

font.getStyle().accept(this, null);
if (font.getWeight() != null) {
  font.getWeight().accept(this, null);

代码示例来源:origin: geotools/geotools

encodeCssParam("font-weight", initialFont.getWeight());
  end("Font");
} else {
    encodeCssParam("font-size", font.getSize());
    encodeCssParam("font-style", font.getStyle());
    encodeCssParam("font-weight", font.getWeight());
    end("Font");

代码示例来源:origin: geotools/geotools

if (font.getWeight() != null) {
  font.getWeight().accept(this, null);

代码示例来源:origin: geotools/geotools

assertEquals(10, Filters.asInt(font.getSize()));
assertEquals("normal", Filters.asString(font.getStyle()));
assertEquals("bold", Filters.asString(font.getWeight()));

代码示例来源:origin: robward-scisys/sldeditor

/**
 * 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();
}

代码示例来源:origin: geotools/geotools

assertEquals(11, Filters.asInt(font.getSize()));
assertEquals("normal", Filters.asString(font.getStyle()));
assertEquals("bold", Filters.asString(font.getWeight()));

代码示例来源:origin: geotools/geotools

assertEquals("Arial", Filters.asString(font.getFamily().get(0)));
assertEquals(12, Filters.asInt(font.getSize()));
assertEquals("bold", Filters.asString(font.getWeight()));
assertEquals("normal", Filters.asString(font.getStyle()));

代码示例来源:origin: org.geotools/gt-ysld

@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: geotools/geotools

assertEquals("Arial", Filters.asString(font.getFamily().get(0)));
assertEquals(12, Filters.asInt(font.getSize()));
assertEquals("bold", Filters.asString(font.getWeight()));
assertEquals("normal", Filters.asString(font.getStyle()));

代码示例来源:origin: robward-scisys/sldeditor

/** @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);
}

相关文章