[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Side by side formatting
There is no easy way in XSLT to accurately measure the length of a typeset string. Saving the content to a variable and then using string-length() on the variable gives you a character count, but not a physical width, which depends on the font family, font size, and character mix in each string (lots of m and w letters versus i and j letters). It usually takes some experimentation to come up with an algorithm to convert character count to width value. And be sure to give it a little extra. Bob Stayton Sagehill Enterprises bobs@sagehill.net ----- Original Message ----- From: "Marcel Tromp" <marcel_docbook@tromp.org> To: "Bob Stayton" <bobs@sagehill.net> Cc: <docbook-apps@lists.oasis-open.org> Sent: Sunday, September 14, 2008 11:05 PM Subject: Re: [docbook-apps] Side by side formatting >I was afraid of that. > > Is there a way to dynamically calculate the length of the label in the > stylesheet and decide between a list-block title or a block title based on > that? > > Marcel > -- > > > Bob Stayton wrote: >> Hi, >> I think you are expecting too much of fo:list-block. Each list-item >> creates two block areas. The label's area is set to the width of the >> provisional-distance-between-starts minus the width of >> provisional-label-separation. The body area is the available column >> width minus the provisional-distance-between-starts. The FO processor >> then fills each area with its contents. If the label text is wider than >> its area, then it will try to break or hyphenate it. If it has no spaces >> and hyphenation isn't allowed or doesn't work, then the text will >> overflow its area. The filling of the body area is similar. Neither >> takes into account an overflow from the other area, which is why you get >> overlap. >> >> To prevent such overflow, the label area needs to be made wide enough to >> fit the label. Unfortunately, there is no auto-fitting feature in XSL-FO >> 1.0, so it requires guessing based on the string length. You can run >> into similar problems with numbered lists that reach over 99 items. >> >> Bob Stayton >> Sagehill Enterprises >> bobs@sagehill.net >> >> >> ----- Original Message ----- From: "Marcel Tromp" >> <marcel_docbook@tromp.org> >> To: <docbook-apps@lists.oasis-open.org> >> Sent: Saturday, September 13, 2008 10:22 PM >> Subject: [docbook-apps] Side by side formatting >> >> >>> I am using the side by side formatting example from >>> http://www.sagehill.net/docbookxsl/SideBySide.html. >>> >>> I use this to have section numbers indent left from the body. This >>> properly indents the section title to >>> provisional-distance-between-starts. However, I was expecting the >>> section title to be separated from the label by >>> provisional-label-separation if the label is longer than >>> provisional-distance-between-starts. >>> >>> The latter is not happing and the label overwrites part of the section >>> title. With that, I am getting the following warnings from fop: >>> WARNING: Line 1 of a paragraph overflows the available area by 19549mpt. >>> (fo:block, location: 3/355188) >>> >>> Is this a problem with fop (I am using 0.95), or am I misunderstanding >>> the side by side formatting behaviour? >>> >>> Marcel >>> -- >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org >>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org >>> >>> >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > > --------------------------------------------------------------------- > 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]