xsl-list
[Top] [All Lists]

Re: [xsl] XSL:FO dynamic font size based on width

2008-06-27 20:57:17
Thank you Angela for your reply. In my previous post I had pasted a snippet of code to do exactly what you mention. It works :)

WS

--------------------------------------------------
From: "Angela Williams" <Angela(_dot_)Williams(_at_)the401kcompany(_dot_)com>
Sent: Thursday, June 26, 2008 11:49 AM
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: RE: [xsl] XSL:FO dynamic font size based on width

You can simulate the auto-shrink behavior in your stylesheet.

I would pre-determine how many characters fit per line when my font size
is 12pt, how many fit for 10pt, etc. You could use percentages or other
size units, just be consistent.  Then I would create a template that
would determine which font size to use based on the number of characters
in the title.


Thanks!
Angela
"We cannot solve problems by using the same kind of thinking we used
when we created them."

-Albert Einstein



-----Original Message-----
From: Dave Pawson [mailto:davep(_at_)dpawson(_dot_)co(_dot_)uk]
Sent: Thursday, June 26, 2008 7:57 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] XSL:FO dynamic font size based on width

Wasiq Shaikh wrote:
Hello everyone!

Quick question ...

I have a title of a book (fo:block) that needs to be one line on an
8.5in x
11in page. If the title is too long for the page (overflow), is there
a way
to dynamically decrease the font-size so that the entire title is
shown on
one line?

Basically, I'm looking for the exact behaviour of PowerPoint's
"AutoFit Text
to Placeholder" feature.

No. That would require feedback from the rendering engine
to the XSLT. Doesn't happen.

From use, you might determine that you get x chars
'safely' on the line.
Chop the line up based on that and create a number
of lines.

HTH




regards

--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--