[xep-support] text-align="<string>"

Nikolai Grigoriev grig at renderx.com
Tue Apr 2 05:38:24 PST 2002


Hi Els,

> Yet another table query: how can alignment on specific characters in table
> cells be realized?
> We're using the (CALS) table attribute align="char" in XML files, and I
> presume this should be transformed to "text-align=<string>", but this is not
> implemented in XEP (par. 7.15.9, note 16).

Yes, unfortunately :-(.

> Is there another way/workaround to fix this?

More than one :-).

1) You can use a text-filled leader to ensure a constant distance from the right
edge of a table cell to the decimal point:

<fo:block text-align="end">
  123.<fo leader leader-length="2em"
                 leader-pattern="use-content"
                 leader-pattern-width="2em">45</fo:leader>
</fo:block>

This places the dot exactly 2 ems from the right edge of the text, whatever the
contents of <fo:leader> is.
All the three properties are inheritable: consider specifying at least
leader-pattern on top of the whole table to make the markup less verbose.

2). You can achieve the same effect using a list-block or a nested table: put
the integer part to fo:list-item-label (first cell) aligning it to the right,
and the fractional part to fo:list-item-body(second cell) aligned to the left.
This is conceptually simpler but less safe in situations when font changes may
occur in the text to align: XEP does not support relative-align="baseline" for
lists and tables. (There are workarounds even for this, but let's not delve too
far until we have to :-)).

Personally, I strongly prefer Variant 1, also because it's far more
computation-efficient: tables and lists inflict a gross performance penalty to
the formatter, while a text-filled leader is nearly equivalent to plain text.

Both variants will require pre-splitting of the string to align: it's pretty
easy in XPath using substring-before() and substring-after() functions.

Hope this helps.

Best regards,
Nikolai

-------------------
By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



More information about the Xep-support mailing list