OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Auto-font sizing for monospace.verbatim.properties font-size?


Hi David,
Unfortunately, there are no text fitting features in XSL-FO.  The stylesheet
has to specify the font-size, but there is no way in the general case for
the stylesheet to know if the text will fit.

But in the specific case of verbatim monospace text, there is hope.  If you
have a fixed line length, you could experiment to determine how many
characters fit in a line at each font-size.  Then you could create a
recursive template that finds the longest string between line breaks (
)
in a given element.  With that value, you could use an xsl:choose statement
to select the font-size that will accomodate that line length.  I didn't say
it would be easy, but it should be possible.  8^)

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "David Nedrow" <listbox@nedron.net>
To: <docbook-apps@lists.oasis-open.org>
Sent: Monday, June 27, 2005 2:17 PM
Subject: [docbook-apps] Auto-font sizing for monospace.verbatim.properties
font-size?


> I have a number of pre-formatted sections in documents that have been
> marked up with DocBook XML V4.4. I'm using XEP 4.4 with v 1.68.1 of
> the XSL stylesheets.
>
> Here's an example block:
>
> <programlisting>
> <![CDATA[
> # Do not remove the following line, or various programs
> # that require network functionality will fail.
> 127.0.0.1               localhost.localdomain localhost
> 123.45.67.89            foobox.geelink.com foobox
> ]]>
> </programlisting>
>
> Currently, I use a "master" override for the entire stylesheet set to
> get all of the blocks to fit within the FO output. Here's my setup
> for monospace.verbatim.properties:
>
>      <xsl:attribute-set name="monospace.verbatim.properties"
>          use-attribute-sets="verbatim.properties
> monospace.properties">
>          <xsl:attribute name="font-family">OCRAStd</xsl:attribute>
>          <xsl:attribute name="font-size">55%</xsl:attribute>
>          <xsl:attribute name="text-align">start</xsl:attribute>
>          <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
>          <!--        <xsl:attribute name="border-color">#0000FF</
> xsl:attribute>
>          <xsl:attribute name="border-style">solid</xsl:attribute>
>          <xsl:attribute name="border-width">medium</xsl:attribute>
>          <xsl:attribute name="background-color">#F0F0F0</
> xsl:attribute>-->
>      </xsl:attribute-set>
>
> Is there a way to basically "automate" this such that a maximum font
> size is used, unless the block won't fit unwrapped, in which case the
> font would automatically be scaled so that the block will fit without
> wrapping?
>
> Any thoughts?
>
> -David
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
>




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]