You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Harshini Madurapperuma <ha...@ifsworld.com> on 2012/06/15 06:12:03 UTC

How does FOP prints text lines and spaces between words

Hi All,

When FOP renders the PDF, how does it prints the line of text? Does it print letter by letter separately or just prints the whole sentence. And how does it creates the spaces between words? Because I noticed that it has different spaces of different font types and Also when the sentence is mixture of simple and Capital letter of the font Verdana (for an example), the spaces itself has a difference with in the sentence. Has anyone notice this issue and have any idea?

Many thanks in advance
Regards
/Har

------------------------------------------------------------------------------

CONFIDENTIALITY AND DISCLAIMER NOTICE

This e-mail, including any attachments, is confidential and for use only by
the intended recipient. If you are not the intended recipient, please notify
us immediately and delete this e-mail from your system. Any use or disclosure
of the information contained herein is strictly prohibited. As internet
communications are not secure, we do not accept legal responsibility for the
contents of this message nor responsibility for any change made to this
message after it was sent by the original sender. We advise you to carry out
your own virus check as we cannot accept liability for damage resulting from
software viruses.


Re: How does FOP prints text lines and spaces between words

Posted by Pascal Sancho <ps...@gmail.com>.
Hi,

As Glenn  said, character spacing depends on how user agent manages font
data for spacing (kerning, width of glyph, substitution, etc.)
IE, using the same font file you can get different results depending on the
renderer (FOP, Notepad, etc.)

IIUC, what you need is tabulations, to align pieces of text.
Unfortunately, there is no mechanism to handle that in current XSL-FO REC.
However, this is in the future 2.0, witch is at Working Draft state (see
tab-stops at [1])

Googlizing for tabs, I found an old thread about this in FOP-dev list : see
[2].
Perhaps the latter will help you.

[1] http://www.w3.org/TR/2012/WD-xslfo20-20120117/#tab-stops
[2]
http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/200611.mbox/%3CD390D921-5927-453A-90A9-6B6E6CB80246@pandora.be%3E

2012/6/15 Harshini Madurapperuma <ha...@ifsworld.com>

> Hi Glenn****
>
> ** **
>
> Thanks for replying****
>
> ** **
>
> The data in my XML is shown as below. I opened the xml in a notepad and I
> set the font to Times New Roman (TNR) of size 10, then I aligned the text
> as shown below. The vertical alignment is important.****
>
> ** **
>
> <CUSTOMER_NAME>****
>
> HBCH    HBCH    HBCH    HBCH****
>
> HBCH    HBCH    HBCH    HBCH****
>
> abcd        bbcd       bbcd        bbcd****
>
> </CUSTOMER_NAME>****
>
> ** **
>
> But when I render the PDF (the font is same as it was in notepad which is
> TNR of size 10), then I noticed that the alignment has changes it’s not
> properly aligned like the input data, which shows below.****
>
> ** **
>
> ****
>
> ** **
>
> In the notepad for the identical font (used the same font matrix file for
> PDF rendering). The three rows was properly aligned. But in the PDF the
> last row was shifted. What cause this different if the same matrix file was
> used.****
>
> ** **
>
> Many Thanks****
>
> Har****
>
> ** **
>
> ** **
>
> *From:* Glenn Adams [mailto:glenn@skynav.com]
> *Sent:* Friday, June 15, 2012 12:06 PM
> *To:* fop-users@xmlgraphics.apache.org
> *Subject:* Re: How does FOP prints text lines and spaces between words****
>
> ** **
>
> In general, different fonts, different line measures (available space to
> set a line), different properties (e.g., whether to use letter or word
> spacing), all contribute to the setting of glyphs in a line. Usually, if no
> letter spacing and no kerning applies, then a word is set on a glyph by
> glyph basis according to the applicable font's glyph advancement per glyph
> (a.k.a. character width per character in some contexts).****
>
> ** **
>
> However, usually kerning is enabled by default, so one will also get
> variation within a word, even with no letter spacing.****
>
> ** **
>
> For line breaking and nominal word space calculation (when using justified
> alignment mode), FOP uses a line breaking algorithm based on Knuth's
> optimal paragraph breaking found in TeX.****
>
> ** **
>
> What do you think is a problem?****
>
> On Thu, Jun 14, 2012 at 10:12 PM, Harshini Madurapperuma <
> harshini.madurapperuma@ifsworld.com> wrote:****
>
> When FOP renders the PDF, how does it prints the line of text? Does it
> print letter by letter separately or just prints the whole sentence. And
> how does it creates the spaces between words? Because I noticed that it has
> different spaces of different font types and Also when the sentence is
> mixture of simple and Capital letter of the font Verdana (for an example),
> the spaces itself has a difference with in the sentence. Has anyone notice
> this issue and have any idea?****
>
> ** **
>
> ------------------------------------------------------------------------------
>
> CONFIDENTIALITY AND DISCLAIMER NOTICE
>
> This e-mail, including any attachments, is confidential and for use only by
> the intended recipient. If you are not the intended recipient, please notify
> us immediately and delete this e-mail from your system. Any use or disclosure
> of the information contained herein is strictly prohibited. As internet
> communications are not secure, we do not accept legal responsibility for the
> contents of this message nor responsibility for any change made to this
> message after it was sent by the original sender. We advise you to carry out
> your own virus check as we cannot accept liability for damage resulting from
> software viruses.
>
>
>


-- 
pascal

Re: How does FOP prints text lines and spaces between words

Posted by Glenn Adams <gl...@skynav.com>.
Use tables.

On Fri, Jun 15, 2012 at 4:07 AM, Harshini Madurapperuma <
harshini.madurapperuma@ifsworld.com> wrote:

> Hi Glenn****
>
> ** **
>
> Thanks for replying****
>
> ** **
>
> The data in my XML is shown as below. I opened the xml in a notepad and I
> set the font to Times New Roman (TNR) of size 10, then I aligned the text
> as shown below. The vertical alignment is important.****
>
> ** **
>
> <CUSTOMER_NAME>****
>
> HBCH    HBCH    HBCH    HBCH****
>
> HBCH    HBCH    HBCH    HBCH****
>
> abcd        bbcd       bbcd        bbcd****
>
> </CUSTOMER_NAME>****
>
> ** **
>
> But when I render the PDF (the font is same as it was in notepad which is
> TNR of size 10), then I noticed that the alignment has changes it’s not
> properly aligned like the input data, which shows below.****
>
> ** **
>
> ****
>
> ** **
>
> In the notepad for the identical font (used the same font matrix file for
> PDF rendering). The three rows was properly aligned. But in the PDF the
> last row was shifted. What cause this different if the same matrix file was
> used.****
>
> ** **
>
> Many Thanks****
>
> Har****
>
> ** **
>
> ** **
>
> *From:* Glenn Adams [mailto:glenn@skynav.com]
> *Sent:* Friday, June 15, 2012 12:06 PM
> *To:* fop-users@xmlgraphics.apache.org
> *Subject:* Re: How does FOP prints text lines and spaces between words****
>
> ** **
>
> In general, different fonts, different line measures (available space to
> set a line), different properties (e.g., whether to use letter or word
> spacing), all contribute to the setting of glyphs in a line. Usually, if no
> letter spacing and no kerning applies, then a word is set on a glyph by
> glyph basis according to the applicable font's glyph advancement per glyph
> (a.k.a. character width per character in some contexts).****
>
> ** **
>
> However, usually kerning is enabled by default, so one will also get
> variation within a word, even with no letter spacing.****
>
> ** **
>
> For line breaking and nominal word space calculation (when using justified
> alignment mode), FOP uses a line breaking algorithm based on Knuth's
> optimal paragraph breaking found in TeX.****
>
> ** **
>
> What do you think is a problem?****
>
> On Thu, Jun 14, 2012 at 10:12 PM, Harshini Madurapperuma <
> harshini.madurapperuma@ifsworld.com> wrote:****
>
> When FOP renders the PDF, how does it prints the line of text? Does it
> print letter by letter separately or just prints the whole sentence. And
> how does it creates the spaces between words? Because I noticed that it has
> different spaces of different font types and Also when the sentence is
> mixture of simple and Capital letter of the font Verdana (for an example),
> the spaces itself has a difference with in the sentence. Has anyone notice
> this issue and have any idea?****
>
> ** **
>
> ------------------------------------------------------------------------------
>
> CONFIDENTIALITY AND DISCLAIMER NOTICE
>
> This e-mail, including any attachments, is confidential and for use only by
> the intended recipient. If you are not the intended recipient, please notify
> us immediately and delete this e-mail from your system. Any use or disclosure
> of the information contained herein is strictly prohibited. As internet
> communications are not secure, we do not accept legal responsibility for the
> contents of this message nor responsibility for any change made to this
> message after it was sent by the original sender. We advise you to carry out
> your own virus check as we cannot accept liability for damage resulting from
> software viruses.
>
>
>

RE: How does FOP prints text lines and spaces between words

Posted by Harshini Madurapperuma <ha...@ifsworld.com>.
Hi Glenn

Thanks for replying

The data in my XML is shown as below. I opened the xml in a notepad and I set the font to Times New Roman (TNR) of size 10, then I aligned the text as shown below. The vertical alignment is important.

<CUSTOMER_NAME>
HBCH    HBCH    HBCH    HBCH
HBCH    HBCH    HBCH    HBCH
abcd        bbcd       bbcd        bbcd
</CUSTOMER_NAME>

But when I render the PDF (the font is same as it was in notepad which is TNR of size 10), then I noticed that the alignment has changes it’s not properly aligned like the input data, which shows below.

[cid:image001.png@01CD4B0C.CA4913D0]

In the notepad for the identical font (used the same font matrix file for PDF rendering). The three rows was properly aligned. But in the PDF the last row was shifted. What cause this different if the same matrix file was used.

Many Thanks
Har


From: Glenn Adams [mailto:glenn@skynav.com]
Sent: Friday, June 15, 2012 12:06 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: How does FOP prints text lines and spaces between words

In general, different fonts, different line measures (available space to set a line), different properties (e.g., whether to use letter or word spacing), all contribute to the setting of glyphs in a line. Usually, if no letter spacing and no kerning applies, then a word is set on a glyph by glyph basis according to the applicable font's glyph advancement per glyph (a.k.a. character width per character in some contexts).

However, usually kerning is enabled by default, so one will also get variation within a word, even with no letter spacing.

For line breaking and nominal word space calculation (when using justified alignment mode), FOP uses a line breaking algorithm based on Knuth's optimal paragraph breaking found in TeX.

What do you think is a problem?
On Thu, Jun 14, 2012 at 10:12 PM, Harshini Madurapperuma <ha...@ifsworld.com>> wrote:
When FOP renders the PDF, how does it prints the line of text? Does it print letter by letter separately or just prints the whole sentence. And how does it creates the spaces between words? Because I noticed that it has different spaces of different font types and Also when the sentence is mixture of simple and Capital letter of the font Verdana (for an example), the spaces itself has a difference with in the sentence. Has anyone notice this issue and have any idea?


------------------------------------------------------------------------------

CONFIDENTIALITY AND DISCLAIMER NOTICE

This e-mail, including any attachments, is confidential and for use only by
the intended recipient. If you are not the intended recipient, please notify
us immediately and delete this e-mail from your system. Any use or disclosure
of the information contained herein is strictly prohibited. As internet
communications are not secure, we do not accept legal responsibility for the
contents of this message nor responsibility for any change made to this
message after it was sent by the original sender. We advise you to carry out
your own virus check as we cannot accept liability for damage resulting from
software viruses.


Re: How does FOP prints text lines and spaces between words

Posted by Glenn Adams <gl...@skynav.com>.
In general, different fonts, different line measures (available space to
set a line), different properties (e.g., whether to use letter or word
spacing), all contribute to the setting of glyphs in a line. Usually, if no
letter spacing and no kerning applies, then a word is set on a glyph by
glyph basis according to the applicable font's glyph advancement per glyph
(a.k.a. character width per character in some contexts).

However, usually kerning is enabled by default, so one will also get
variation within a word, even with no letter spacing.

For line breaking and nominal word space calculation (when using justified
alignment mode), FOP uses a line breaking algorithm based on Knuth's
optimal paragraph breaking found in TeX.

What do you think is a problem?

On Thu, Jun 14, 2012 at 10:12 PM, Harshini Madurapperuma <
harshini.madurapperuma@ifsworld.com> wrote:

> When FOP renders the PDF, how does it prints the line of text? Does it
> print letter by letter separately or just prints the whole sentence. And
> how does it creates the spaces between words? Because I noticed that it has
> different spaces of different font types and Also when the sentence is
> mixture of simple and Capital letter of the font Verdana (for an example),
> the spaces itself has a difference with in the sentence. Has anyone notice
> this issue and have any idea?
>
> **
>
>
> **
>