//Parent is checked first
deco = calcTextDecoration(parentList);
}
+ //For rules, see XSL 1.0, chapters 5.5.6 and 7.16.4
List list = pList.get(Constants.PR_TEXT_DECORATION).getList();
Iterator i = list.iterator();
while (i.hasNext()) {
deco = new CommonTextDecoration();
}
deco.decoration |= UNDERLINE;
+ deco.underColor = pList.get(Constants.PR_COLOR).getColorType();
} else if (enum == Constants.EN_NO_UNDERLINE) {
if (deco != null) {
deco.decoration &= OVERLINE | LINE_THROUGH | BLINK;
+ deco.underColor = pList.get(Constants.PR_COLOR).getColorType();
}
} else if (enum == Constants.EN_OVERLINE) {
if (deco == null) {
deco = new CommonTextDecoration();
}
deco.decoration |= OVERLINE;
+ deco.overColor = pList.get(Constants.PR_COLOR).getColorType();
} else if (enum == Constants.EN_NO_OVERLINE) {
if (deco != null) {
deco.decoration &= UNDERLINE | LINE_THROUGH | BLINK;
+ deco.overColor = pList.get(Constants.PR_COLOR).getColorType();
}
} else if (enum == Constants.EN_LINE_THROUGH) {
if (deco == null) {
deco = new CommonTextDecoration();
}
deco.decoration |= LINE_THROUGH;
+ deco.throughColor = pList.get(Constants.PR_COLOR).getColorType();
} else if (enum == Constants.EN_NO_LINE_THROUGH) {
if (deco != null) {
deco.decoration &= UNDERLINE | OVERLINE | BLINK;
+ deco.throughColor = pList.get(Constants.PR_COLOR).getColorType();
}
} else if (enum == Constants.EN_BLINK) {
if (deco == null) {
public boolean isBlinking() {
return (this.decoration & BLINK) != 0;
}
+
+ /** @return the color of the underline mark */
+ public ColorType getUnderlineColor() {
+ return this.underColor;
+ }
+
+ /** @return the color of the overline mark */
+ public ColorType getOverlineColor() {
+ return this.overColor;
+ }
+
+ /** @return the color of the line-through mark */
+ public ColorType getLineThroughColor() {
+ return this.throughColor;
+ }
+
}
if (deco != null) {
if (deco.hasUnderline()) {
area.addTrait(Trait.UNDERLINE, Boolean.TRUE);
+ area.addTrait(Trait.UNDERLINE_COLOR, deco.getUnderlineColor());
}
if (deco.hasOverline()) {
area.addTrait(Trait.OVERLINE, Boolean.TRUE);
+ area.addTrait(Trait.OVERLINE_COLOR, deco.getOverlineColor());
}
if (deco.hasLineThrough()) {
area.addTrait(Trait.LINETHROUGH, Boolean.TRUE);
+ area.addTrait(Trait.LINETHROUGH_COLOR, deco.getLineThroughColor());
}
if (deco.isBlinking()) {
area.addTrait(Trait.BLINK, Boolean.TRUE);
updateFont(name, size, pdf);
ColorType ct = (ColorType) text.getTrait(Trait.COLOR);
- if (ct != null) {
- updateColor(ct, true, pdf);
- }
+ updateColor(ct, true, pdf);
// word.getOffset() = only height of text itself
// currentBlockIPPosition: 0 for beginning of line; nonzero
updateLineWidth(fs.getDescender() / -8 / 1000f);
float endx = (startx + inline.getIPD()) / 1000f;
if (inline.hasUnderline()) {
+ ColorType ct = (ColorType) inline.getTrait(Trait.UNDERLINE_COLOR);
+ updateColor(ct, false, null);
float y = baseline - fs.getDescender() / 2;
drawLine(startx / 1000f, y / 1000f, endx, y / 1000f);
}
if (inline.hasOverline()) {
+ ColorType ct = (ColorType) inline.getTrait(Trait.OVERLINE_COLOR);
+ updateColor(ct, false, null);
float y = (float)(baseline - (1.1 * fs.getCapHeight()));
drawLine(startx / 1000f, y / 1000f, endx, y / 1000f);
}
if (inline.hasLineThrough()) {
+ ColorType ct = (ColorType) inline.getTrait(Trait.LINETHROUGH_COLOR);
+ updateColor(ct, false, null);
float y = (float)(baseline - (0.45 * fs.getCapHeight()));
drawLine(startx / 1000f, y / 1000f, endx, y / 1000f);
}
}
}
+ /**
+ * Establishes a new foreground or fill color.
+ * @param col the color to apply (null skips this operation)
+ * @param fill true to set the fill color, false for the foreground color
+ * @param pdf StringBuffer to write the PDF code to, if null, the code is
+ * written to the current stream.
+ */
private void updateColor(ColorType col, boolean fill, StringBuffer pdf) {
+ if (col == null) {
+ return;
+ }
Color newCol = new Color(col.getRed(), col.getGreen(), col.getBlue());
boolean update = false;
if (fill) {