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

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

本文整理了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

  1. public FontBuilder reset() {
  2. Font df = sf.getDefaultFont();
  3. this.families = new ArrayList<Expression>();
  4. this.size = df.getSize();
  5. this.style = df.getStyle();
  6. this.weight = df.getWeight();
  7. return this;
  8. }

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

  1. public FontBuilder reset(Font font) {
  2. if (font == null) {
  3. return reset();
  4. }
  5. this.families = font.getFamily() != null ? font.getFamily() : new ArrayList<Expression>();
  6. this.size = font.getSize();
  7. this.style = font.getStyle();
  8. this.weight = font.getWeight();
  9. unset = false;
  10. return this;
  11. }

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

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

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

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

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

  1. @Override
  2. protected void encode(Font font) {
  3. putName("font-family", font.getFontFamily());
  4. put("font-size", font.getSize());
  5. putName("font-style", font.getStyle());
  6. putName("font-weight", font.getWeight());
  7. }
  8. }

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

  1. /** Null safe copy of a single font */
  2. protected Font copy(Font font) {
  3. if (font == null) return font;
  4. List<Expression> fontFamily = copyExpressions(font.getFamily());
  5. Expression fontStyle = copy(font.getStyle());
  6. Expression fontWeight = copy(font.getWeight());
  7. Expression fontSize = copy(font.getSize());
  8. Font copy = sf.font(fontFamily, fontStyle, fontWeight, fontSize);
  9. return copy;
  10. }

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

  1. /**
  2. * Checks if font weight set.
  3. *
  4. * @return true, if is font name set
  5. */
  6. public boolean isFontWeightSet() {
  7. return ((font != null) && (font.getWeight() != null));
  8. }

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

  1. @SuppressWarnings("deprecation")
  2. @Test
  3. public void font() throws Exception {
  4. List<Expression> family = new ArrayList<Expression>();
  5. family.add(ff.literal("ariel"));
  6. family.add(ff.literal("Helvetica"));
  7. family.add(ff.literal("sanserif"));
  8. Expression style = ff.literal("noraml");
  9. Expression weight = ff.literal("normal");
  10. Expression size = ff.literal(12);
  11. Font font = sf.font(family, style, weight, size);
  12. assertEquals(family, font.getFamily());
  13. assertEquals(style, font.getStyle()); // oblique or italic
  14. assertEquals(weight, font.getWeight()); // bold or normal
  15. assertEquals(size, font.getSize());
  16. assertSame(font.getFontStyle(), font.getStyle());
  17. assertSame(font.getFontFamily(), family.get(0));
  18. assertSame(font.getFontWeight(), font.getWeight());
  19. assertSame(font.getFontSize(), font.getSize());
  20. FontImpl cast = FontImpl.cast(font);
  21. assertSame(cast, font);
  22. }

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

  1. /**
  2. * Gets the font weight.
  3. *
  4. * @return the fontWeight
  5. */
  6. public String getFontWeight() {
  7. if (isFontWeightSet()) {
  8. return this.font.getWeight().toString();
  9. }
  10. return NOT_SET_STRING;
  11. }

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

  1. /**
  2. * Checks if is font weight updated.
  3. *
  4. * @return the fontWeightUpdated
  5. */
  6. public boolean isFontWeightUpdated() {
  7. return (font != null) && isSame(originalFontWeight, font.getWeight());
  8. }

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

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

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

  1. encodeCssParam("font-weight", initialFont.getWeight());
  2. end("Font");
  3. } else {
  4. encodeCssParam("font-size", font.getSize());
  5. encodeCssParam("font-style", font.getStyle());
  6. encodeCssParam("font-weight", font.getWeight());
  7. end("Font");

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

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

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

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

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

  1. /**
  2. * Sets the original data.
  3. *
  4. * @param newFont the new original data
  5. */
  6. private void setOriginalData(Font newFont) {
  7. this.originalFontName = newFont.getFamily();
  8. this.originalFontStyle = newFont.getStyle();
  9. this.originalFontWeight = newFont.getWeight();
  10. this.originalFontSize = newFont.getSize();
  11. }

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

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

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

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

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

  1. @Override
  2. protected void encode(Font font) {
  3. putName("font-family", font.getFontFamily());
  4. put("font-size", font.getSize());
  5. putName("font-style", font.getStyle());
  6. putName("font-weight", font.getWeight());
  7. }
  8. }

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

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

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

  1. /** @param textSymbolizer */
  2. private void populateFont(TextSymbolizer textSymbolizer) {
  3. Font font = textSymbolizer.getFont();
  4. GroupConfigInterface group = getGroup(GroupIdEnum.FONT);
  5. group.enable(font != null);
  6. if (font != null) {
  7. fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_FAMILY, font);
  8. fieldConfigVisitor.populateField(FieldIdEnum.FONT_WEIGHT, font.getWeight());
  9. fieldConfigVisitor.populateField(FieldIdEnum.FONT_STYLE, font.getStyle());
  10. fieldConfigVisitor.populateField(FieldIdEnum.FONT_SIZE, font.getSize());
  11. }
  12. fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_PREVIEW, font);
  13. }

相关文章