Tabnine Logo
Font
Code IndexAdd Tabnine to your IDE (free)

How to use
Font
in
org.geotools.styling

Best Java code snippets using org.geotools.styling.Font (Showing top 20 results out of 315)

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

org.geotools.stylingFont

Javadoc

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.

Most used methods

  • getFamily
  • getSize
  • getStyle
  • getWeight
  • getFontFamily
  • getFontSize
  • getFontStyle
  • getFontWeight
  • setSize
  • setStyle
  • setFontFamily
  • setFontSize
  • setFontFamily,
  • setFontSize,
  • setFontStyle,
  • setFontWeight,
  • setWeight

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • setRequestProperty (URLConnection)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now