@Override public Text create(JSONObject node, ValidationContext ctx) { return new Text(node); } }
/** * Returns the Font Style. * * @return String */ public String getFontStyle() { return getAttributes().getFontStyle(); }
/** * Draws this text * * @param context */ @Override public boolean prepare(Context2D context, Attributes attr, double alpha) { String text = getText(); if ((null == text) || (text.isEmpty())) { return false; } if (attr.isDefined(Attribute.TEXT_BASELINE)) { context.setTextBaseline(getTextBaseLine()); } if (attr.isDefined(Attribute.TEXT_ALIGN)) { context.setTextAlign(getTextAlign()); } context.setTextFont(getFontStyle() + " " + getFontSize() + "pt " + getFontFamily()); return true; }
String text = getText(); context.setTextFont(getFontStyle() + " " + getFontSize() + "pt " + getFontFamily()); double width = getStrokeWidth(); context.transform(getAbsoluteTransform());
Layer layer = getLayer(); context.getJSO().fillTextWithGradient(getText(), 0, 0, 0, 0, layer.getWidth(), layer.getHeight(), getColorKey()); setWasFilledFlag(true); doApplyShadow(context, attr); context.fillText(getText(), 0, 0); setWasFilledFlag(true); context.fillText(getText(), 0, 0); setWasFilledFlag(true); context.fillText(getText(), 0, 0); setWasFilledFlag(true); context.fillText(getText(), 0, 0); setWasFilledFlag(true);
@Override protected void stroke(Context2D context, Attributes attr, double alpha) { context.save(); if (setStrokeParams(context, attr, alpha)) { if (context.isSelection()) { context.beginPath(); context.strokeText(getText(), 0, 0); context.closePath(); } else { doApplyShadow(context, attr); context.beginPath(); context.strokeText(getText(), 0, 0); context.closePath(); } } context.restore(); }
/** * Sets the Font Style. * * @param style * @return this Text */ public Text setFontStyle(String style) { getAttributes().setFontStyle(style); return this; }
/** * Returns the Font Size. * * @return double */ public double getFontSize() { return getAttributes().getFontSize(); }
/** * Sets the {@link Text} String * * @return this Text */ public Text setText(String text) { getAttributes().setText(text); return this; }
/** * Returns the Font Family. * * @return String */ public String getFontFamily() { return getAttributes().getFontFamily(); }
/** * Sets the {@link TextBaseLine} * * @param baseline * @return this Text */ public Text setTextBaseLine(TextBaseLine baseline) { getAttributes().setTextBaseLine(baseline); return this; }
/** * Returns the {@link Text} String * * @return String */ public String getText() { return getAttributes().getText(); }
/** * Sets the {@link Text} Font Family * * @return this Text */ public Text setFontFamily(String family) { getAttributes().setFontFamily(family); return this; }
/** * Sets the Font Size. * * @param size * @return this Text */ public Text setFontSize(double size) { getAttributes().setFontSize(size); return this; }
/** * Sets the {@link TextAlign} * * @param align * @return this Text */ public Text setTextAlign(TextAlign align) { getAttributes().setTextAlign(align); return this; }
/** * Returns the {@link TextAlign} * * @return {@link TextAlign} */ public TextAlign getTextAlign() { return getAttributes().getTextAlign(); }
/** * Returns the {@link TextBaseLine} * * @return {@link TextBaseLine} */ public TextBaseLine getTextBaseLine() { return getAttributes().getTextBaseLine(); }