Loading ...
Sorry, an error occurred while loading the content.

Re: [XSL-FO] rotating text within a table-cell

Expand Messages
  • W. Eliot Kimber
    ... If you can get the length of the text in the XSLT process you can probably define a reasonable guess algorithm to set a width, e.g.:
    Message 1 of 6 , Jul 24, 2003
    • 0 Attachment
      Harm Kok wrote:


      > Somewhat, it did help me understanding the problem better. I still don't
      > like the idea of having to put fixed values in the "width" attribute. It
      > varies with the amount of text.
      > If the processor cannot calculate the width, how can I calculate it?

      If you can get the length of the text in the XSLT process you can
      probably define a reasonable guess algorithm to set a width, e.g.:

      <xsl:variable name="conlen" select="length(string(.))"/>
      <xsl:attribute name="inline-progression-dimension">
      <xsl:choose>
      <xsl:when test="$conlen < 100">2em</xsl:when>
      <xsl:when test="$conlen < 400">6em</xsl:when>
      <xsl:when test="$conlen < 600">8em</xsl:when>
      <xsl:otherwise>10em<xsl:message>More text than expected.
      Length=<xsl:value-of select="$conlen"/></xsl:message
      ></xsl:otherwise>
      </xsl:choose>
      </xsl:attribute>

      I've started looking into using extension functions that can get
      font-specific metrics to do more accurate content size guessing at XSLT
      time, but so far have not found a Java font metrics implementation that
      will work outside of an active AWT object (which is what the built-in
      Java implementation requires). RenderX has said they will eventually
      make their font metrics library publicly available, which would make it
      possible to do much more accurate width guessing so you could solve
      problems like this to a reasonable degree.

      This requirement could also be addressed by the use of a general
      "auxiliary data file" mechanism that let you capture rendition-time
      values and put them out to a file for input into a second pass. This
      would enable feedback from the rendering step to the XSLT step.

      Cheers,

      Eliot
      --
      W. Eliot Kimber, eliot@...
      Consultant, ISOGEN International

      1016 La Posada Dr., Suite 240
      Austin, TX 78752 Phone: 512.656.4139
    Your message has been successfully submitted and would be delivered to recipients shortly.