You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Seshadri G.K." <se...@mindfiresolutions.com> on 2001/03/23 10:59:07 UTC

Bug fix for TTF fonts

Oh What the heck, i shall send in the files anyways, maybe it'll be useful
for someone, just getting philosophical on a friday!! Recompile FOP with the
modified versions of TTFReader.java and TTFFile.java. That should fix it. Is
the hyphenation problem fixed, the # stuff that appears in PDF? If it aint I
can try..

Oh ! I guess the PFMReaders were also giving trouble? Please email me the
Windows tt1 font to me, so that I can test it out.


Re: Bug fix for TTF fonts

Posted by Tore Engvig <te...@infostream.no>.

Carlos is right. This problem with hyphenation and CID fonts is because
the CID's are used for hyphenation instead of the unicode characters.

A quick fix could be to change to layout/LineArea class' addText method
Ca. on line 221 a copy of the characters is made, if you create another
copy, ie:
        char[] data = new char[odata.length];
        char[] dataCopy = new char[odata.length];
        for (int count = 0; count < odata.length; count++) {
            data[count] = odata[count];
            dataCopy[count] = odata[count];
        }

and change line 424
to 
   return
      this.doHyphenation(dataCopy,i,wordStart,this.getContentWidth() -
      (finalWidth + spaceWidth + pendingWidth));

I guess it'll work. I think I'll spend some time on this to figure out how
the LineArea class *really* works before starting to tamper with the code
:)

Note: This might also've been a problem without CID fonts, CID fonts only
make it more visible. This is because the mapping from unicode to
winansiencoding doesn't change much, but changind to CID's change a lot.
If you for some obscure reason have a hyphenation patterns for the letter
a and the euro sign you'll get into trouble without CID fonts.


Tore


 On Sat, 24 Mar 2001, Carlos
Villegas wrote:

> 
> 
> FAGOT Alain wrote:
> > 
> > Seshadri G.K. wrote:
> >   > Is the hyphenation problem fixed,
> > 
> >         Not that I have heard about.  I think the problem might be also around
> > the encoding stuff.  It works for the default encoding but not for the
> > languages such as Czeh or Esperanto, using ISO-8859-2 or ISO-8859-3
> > instead of ISO-8859-1.   It should be made operational with a Unicode
> > encoding to support also other latin script languages.
> 
> I haven't seen the recent contributions, but what the hyphenation
> function expects is Unicode characters. If some character mapping is
> done before hyphenation, it won't work. Make sure you don't pass glyph
> ids or reencoded characters to the hyphenation algorithm. As I said I
> haven't looked closely, but I think mapping should be moved to a lower
> level and not to be exposed in the layout classes. In other words, the
> getCharacterWidth (or whatever the equivalent is) should take an Unicode
> character. The mapping and handling of missing characters in the font
> should be done internally by the whatever class is exporting the
> getWidth function.
> 
> 
> Carlos Villegas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Bug fix for TTF fonts

Posted by Carlos Villegas <ca...@uniscope.co.jp>.

FAGOT Alain wrote:
> 
> Seshadri G.K. wrote:
>   > Is the hyphenation problem fixed,
> 
>         Not that I have heard about.  I think the problem might be also around
> the encoding stuff.  It works for the default encoding but not for the
> languages such as Czeh or Esperanto, using ISO-8859-2 or ISO-8859-3
> instead of ISO-8859-1.   It should be made operational with a Unicode
> encoding to support also other latin script languages.

I haven't seen the recent contributions, but what the hyphenation
function expects is Unicode characters. If some character mapping is
done before hyphenation, it won't work. Make sure you don't pass glyph
ids or reencoded characters to the hyphenation algorithm. As I said I
haven't looked closely, but I think mapping should be moved to a lower
level and not to be exposed in the layout classes. In other words, the
getCharacterWidth (or whatever the equivalent is) should take an Unicode
character. The mapping and handling of missing characters in the font
should be done internally by the whatever class is exporting the
getWidth function.


Carlos Villegas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Bug fix for TTF fonts

Posted by FAGOT Alain <Al...@framfab.nl>.
Seshadri G.K. wrote:
  > Is the hyphenation problem fixed,

	Not that I have heard about.  I think the problem might be also around 
the encoding stuff.  It works for the default encoding but not for the 
languages such as Czeh or Esperanto, using ISO-8859-2 or ISO-8859-3 
instead of ISO-8859-1.   It should be made operational with a Unicode 
encoding to support also other latin script languages.

 > the # stuff that appears in PDF?

	It is, if you don't use the default font (which does not know nothing 
about Unicode encoding;-).

	Thanks for your previous fixes (helas redundant with a former, more 
complete patch from Tore).

		Alain.
--
FAGOT Alain
Alain.FAGOT@framfab.nl     Senior Java Developer
Tel: +31 20  586 99 36     NetlinQ Framfab
Fax: +31 20  682 75 56     Arlandaweg 92
http://www.framfab.nl/  NL-1043 EX  Amsterdam


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org