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

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

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

Font.getFamily介绍

[英]SVG font-family parameters in preferred order.
[中]SVG字体系列参数的首选顺序。

代码示例

代码示例来源: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. if (firstFontFamily) {
  2. font.getFamily().clear();
  3. firstFontFamily = false;
  4. font.getFamily().add(parseCssParameter(child));
  5. } else if (res.equalsIgnoreCase("font-style")) {
  6. font.setFontStyle(parseCssParameter(child));

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

  1. for (Expression family : curr.getFamily()) {
  2. String requestedFont = evalToString(family, feature, null);
  3. java.awt.Font javaFont = FontCache.getDefaultInstance().getFont(requestedFont);

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

  1. font.getFamily().set(0, exp);
  2. familyFound = true;
  3. } else {
  4. font.getFamily().add(exp);

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

  1. for (Expression family : selectedFont.getFamily()) {
  2. String familyName = ((Literal) family).getValue().toString();
  3. for (int index = 0; index < families.length; index++) {

代码示例来源: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 name set.
  3. *
  4. * @return true, if is font name set
  5. */
  6. public boolean isFontNameSet() {
  7. return ((font != null) && !font.getFamily().isEmpty());
  8. }

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

  1. /**
  2. * Checks if is font name updated.
  3. *
  4. * @return the fontNameUpdated
  5. */
  6. public boolean isFontNameUpdated() {
  7. return ((font != null) && !(originalFontName.equals(font.getFamily())));
  8. }

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

  1. /**
  2. * Gets the string value.
  3. *
  4. * @return the string value
  5. */
  6. @Override
  7. public String getStringValue() {
  8. Font font = getFont();
  9. if ((font != null) && (!font.getFamily().isEmpty())) {
  10. return font.getFamily().get(0).toString();
  11. }
  12. return null;
  13. }

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

  1. /**
  2. * Gets the font name.
  3. *
  4. * @return the fontName
  5. */
  6. public String getFontName() {
  7. if (isFontNameSet()) {
  8. return this.font.getFamily().get(0).toString();
  9. }
  10. return NOT_SET_STRING;
  11. }

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

  1. List<Font> fonts = text.fonts();
  2. for (Font font : fonts) {
  3. if (font.getFamily() != null) {
  4. for (Expression family : font.getFamily()) {
  5. family.accept(this, null);

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

  1. encodeCssParam("font-family", font.getFamily().get(0));
  2. encodeCssParam("font-family", font.getFamily().get(0));
  3. encodeCssParam("font-size", font.getSize());
  4. encodeCssParam("font-style", font.getStyle());

代码示例来源: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. /** Revert to original. */
  2. public void revertToOriginal() {
  3. if (this.font != null) {
  4. this.font.getFamily().clear();
  5. this.font.getFamily().addAll(originalFontName);
  6. this.font.setWeight(originalFontWeight);
  7. this.font.setStyle(originalFontStyle);
  8. this.font.setSize(originalFontSize);
  9. }
  10. }

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

  1. if (font.getFamily() != null) {
  2. for (Expression list : font.getFamily()) {
  3. list.accept(this, null);

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

  1. /**
  2. * Sets the font.
  3. *
  4. * @param newFont the new font
  5. */
  6. public void setFont(Font newFont) {
  7. if (newFont != null) {
  8. this.font = styleFactory.getDefaultFont();
  9. font.getFamily().clear();
  10. font.getFamily().addAll(newFont.getFamily());
  11. font.setStyle(newFont.getStyle());
  12. font.setWeight(newFont.getWeight());
  13. font.setSize(newFont.getSize());
  14. setOriginalData(newFont);
  15. }
  16. }

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

  1. /**
  2. * Gets the font.
  3. *
  4. * @return the font
  5. */
  6. public Font getFont() {
  7. List<Expression> family = new ArrayList<>();
  8. Expression style = null;
  9. Expression weight = null;
  10. Expression size = null;
  11. if (firstEntry != null) {
  12. family = (familyMultipleValue ? firstEntry.getFamily() : family);
  13. style = (styleMultipleValue ? firstEntry.getStyle() : null);
  14. weight = (weightMultipleValue ? firstEntry.getWeight() : null);
  15. size = (sizeMultipleValue ? firstEntry.getSize() : null);
  16. }
  17. return styleFactory.font(family, style, weight, size);
  18. }
  19. }

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

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

相关文章