[ERROR] Image not found

2010-02-18 Thread Paulo Carvalho
Hello

I used a simple example on the Internet about how to use FOP in java (
http://javaboutique.internet.com/tutorials/FOP/):

  - I Created a simple Java application with a class that takes an XML and
converts it into a PDF (using a XSL) containing an image. The name of my
class is Process.java and it has a method process. It works fine when
called directly as a java application.

  - I Created a simple web service that just call this process method of
that class. However, when i call the web service, i get an error:
[ERROR] Image not found: img/logo.gif
 = The PDF is created but without the image.

Here is the code of my Process.java class:

  public static String process(String xml, String xsl) {
 String sResult = null;
  try {

ByteArrayOutputStream foOut = new ByteArrayOutputStream();
 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
InputStream iss =
Process.class.getClassLoader().getResourceAsStream(brique);
 copyFile(new BufferedInputStream(iss), bOut);
 SAXBuilder builder = new SAXBuilder();
 Document document = builder.build(new
ByteArrayInputStream(xml.getBytes()));
 TransformerFactory factory = TransformerFactory.newInstance();
InputStream iXsl = Process.class.getClassLoader().getResourceAsStream(xsl);
 StreamSource iSource = new StreamSource(iXsl);
 Transformer foTrans = factory.newTransformer(iSource);
 StreamSource strSourceXML = new StreamSource(new
ByteArrayInputStream(xml.getBytes()));
 foTrans.transform(strSourceXML, new StreamResult(foOut));
foOut.flush();
 ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
TransformerFactory tFactoryFO2PDF = TransformerFactory.newInstance();
 Transformer pdfTrans = tFactoryFO2PDF.newTransformer();
FopFactory fopFactory = FopFactory.newInstance();
 FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, pdfOut);
 Result res = new SAXResult(fop.getDefaultHandler());
StreamSource streamSourceXml = new StreamSource(new
ByteArrayInputStream(foOut.toByteArray()));
 pdfTrans.transform(streamSourceXml, res);
 java.io.File file = new java.io.File(d:/res.pdf);
 FileOutputStream foStream = new FileOutputStream(file);
pdfOut.writeTo(foStream);
  } catch(Exception e) {
 e.printStackTrace();
}
 return sResult;
}
private static boolean copyFile(InputStream in, OutputStream out) {
 try {

int c;
while ((c = in.read()) != -1)
 out.write(c);

in.close();
out.close();
 } catch (IOException io) {
return false;
}
 return true;
}


The code of my web service is just:

public static String process(String xml, String xsl) {
 String sResult = null;
 try {
 sResult = Process.process(xml, xsl);
System.out.println(sss);
 } catch(Exception e) {
e.printStackTrace();
}
 return sResult;
}

The web service has the JAR of the Java application in his classpath. The
content of the Jar file is the following one:
  NamePath
briques.xsd
logo.gif img\
Manifest.mf  meta-inf\
Process.class  tst
saxon-licence.lic
xsl2.xslt

I call the web service with the following parameters:

xml = ?xml version='1.0' encoding='UTF-8'?+
 Catalog+
 Book+
TitleMastering EJB/Title+
 AuthorEd Roman/Author+
Price$45.00/Price+
 /Book+
Book+
TitleDesign Patterns/Title+
 AuthorErich Gamma/Author+
Price$50.00/Price+
 /Book+
Book+
TitleEffective Java/Title+
 AuthorJosch Bloch/Author+
Price$30.00/Price+
 /Book +
/Catalog;

xsl = xsl2.xslt;

In the xsl2.xslt I have a part of code like this to insert the image on the
pdf:
...
fo:block
  fo:external-graphic src=img/logo.gif/
/fo:block
...


The XSL is found in the JAR because the PDF file is generated. But the
following error still appearing and the image is not inserted on the PDF:
[ERROR] Image not found: img/logo.gif

What am I doing wrong?

Thanks
Regards

-- 
Paulo Carvalho
1 rue du Chateau
57710 Aumetz
France
http://forum-informatico.forumeiros.com/index.htm
http://ummundoecologico.blogspot.com


Re: svn commit: r910239 [1/2] - /xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml

2010-02-18 Thread Pascal Sancho
You are right, Simon.
I've tried to commit deployment by hands, and it's OK.
I have to investigate why ForrestBot did not.

Pascal

Simon Pepping a écrit :
 On Wed, Feb 17, 2010 at 01:29:19PM +0100, Pascal Sancho wrote:
   
 Hi Vincent,

 I cannot deploy using ForrestBot; I think I have not write access to
 [https://svn.apache.org/repos/asf/xmlgraphics/site/deploy/fop/]
 
 You should have write access to
 https://svn.apache.org/repos/asf/xmlgraphics/site/.

 Simon

   



Re: svn commit: r910239 [1/2] - /xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml

2010-02-18 Thread Pascal Sancho
A possible cause:
missing [deploy.svn.commit-message] when invoking ForrestBot with [ant
-f publish.xml] (see [1]).
I will check that on a future deployment.

[1]
http://svn.apache.org/repos/asf/forrest/trunk/etc/publishing_our_site.txt

Pascal

Pascal Sancho a écrit :
 You are right, Simon.
 I've tried to commit deployment by hands, and it's OK.
 I have to investigate why ForrestBot did not.

 Pascal

 Simon Pepping a écrit :
   
 On Wed, Feb 17, 2010 at 01:29:19PM +0100, Pascal Sancho wrote:
   
 
 Hi Vincent,

 I cannot deploy using ForrestBot; I think I have not write access to
 [https://svn.apache.org/repos/asf/xmlgraphics/site/deploy/fop/]
 
   
 You should have write access to
 https://svn.apache.org/repos/asf/xmlgraphics/site/.

 Simon

   
 
   



Re: [ERROR] Image not found

2010-02-18 Thread Peter Hancock
Hi Paulo,

I imagine that the problem has something to do with the container hosting
the web service.  The image location is given as a relative path which may
not resolve to where you think it does.  Perhaps try supplying an absolute
path to test this theory.  The answer may depend upon how you package your
web app - do you bundle the image as well?

Maybe try looking for IO related information in the web container
documentation.  If you are unable to solve the problem please send more
information about the environment that your code runs in.

I hope that helps,

Peter



On Thu, Feb 18, 2010 at 7:07 AM, Paulo Carvalho pjcarva...@gmail.comwrote:

 Hello

 I used a simple example on the Internet about how to use FOP in java (
 http://javaboutique.internet.com/tutorials/FOP/):

   - I Created a simple Java application with a class that takes an XML and
 converts it into a PDF (using a XSL) containing an image. The name of my
 class is Process.java and it has a method process. It works fine when
 called directly as a java application.

   - I Created a simple web service that just call this process method of
 that class. However, when i call the web service, i get an error:
 [ERROR] Image not found: img/logo.gif
  = The PDF is created but without the image.

 Here is the code of my Process.java class:

   public static String process(String xml, String xsl) {
  String sResult = null;
   try {

 ByteArrayOutputStream foOut = new ByteArrayOutputStream();
  ByteArrayOutputStream bOut = new ByteArrayOutputStream();
 InputStream iss =
 Process.class.getClassLoader().getResourceAsStream(brique);
  copyFile(new BufferedInputStream(iss), bOut);
  SAXBuilder builder = new SAXBuilder();
  Document document = builder.build(new
 ByteArrayInputStream(xml.getBytes()));
  TransformerFactory factory = TransformerFactory.newInstance();
 InputStream iXsl = Process.class.getClassLoader().getResourceAsStream(xsl);
  StreamSource iSource = new StreamSource(iXsl);
  Transformer foTrans = factory.newTransformer(iSource);
  StreamSource strSourceXML = new StreamSource(new
 ByteArrayInputStream(xml.getBytes()));
  foTrans.transform(strSourceXML, new StreamResult(foOut));
 foOut.flush();
  ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
 TransformerFactory tFactoryFO2PDF = TransformerFactory.newInstance();
  Transformer pdfTrans = tFactoryFO2PDF.newTransformer();
 FopFactory fopFactory = FopFactory.newInstance();
  FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, pdfOut);
  Result res = new SAXResult(fop.getDefaultHandler());
 StreamSource streamSourceXml = new StreamSource(new
 ByteArrayInputStream(foOut.toByteArray()));
  pdfTrans.transform(streamSourceXml, res);
  java.io.File file = new java.io.File(d:/res.pdf);
  FileOutputStream foStream = new FileOutputStream(file);
 pdfOut.writeTo(foStream);
   } catch(Exception e) {
  e.printStackTrace();
 }
  return sResult;
 }
 private static boolean copyFile(InputStream in, OutputStream out) {
  try {

 int c;
 while ((c = in.read()) != -1)
  out.write(c);

 in.close();
 out.close();
  } catch (IOException io) {
 return false;
 }
  return true;
 }


 The code of my web service is just:

 public static String process(String xml, String xsl) {
  String sResult = null;
  try {
  sResult = Process.process(xml, xsl);
 System.out.println(sss);
  } catch(Exception e) {
 e.printStackTrace();
 }
  return sResult;
 }

 The web service has the JAR of the Java application in his classpath. The
 content of the Jar file is the following one:
   NamePath
 briques.xsd
 logo.gif img\
 Manifest.mf  meta-inf\
 Process.class  tst
 saxon-licence.lic
 xsl2.xslt

 I call the web service with the following parameters:

 xml = ?xml version='1.0' encoding='UTF-8'?+
  Catalog+
  Book+
 TitleMastering EJB/Title+
  AuthorEd Roman/Author+
 Price$45.00/Price+
  /Book+
 Book+
 TitleDesign Patterns/Title+
  AuthorErich Gamma/Author+
 Price$50.00/Price+
  /Book+
 Book+
 TitleEffective Java/Title+
  AuthorJosch Bloch/Author+
 Price$30.00/Price+
  /Book +
 /Catalog;

 xsl = xsl2.xslt;

 In the xsl2.xslt I have a part of code like this to insert the image on the
 pdf:
 ...
 fo:block
   fo:external-graphic src=img/logo.gif/
 /fo:block
 ...


 The XSL is found in the JAR because the PDF file is generated. But the
 following error still appearing and the image is not inserted on the PDF:
 [ERROR] Image not found: img/logo.gif

 What am I doing wrong?

 Thanks
 Regards

 --
 Paulo Carvalho
 1 rue du Chateau
 57710 Aumetz
 France
 http://forum-informatico.forumeiros.com/index.htm
 http://ummundoecologico.blogspot.com




DO NOT REPLY [Bug 48764] New: Wrong master when force-page-count is used

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48764

   Summary: Wrong master when force-page-count is used
   Product: Fop
   Version: 1.0dev
  Platform: PC
OS/Version: Windows XP
Status: NEW
  Severity: normal
  Priority: P2
 Component: page-master/layout
AssignedTo: fop-dev@xmlgraphics.apache.org
ReportedBy: pascal.san...@takoma.fr


Created an attachment (id=25013)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25013)
Short XSL-FO that demonstrates this issue

Conditions:
 - force-page-count=end-on-even is used;
 - an empty page must be added to conform the above property;
 - a fo:conditional-page-master-reference has the property
page-position=last.

Result:
 - the master [last] is used on the page before the new last one;
 - the last page uses the [normal] master.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


Re: svn commit: r910239 [1/2] - /xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml

2010-02-18 Thread Vincent Hennebert
Pascal Sancho wrote:
 You are right, Simon.
 I've tried to commit deployment by hands, and it's OK.
 I have to investigate why ForrestBot did not.

FWIW, ForrestBot has never worked for me. From the quick investigation
I made (it was a long time ago), the parsing of the ‘svn st’ it was
doing to figure out which files had to be added was not working. Since
then I’ve always published the website by hand. At least I know what I’m
doing, plus I can remove files that are no longer necessary.


 Pascal
 
 Simon Pepping a écrit :
 On Wed, Feb 17, 2010 at 01:29:19PM +0100, Pascal Sancho wrote:
   
 Hi Vincent,

 I cannot deploy using ForrestBot; I think I have not write access to
 [https://svn.apache.org/repos/asf/xmlgraphics/site/deploy/fop/]
 
 You should have write access to
 https://svn.apache.org/repos/asf/xmlgraphics/site/.

 Simon


Vincent


Re: java.lang.NullPointerException: org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getChangedKnuthElements(InlineStackingLayoutManager.java:375)

2010-02-18 Thread Vincent Hennebert
Hi Mathieu,

Mathieu Malaterre wrote:
 [previously sent in fop-user mailing list]
 
 hi there,
 
 This is my first post to fop-dev, it is suggested to report bug here.

Actually bug reports should be made on Bugzilla:
https://issues.apache.org/bugzilla/enter_bug.cgi?product=Fop

Please could you open a new issue and post your sample FO file there?
That will be easier to keep track of the problem.

Thanks,
Vincent


 Here is my input docbook file:
 
 ?xml version='1.0' encoding='UTF-8'?
 !DOCTYPE article PUBLIC -//OASIS//DTD DocBook XML V4.5//EN
 http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd; []
 article
 section
  titletitle/title
 blockquote
 para
 The emphasis role=boldanchor
 id=example.anchor.1/anchor/emphasis element is empty and
 contributes
 nothing to the flow of the content in which it occurs.  It is only useful
 as a target.
 /para
 /blockquote
 /section
 /article
 
 which I process with:
 
 /usr/bin/xsltproc --stringparam fop1.extensions 1 --stringparam
 ulink.show 0 --xinclude -o test2.fo
 /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl test2.xml
 
 and lead to:
 
snip/
 
 
 I am using fop from today's trunk. I have attached the .fo file as
 cmopressed gzip.
 
 Let me know if you need more info.
 
 Thanks !


DO NOT REPLY [Bug 48765] New: java.lang.NullPointerException: org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getChangedKnuthElements(InlineStackingLayoutManager.java:375)

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48765

   Summary: java.lang.NullPointerException:
org.apache.fop.layoutmgr.inline.InlineStackingLayoutMa
nager.getChangedKnuthElements(InlineStackingLayoutMana
ger.java:375)
   Product: Fop
   Version: all
  Platform: PC
OS/Version: Linux
Status: NEW
  Severity: blocker
  Priority: P2
 Component: pdf
AssignedTo: fop-dev@xmlgraphics.apache.org
ReportedBy: mathieu.malate...@gmail.com


Created an attachment (id=25014)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25014)
fo file

Here is my input docbook file:

?xml version='1.0' encoding='UTF-8'?
!DOCTYPE article PUBLIC -//OASIS//DTD DocBook XML V4.5//EN
http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd; []
article
section
 titletitle/title
blockquote
para
The emphasis role=boldanchor
id=example.anchor.1/anchor/emphasis element is empty and
contributes
nothing to the flow of the content in which it occurs.  It is only useful
as a target.
/para
/blockquote
/section
/article

which I process with:

/usr/bin/xsltproc --stringparam fop1.extensions 1 --stringparam
ulink.show 0 --xinclude -o test2.fo
/usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl test2.xml

and lead to:

$ ./fop test2.fo test2.pdf
Feb 17, 2010 2:52:18 PM org.apache.fop.apps.FOURIResolver resolve
SEVERE: Error with opening URL
'http://docbook.sourceforge.net/release/images/draft.png': Network is
unreachable
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:9588)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:10285)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:10980)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:11672)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:12361)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:13050)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:13736)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:14427)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:15118)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:15806)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:16496)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:17186)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:17873)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:18563)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:19253)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:19940)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:20631)
Feb 17, 2010 2:52:18 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI:
http://docbook.sourceforge.net/release/images/draft.png. (See position
2:21322)
Feb 17, 2010 

DO NOT REPLY [Bug 48765] java.lang.NullPointerException: org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getChangedKnuthElements(InlineStackingLayoutManager.java:375)

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48765

--- Comment #1 from mathieu.malate...@gmail.com 2010-02-18 11:42:05 UTC ---
one possible way to work around this segfault is to pass the following to the
xsltproc engine:


  --stringparam hyphenate 0

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


Re: java.lang.NullPointerException: org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getChangedKnuthElements(InlineStackingLayoutManager.java:375)

2010-02-18 Thread Mathieu Malaterre
On Thu, Feb 18, 2010 at 12:21 PM, Vincent Hennebert
vhenneb...@gmail.com wrote:
 Hi Mathieu,

 Mathieu Malaterre wrote:
 [previously sent in fop-user mailing list]

 hi there,

 This is my first post to fop-dev, it is suggested to report bug here.

 Actually bug reports should be made on Bugzilla:
 https://issues.apache.org/bugzilla/enter_bug.cgi?product=Fop

 Please could you open a new issue and post your sample FO file there?
 That will be easier to keep track of the problem.


Done:
https://issues.apache.org/bugzilla/show_bug.cgi?id=48765

Thanks
-- 
Mathieu


DO NOT REPLY [Bug 48765] java.lang.NullPointerException: org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getChangedKnuthElements(InlineStackingLayoutManager.java:375)

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48765

--- Comment #2 from Georg Datterl g...@geneon.de 2010-02-18 11:54:25 UTC ---
This is the offending fo:block

fo:block space-before.optimum=1em space-before.minimum=0.8em
space-before.maximum=1.2em 
The fo:inline font-weight=bold
fo:inline id=example.anchor.1/anchor/fo:inline element is empty
and contributes
nothing to the flow of the content in which it occurs.  It is only useful
as a target.
/fo:block

Adding hyphenate=false to the fo:block avoids the NPE. 
Adding a text to the empty fo:inline avoids the NPE. 
Removing the id attibute avoids the NPE.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 48765] java.lang.NullPointerException: org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.getChangedKnuthElements(InlineStackingLayoutManager.java:375)

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48765

Vincent Hennebert vhenneb...@gmail.com changed:

   What|Removed |Added

   Platform|PC  |All
 OS/Version|Linux   |All
   Severity|blocker |normal

--- Comment #3 from Vincent Hennebert vhenneb...@gmail.com 2010-02-18 
12:10:52 UTC ---
Might have something to do with bug #46386

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 46386] NullPointerException in InlineStackingLayoutManager

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46386

--- Comment #5 from Vincent Hennebert vhenneb...@gmail.com 2010-02-18 
12:11:57 UTC ---
Bug #48765 mentions a similar issue and may be related.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 48766] New: Support for Font Kerning is Broken

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48766

   Summary: Support for Font Kerning is Broken
   Product: Fop
   Version: all
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: fonts
AssignedTo: fop-dev@xmlgraphics.apache.org
ReportedBy: vhenneb...@gmail.com


The method o.a.f.fonts.Font.getKernValue expects two Unicode code points and
returns the amount of kerning between the two corresponding glyphs. However,
the implementation for Type 1 fonts interprets the two integers as character
codes in the font's internal encoding (see o.a.f.fonts.type1.AFMFile.java).
Those usually have nothing to do with Unicode code points.

Moreover, trying to get kerning between two characters is inherently wrong:
kerning applies to glyphs and not characters. A font may have several glyph
variants for a same character, and kerning is likely to be different for each
variant.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 48766] Support for Font Kerning is Broken

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48766

--- Comment #1 from Vincent Hennebert vhenneb...@gmail.com 2010-02-18 
14:34:29 UTC ---
Created an attachment (id=25016)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25016)
Sample FO file showing the issue

This sample file uses the Nimbus Sans L font available on most Unix systems and
downloadable here:
http://sourceforge.net/projects/gs-fonts/

The AFM file gives the same kerning between 'Y' and all the accented variants
of the 'A' letter. Yet kerning is applied only between 'Y' and non-accented
'A'.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 48766] Support for Font Kerning is Broken

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48766

--- Comment #2 from Vincent Hennebert vhenneb...@gmail.com 2010-02-18 
14:35:42 UTC ---
Created an attachment (id=25017)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25017)
PDF result; the right borders should be aligned

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 48766] Support for Font Kerning is Broken

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48766

--- Comment #3 from Jeremias Maerki jerem...@apache.org 2010-02-18 15:15:25 
UTC ---
Currently, kerning only works for characters within the main single-byte
encoding. The implementation uses character codes, not Unicode values, for
kerning pairs. That feature didn't make the transition from a single
single-byte encoding to multiple single-byte encodings. Type1Loader and
especially AFMFile will probably need to be improved to support kerning for all
available glyphs.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 48766] Support for Font Kerning is Broken

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48766

--- Comment #4 from Vincent Hennebert vhenneb...@gmail.com 2010-02-18 
15:41:09 UTC ---
(In reply to comment #3)
 Currently, kerning only works for characters within the main single-byte
 encoding.

No, kerning doesn't work at all. Like I said the layout engine expects Unicode
code points while the font uses character codes. It's only a chance if they are
the same. Basically, for Adobe Standard Encoding, only the characters (and not
even all) from the Basic Latin range (U+–U+007F). Try “YA” vs “YÆ”, or “Fo”
vs “Fø” (kerning should be the same). All in Nimbus Sans L's base encoding.


 The implementation uses character codes, not Unicode values, for
 kerning pairs. That feature didn't make the transition from a single
 single-byte encoding to multiple single-byte encodings. Type1Loader and
 especially AFMFile will probably need to be improved to support kerning for 
 all
 available glyphs.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

DO NOT REPLY [Bug 48766] Support for Font Kerning is Broken

2010-02-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48766

--- Comment #5 from Jeremias Maerki jerem...@apache.org 2010-02-18 16:10:06 
UTC ---
Created an attachment (id=25018)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25018)
Screenshot from OpenOffice Writer

I've just tested with Nimbus Sans L (V 1.05) and kerning works just fine for
those combinations for which there is data in the AFM, with PDF and PS. The AFM
I have doesn't have kerning info for “YÆ” or “Fø”. Maybe you just expect
characters like A and Æ to be equivalent, but I don't remember any mention
in any of the Type1-related specs where it is listed which glyphs are
interchangeable concerning kerning. Take AY and ÆY: this combination can
definitely not be the same as the font shapes are quite different.

Not even OpenOffice does this kind of kerning, not even with Arial or any other
font I've checked. So IMO, it's a bit much to say it doesn't work at all.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.