Skip to content

Commit

Permalink
svg1.2: support attribute text-align="center" in SVG 1.2 flow elements.
Browse files Browse the repository at this point in the history
Closes #33
  • Loading branch information
carlosame committed Jun 29, 2021
1 parent c37867e commit 97bb297
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import io.sf.carte.echosvg.css.engine.value.ComputedValue;
import io.sf.carte.echosvg.css.engine.value.Value;
import io.sf.carte.echosvg.css.engine.value.ValueConstants;
import io.sf.carte.echosvg.css.engine.value.svg.SVGValueConstants;
import io.sf.carte.echosvg.css.engine.value.svg12.LineHeightValue;
import io.sf.carte.echosvg.css.engine.value.svg12.SVG12ValueConstants;
import io.sf.carte.echosvg.dom.AbstractNode;
Expand Down Expand Up @@ -855,7 +856,7 @@ public BlockInfo makeBlockInfo(BridgeContext ctx, Element element) {
int textAlign;
if (v == SVG12ValueConstants.START_VALUE)
textAlign = BlockInfo.ALIGN_START;
else if (v == SVG12ValueConstants.MIDDLE_VALUE)
else if (v == SVG12ValueConstants.CENTER_VALUE || v == SVGValueConstants.MIDDLE_VALUE)
textAlign = BlockInfo.ALIGN_MIDDLE;
else if (v == SVG12ValueConstants.END_VALUE)
textAlign = BlockInfo.ALIGN_END;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.sf.carte.echosvg.css.engine.value.StringValue;
import io.sf.carte.echosvg.css.engine.value.Value;
import io.sf.carte.echosvg.css.engine.value.svg.SVGValueConstants;
import io.sf.carte.echosvg.util.CSSConstants;
import io.sf.carte.echosvg.util.SVG12CSSConstants;

/**
Expand All @@ -37,8 +38,8 @@ public interface SVG12ValueConstants extends SVGValueConstants {

/** The 'start' keyword. */
Value START_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, SVG12CSSConstants.CSS_FULL_VALUE);
/** The 'middle' keyword. */
Value MIDDLE_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, SVG12CSSConstants.CSS_MIDDLE_VALUE);
/** The 'center' keyword. */
Value CENTER_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, CSSConstants.CSS_CENTER_VALUE);
/** The 'end' keyword. */
Value END_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, SVG12CSSConstants.CSS_END_VALUE);
/** The 'full' keyword. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import io.sf.carte.echosvg.css.engine.value.Value;
import io.sf.carte.echosvg.css.engine.value.ValueConstants;
import io.sf.carte.echosvg.css.engine.value.ValueManager;
import io.sf.carte.echosvg.css.engine.value.svg.SVGValueConstants;
import io.sf.carte.echosvg.util.CSSConstants;
import io.sf.carte.echosvg.util.SVG12CSSConstants;
import io.sf.carte.echosvg.util.SVGTypes;

Expand All @@ -43,7 +45,8 @@ public class TextAlignManager extends IdentifierManager {

static {
values.put(SVG12CSSConstants.CSS_START_VALUE, SVG12ValueConstants.START_VALUE);
values.put(SVG12CSSConstants.CSS_MIDDLE_VALUE, SVG12ValueConstants.MIDDLE_VALUE);
values.put(CSSConstants.CSS_CENTER_VALUE, SVG12ValueConstants.CENTER_VALUE);
values.put(CSSConstants.CSS_MIDDLE_VALUE, SVGValueConstants.MIDDLE_VALUE);
values.put(SVG12CSSConstants.CSS_END_VALUE, SVG12ValueConstants.END_VALUE);
values.put(SVG12CSSConstants.CSS_FULL_VALUE, SVG12ValueConstants.FULL_VALUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface SVG12CSSConstants extends CSSConstants {
String CSS_MARGIN_LEFT_PROPERTY = "margin-left";
/** property name for indent */
String CSS_INDENT_PROPERTY = "indent";
/** propery name for text-align */
/** property name for text-align */
String CSS_TEXT_ALIGN_PROPERTY = "text-align";
/** property name for color attribute */
String CSS_SOLID_COLOR_PROPERTY = "solid-color";
Expand All @@ -50,8 +50,6 @@ public interface SVG12CSSConstants extends CSSConstants {

/** Value for text-align to start of text on line */
String CSS_START_VALUE = "start";
/** Value for text-align to middle of text on line */
String CSS_MIDDLE_VALUE = "middle";
/** Value for text-align to end of region */
String CSS_END_VALUE = "end";
/** Value for text-align to both edges of region */
Expand Down
2 changes: 1 addition & 1 deletion samples/tests/spec12/text/flowText.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion samples/tests/spec12/text/flowText2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion samples/tests/spec12/text/flowText3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion samples/tests/spec12/text/flowText4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions samples/tests/spec12/text/flowText5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 97bb297

Please sign in to comment.