iText Font

View: New views
2 Messages — Rating Filter:   Alert me  

iText Font

by Greg Tomkins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good Afternoon,

I do not see this question covered anywhere:

I want to have a basic table but (in some cases) I want the size of the font used to render text within cells to shrink to fit the column width, rather than wrap onto a second line or otherwise expand the size of the cell. Any thoughts on this?

Bruno, if you read this, congratulations on a truly outstanding book. And probably outstanding product, too, though I am just starting with it.

Cheers,
Greg

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Re: iText Font

by 1T3XT info :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greg Tomkins wrote:
> Good Afternoon,
>
> I do not see this question covered anywhere:
>
> I want to have a basic table but (in some cases) I want the size of the
> font used to render text within cells to shrink to fit the column width,
> rather than wrap onto a second line or otherwise expand the size of the
> cell. Any thoughts on this?

This can't be done automatically.

You need to define absolute column widths (no relative values, no width
percentage for the table). Then you need to measure each piece of text
you're adding to a cell. If the length < the column width, you either
choose a smaller font (this is preferred), or you scale the Chunk (if
the scaling factor doesn't deform the text too much).

Another way to do this, is to use empty cells with a fixed height, and
to pass the content to a cell event. The cell event gets a Rectangle
object defining the size and position of the cell. There are different
ways to fit the content in such a rectangle.

> Bruno, if you read this, congratulations on a truly outstanding book.
> And probably outstanding product, too, though I am just starting with it.

A second edition is been written as we speak. It will be totally
different from the first book, the aim is to have a complementary book
that covers the same topics, but from a different angle (including the
new features that have been added in the last 3 years).
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/