Bug 26590

Summary: last character width in winansi font is missed
Product: Fop - Now in Jira Reporter: pscream
Component: pdfAssignee: fop-dev
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 0.20.5   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description pscream 2004-02-02 08:36:53 UTC
Hi to everybody who takes care on this beautiful software !

  Environment:
         GNU/Debian Linux 3.0
         FOP 0.20.5

  As I working with cyrrilic fonts I have troubles with winansi fonts.
  I know it doesn't support cyrrilic encoding (WINDOWS-1251), and
  supports only Latin1 character set. Meanwhile CID fonts are not
  supported properly as for copy-paste/find operation is PDF. So I was
  forced to make "cyrrilic" ttf within first 256 character and replace
  last 128 ones with "cyrrilic" symbols.

  Now I can work (copy-paste/find) with latin characters and see
  cyrrilic characters in winansi encoding. While I was experimenting I
  found a bug. Fop 0.20.5 doesn't calculate the width of the last
  character (0xFF). Since, there is no need in the latin charset to
  see this character, nobody knows about this bug.

  I found the solution:
  please refer
  
  src/org/apache/fop/render/pdf/fonts/SingleByteFont.java line 268
  System.arraycopy(width, 0, arr, 0, width.length - 1);
  
  and

  src/org/apache/fop/render/pdf/fonts/MultiByteFont.java line 328
  System.arraycopy(width, 0, arr, 0, width.length - 1);

  I belive there should be "width.length" instead of "width.length - 1".

  However it doesn't resolve the problem in full. I can see cyrrilic
  characters, but still can't operate with them. 
  Can anybody advise me ?
  Should I wait for official release which works with CID properly ?
  or there is another solution ?

Thanks
-------
Pavel Kud
Comment 1 Victor Mote 2004-10-14 05:27:23 UTC
This bug has been fixed in FOray's CVS. FOray directly parses the font and font 
metrics files (PFM & AFM) instead of using an intermediate XML file, so the 
need for the arraycopy goes away entirely.

Also, the bigger issue of having CID fonts supported for cut/paste/search, 
etc., which is a duplicate of issue 5335, has been fixed in FOray. See 
http://www.foray.org/release.html for details.