Esempio n. 1
0
 static {
   HashMap<String, TextAlign> m = new HashMap<String, TextAlign>();
   m.put("start", TextAlign.START);
   m.put("center", TextAlign.CENTER);
   m.put("end", TextAlign.END);
   SVG_TEXT_ALIGNS = Collections.unmodifiableMap(m);
 }
Esempio n. 2
0
 static {
   HashMap<String, Integer> m = new HashMap<String, Integer>();
   m.put("miter", BasicStroke.JOIN_MITER);
   m.put("round", BasicStroke.JOIN_ROUND);
   m.put("bevel", BasicStroke.JOIN_BEVEL);
   SVG_STROKE_LINEJOINS = Collections.unmodifiableMap(m);
 }
Esempio n. 3
0
 static {
   HashMap<String, TextAnchor> m = new HashMap<String, TextAnchor>();
   m.put("start", TextAnchor.START);
   m.put("middle", TextAnchor.MIDDLE);
   m.put("end", TextAnchor.END);
   SVG_TEXT_ANCHORS = Collections.unmodifiableMap(m);
 }
Esempio n. 4
0
 static {
   HashMap<String, Integer> m = new HashMap<String, Integer>();
   m.put("butt", BasicStroke.CAP_BUTT);
   m.put("round", BasicStroke.CAP_ROUND);
   m.put("square", BasicStroke.CAP_SQUARE);
   SVG_STROKE_LINECAPS = Collections.unmodifiableMap(m);
 }
Esempio n. 5
0
  private Shape getTextShape() {
    if (cachedTextShape == null) {
      String text = getText();
      if (text == null || text.length() == 0) {
        text = " ";
      }

      FontRenderContext frc = getFontRenderContext();
      HashMap<TextAttribute, Object> textAttributes = new HashMap<TextAttribute, Object>();
      textAttributes.put(TextAttribute.FONT, getFont());
      if (FONT_UNDERLINE.get(this)) {
        textAttributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
      }
      TextLayout textLayout = new TextLayout(text, textAttributes, frc);

      AffineTransform tx = new AffineTransform();
      tx.translate(coordinates[0].x, coordinates[0].y);
      switch (TEXT_ANCHOR.get(this)) {
        case END:
          tx.translate(-textLayout.getAdvance(), 0);
          break;
        case MIDDLE:
          tx.translate(-textLayout.getAdvance() / 2d, 0);
          break;
        case START:
          break;
      }
      tx.rotate(rotates[0]);

      /*
      if (TRANSFORM.get(this) != null) {
          tx.preConcatenate(TRANSFORM.get(this));
      }*/

      cachedTextShape = tx.createTransformedShape(textLayout.getOutline(tx));
      cachedTextShape = textLayout.getOutline(tx);
    }
    return cachedTextShape;
  }
Esempio n. 6
0
 static {
   HashMap<String, Double> m = new HashMap<String, Double>();
   m.put("xx-small", 6.944444);
   m.put("x-small", 8.3333333);
   m.put("small", 10d);
   m.put("medium", 12d);
   m.put("large", 14.4);
   m.put("x-large", 17.28);
   m.put("xx-large", 20.736);
   SVG_ABSOLUTE_FONT_SIZES = Collections.unmodifiableMap(m);
 }
Esempio n. 7
0
 static {
   HashMap<String, Double> m = new HashMap<String, Double>();
   m.put("larger", 1.2);
   m.put("smaller", 0.83333333);
   SVG_RELATIVE_FONT_SIZES = Collections.unmodifiableMap(m);
 }
Esempio n. 8
0
 static {
   HashMap<String, WindingRule> m = new HashMap<String, WindingRule>();
   m.put("nonzero", WindingRule.NON_ZERO);
   m.put("evenodd", WindingRule.EVEN_ODD);
   SVG_FILL_RULES = Collections.unmodifiableMap(m);
 }