Harshini Madurapperuma | 15 Jun 2012 06:12
Favicon

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.
Glenn Adams | 15 Jun 2012 08:36
Gravatar

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 <at> 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?


Harshini Madurapperuma | 15 Jun 2012 12:07
Favicon

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

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 <at> skynav.com]
Sent: Friday, June 15, 2012 12:06 PM
To: fop-users <at> 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 <at> 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 Sancho | 15 Jun 2012 13:56
Picon

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

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 <at> pandora.be%3E

2012/6/15 Harshini Madurapperuma <harshini.madurapperuma <at> 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 <at> skynav.com]
Sent: Friday, June 15, 2012 12:06 PM
To: fop-users <at> 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 <at> 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
Glenn Adams | 15 Jun 2012 14:54
Gravatar

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

Use tables.

On Fri, Jun 15, 2012 at 4:07 AM, Harshini Madurapperuma <harshini.madurapperuma <at> 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 <at> skynav.com]
Sent: Friday, June 15, 2012 12:06 PM
To: fop-users <at> 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 <at> 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.

Chanaka Amarasekara | 15 Jun 2012 17:04
Favicon

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

Hi, Just a clearification, let say we align the xml data with a perticuler font and a font size from notepad, and we use the same exact font and it's font matrix and use the same font and font size in a xsl layout. In this case wouldn't the text in the generated PDF by the FOP get the same alignmnet as it was in the xml? Will it be the same with regardless of unisize fonts or not? If not why? Regards, Chanaka Sent from my phone --- original message --- From: "Pascal Sancho" <psancho.asf <at> gmail.com> Subject: Re: How does FOP prints text lines and spaces between words Date: 15th June 2012 Time: 5:27:24 pm
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 <at> pandora.be%3E

2012/6/15 Harshini Madurapperuma <harshini.madurapperuma <at> 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 <at> skynav.com]
Sent: Friday, June 15, 2012 12:06 PM
To: fop-users <at> 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 <at> 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
------------------------------------------------------------------------------ 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.
J.Pietschmann | 17 Jun 2012 10:17
Picon
Favicon

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

Am 15.06.2012 17:04, schrieb Chanaka Amarasekara:
> Just a clearification, let say we align the xml data with a
> perticuler font and a font size from notepad, and we use the same
> exact font and it's font matrix and use the same font and font size
> in a xsl layout. In this case wouldn't the text in the generated PDF
> by the FOP get the same alignmnet as it was in the xml? Will it be
> the same with regardless of unisize fonts or not? If not why?

The very short answer is: TAB expansion, word spacing and, to some
extend letter spacing is NOT standardized, and different layout enines
(as in: notepad.exe and FOP) may place the words at different positions.

Use a table, FO table rendering is standardized and will produce
reproducible layouts.

J.Pietschmann

Gmane