Re: [xep-support] Scaling content to fit a block

From: Robert Goldsmith <>
Date: Tue Apr 21 2009 - 07:59:51 PDT

Hi :)

Yes, I'm currently using an equation to scale the font size as needed
but it is not very elegant.

My reason for needing this is that I am creating templates for pricing
tickets. The design has a circle within which I need to place the
price for the item being advertised. However, the price can range from
1p to 999.99 and the client would like the size of the price to scale
to make best use of the space within the circle. My xslt equations
based on the string-length of the price text work well enough but
would prevent easy creation of templates in future without my
intervention in the xsl to add the scaling equations and a lot of
testing to check the equations give a good visual layout for different

I am aware that DTP systems such as InDesign Server, PageFlex .Edit
etc. can scale text to fit so was hoping xsl-fo had a similar
functionality. What would be really nice would be to have an attribute
like font-size="auto" which could interact with the wrap-option
attribute as needed. Oh well, I can dream :)


On 21 Apr 2009, at 15:15, Michael Sulyaev wrote:

> Robert Goldsmith wrote:
>> Does anyone know if it is possible to scale text content to fit a
>> block?
> Hello Robert,
> XSL FO does not provide a way to achieve it.
>> I have an fo:block of a set size and I need to be able to scale the
>> font-size of variable content to fit the space without wrapping.
>> Any ideas?
> IMHO, no chance. If the content is pure text, it could probably be
> possible to: estimate the area required by the content at given font-
> size, compare it to the space provided by the containing block(-
> container), alter the font-size accordingly. All in XSLT (there even
> is an sqrt routine, googlable). However: breaking text into lines
> may not happen at arbitrary places. This is likely to spoil
> everything.
> Why would you need to store arbitrary content in a fixed box?
> Regards,
> Michael Sulyaev
> RenderX
> -------------------
> (*) To unsubscribe, send a message with words 'unsubscribe xep-
> support'
> in the body of the message to from the address
> you are subscribed from.
> (*) By using the Service, you expressly agree to these Terms of
> Service

Robert Goldsmith
Senior Systems Integrator, Business Systems, SP Group
Telephone: 01527 508239
"Please consider the environment before printing this e-mail"
IMPORTANT - this email and the information that it contains may be 
confidential, legally privileged and/or protected by law.  It is intended 
solely for the use of the individual or entity to whom it is addressed.  
If you are not the intended recipient, please notify the sender immediately 
and do not disclose the contents to any other person, use it for any purpose, 
or store or copy the information in any medium (including by printing it out.  
Please also delete all copies of this email and any attachments from your 
system and shred any printed copies.
We do not accept any liability for losses or damages that you may suffer 
as a result of your receipt of this email including but not limited to 
computer service or system failure, access delays or interruption, data 
non-delivery or mis-delivery, computer viruses or other harmful components.
Any views expressed in this message are those of the individual sender 
except where the sender specifically states them to be the views of the SP Group.
Copyright in this email and any attachments belongs to the SP Group the sender or 
its licensors.
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service
Received on Tue Apr 21 09:11:07 2009

This archive was generated by hypermail 2.1.8 : Tue Apr 21 2009 - 09:11:08 PDT