Bug 42162

Summary: hyphenation inside block in FOP works only for pure alphabetical characters
Product: Fop - Now in Jira Reporter: Anuja <anuja_gok>
Component: generalAssignee: fop-dev
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 0.93   
Target Milestone: ---   
Hardware: Other   
OS: Windows XP   
Attachments: This is the fo file that recreates the bug
Associate pdf file that gets created when fop is run on the attached fo file

Description Anuja 2007-04-18 11:38:25 UTC
Hyphenate does not work correctly when the data in the block has numeric 
characters or commas...

In the example below, only the data in the first table-row gets hyphenated 
correctly

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" 
xmlns:datetime="http://exslt.org/dates-and-times" writing-mode="lr-tb" text-
align="start" role="html">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="all-pages" page-width="8.5in" page-
height="11in">
      <fo:region-body margin-top="1in" margin-right="0.25in" margin-
bottom="1.5in" margin-left="   0.25in" page-width="8.5in" page-height="11in"/>
      <fo:region-before region-name="page-header" extent="1in" display-
align="before"/>
      <fo:region-after region-name="page-footer" extent="1.5in" display-
align="after"/>
      <fo:region-start extent="0.25in"/>
      <fo:region-end extent="1.5in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="all-pages">
    <fo:static-content flow-name="page-header">
      <fo:block font-size="14pt" text-align="center" hyphenate="true" 
language="en" space-before.conditionality="retain" space-before="0.5in"/>
    </fo:static-content>
    <fo:static-content flow-name="page-footer">
      <fo:block font-size="small" text-align="center" hyphenate="true" 
language="en" space-after.conditionality="retain" space-after="0.5in"/>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
      <fo:block hyphenate="true" language="en" role="body">
        <fo:inline>Hyphenation for this table data works - when all the data 
is non numeric</fo:inline>
        <fo:table>
          <fo:table-body>
            <fo:table-row>
              <fo:table-cell>
                <fo:table>
                  <fo:table-body>
                    <fo:table-row>
                      <fo:table-cell border-width="1pt" border-style="solid">
                        <fo:block hyphenate="true" 
language="en">HyphenationOfThisBlockWorksNicelyUnlessWhenThereIsNoCommaOrNumeri
cDataBeforeIt</fo:block>
                      </fo:table-cell>
                      <fo:table-cell><fo:block/></fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                      <fo:table-cell border-width="1pt" border-style="solid">
                        <fo:block hyphenate="true" 
language="en">HyphenationOfThisBlockWorksNicely,OnlyForTheBlockBeforeTheCommaIn
TheBlockData</fo:block>
                      </fo:table-cell>
                      <fo:table-cell><fo:block/></fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                      <fo:table-cell border-width="1pt" border-style="solid">
                        <fo:block hyphenate="true" 
language="en">12345678901234567890123456789012345678901234567890123456789012345
6789012345678901234567890</fo:block>
                      </fo:table-cell>
                      <fo:table-cell><fo:block/></fo:table-cell>
                    </fo:table-row>
                  </fo:table-body>
                </fo:table>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
Comment 1 Anuja 2007-04-18 11:41:58 UTC
Created attachment 19993 [details]
This is the fo file that recreates the bug
Comment 2 Anuja 2007-04-18 11:42:34 UTC
Created attachment 19994 [details]
Associate pdf file that gets created when fop is run on the attached fo file
Comment 3 Andreas L. Delmelle 2007-07-09 11:11:23 UTC
I think I see the problem here, but I'm not sure it's a bug... Not all of it, that is.
Hyphenation is, in fact, only applicable to pure alphabetical characters. Strictly speaking, one cannot 
'hyphenate' a seven-digit number, if I interpret correctly.

That said, the case with the comma maybe could be handled better. Currently, from the point on where 
the hyphenator meets the comma (or more generally: any non-letter), it does not even attempt to 
hyphenate anymore.

What you're really looking for is unconditional wrapping of the text, rather than hyphenation, it seems. 
That would be wrap-option="wrap" on the blocks, which we claim to support according to the compliance 
page. After having a quick try, this feature seems to be broken, however...
Comment 4 Glenn Adams 2012-04-07 01:43:00 UTC
resetting P2 open bugs to P3 pending further review