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 Simon Pepping <sp...@leverkruid.eu> on 2011/01/07 14:17:42 UTC

Re: [Bug 50471] Greek Extended character throwing ArrayIndexOutOfBoundException.

On Fri, Jan 07, 2011 at 07:31:07AM -0500, bugzilla@apache.org wrote:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=50471
> 
> --- Comment #4 from Andreas L. Delmelle <ad...@apache.org> 2011-01-07 07:31:03 EST ---
> 
> Very right indeed. 
> So, if no one objects, I will apply the patch as proposed. FOP will no longer
> crash, but simply show a '#' for such unassigned codepoints in the output.
> Treating them as regular alphabetic characters seems to be safe enough for the
> time being.

Would it not be better to use character FFFD, 'Replacement Character',
�, for this?

Simon

Custom FOP

Posted by Eric Douglas <ed...@blockhouse.com>.
That seems odd, to include information for fonts which are never used.
I'll just ignore that then.  It just seemed like that would be putting a
lot into the jar which will never be needed.  I'm running in webstart,
referencing fop.jar in the jnlp, so anything in the jar has to be copied
to the client.

My next task is print preview.  I'm using custom windows and embedding
org.apache.fop.render.awt.viewer.PreviewPanel.  That works except I have
to create it with a useragent and a renderer which takes forever.  I'm
wondering if I can use a version of this class without a useragent or a
renderer.  If I can pass in a rendered document as an array of pages as
images instead of a renderable object, can I still do the scale
resizing?  Other than the zoom in the preview there's no reason I need a
renderable object here.  I'm keeping a copy of the renderable source on
the server while displaying the preview.  Sending the output to a
printer or generating a PDF can be done on the server.  I'm saving the
PDF to the client but I'm getting the output from FOP as the byte stream
so I just copy bytes to the client and save them.  The renderer,
transformer, etc should never have to exist on the client.
 

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Friday, January 07, 2011 9:35 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: [Bug 50471] Greek Extended character throwing
ArrayIndexOutOfBoundException.

On 07.01.2011 15:06:19 Eric Douglas wrote:
> I've been trying to see if I can modify the source to eliminate the 
> fonts that come packaged with it.  I'm not sure why it needs to 
> include Courier, Helvetica, etc.

The PDF specification requires support for the so-called Base 14 fonts.
And so does the PostScript spec. We don't actually include the fonts,
just the font metrics. So this hardly needs any space.

Re: [Bug 50471] Greek Extended character throwing ArrayIndexOutOfBoundException.

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 07.01.2011 15:06:19 Eric Douglas wrote:
> I've been trying to see if I can modify the source to eliminate the
> fonts that come packaged with it.  I'm not sure why it needs to include
> Courier, Helvetica, etc. 

The PDF specification requires support for the so-called Base 14 fonts.
And so does the PostScript spec. We don't actually include the fonts,
just the font metrics. So this hardly needs any space.

>  I would think they're just a waste of space if
> FOP is designed to use custom fonts or installed fonts.  I pass in
> custom fonts using only Lucida which comes in one file for normal, one
> for bold, one for unicode, and should be a different one for italic
> which I haven't needed yet.
> 
> I'm passing in the files that came with Windows XP in the fonts folder,
> l_10646.ttf for unicode.  For FOP to display a unicode character for the
> 'glyph not found' error rather than one of standard ascii, it should
> come packaged with a unicode font set.  I print the &#x25A1; character
> to my reports and passing in the l_10646.ttf font that works fine.
> 
> 
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
> Sent: Friday, January 07, 2011 8:44 AM
> To: fop-dev@xmlgraphics.apache.org
> Subject: Re: [Bug 50471] Greek Extended character throwing
> ArrayIndexOutOfBoundException.
> 
> I think so. The use of "#" is mostly historical due to lack of Unicode
> support initially. At least I believe so. The first fonts were WinAnsi
> only. IMO, it makes sense to make that transition. However, for
> single-byte fonts, we might still need to use "#". Not sure.
> 
> On 07.01.2011 14:17:42 Simon Pepping wrote:
> > On Fri, Jan 07, 2011 at 07:31:07AM -0500, bugzilla@apache.org wrote:
> > > https://issues.apache.org/bugzilla/show_bug.cgi?id=50471
> > > 
> > > --- Comment #4 from Andreas L. Delmelle <ad...@apache.org> 
> > > 2011-01-07 07:31:03 EST ---
> > > 
> > > Very right indeed. 
> > > So, if no one objects, I will apply the patch as proposed. FOP will 
> > > no longer crash, but simply show a '#' for such unassigned
> codepoints in the output.
> > > Treating them as regular alphabetic characters seems to be safe 
> > > enough for the time being.
> > 
> > Would it not be better to use character FFFD, 'Replacement Character',
> 
> > ?, for this?
> > 
> > Simon
> 
> 
> 
> 
> Jeremias Maerki
> 




Jeremias Maerki


Re: [Bug 50471] Greek Extended character throwing ArrayIndexOutOfBoundException.

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Fri, Jan 07, 2011 at 02:44:13PM +0100, Jeremias Maerki wrote:
> I think so. The use of "#" is mostly historical due to lack of Unicode
> support initially. At least I believe so. The first fonts were WinAnsi
> only. IMO, it makes sense to make that transition. However, for
> single-byte fonts, we might still need to use "#". Not sure.

Then it might be better to use '?', which many tools use for that
purpose.

Let us put that on our wish list. It is not part of the fix for this
bug report.

Simon

> On 07.01.2011 14:17:42 Simon Pepping wrote:
> > On Fri, Jan 07, 2011 at 07:31:07AM -0500, bugzilla@apache.org wrote:
> > > https://issues.apache.org/bugzilla/show_bug.cgi?id=50471
> > > 
> > > --- Comment #4 from Andreas L. Delmelle <ad...@apache.org> 2011-01-07 07:31:03 EST ---
> > > 
> > > Very right indeed. 
> > > So, if no one objects, I will apply the patch as proposed. FOP will no longer
> > > crash, but simply show a '#' for such unassigned codepoints in the output.
> > > Treating them as regular alphabetic characters seems to be safe enough for the
> > > time being.
> > 
> > Would it not be better to use character FFFD, 'Replacement Character',
> > ?, for this?

RE: [Bug 50471] Greek Extended character throwing ArrayIndexOutOfBoundException.

Posted by Eric Douglas <ed...@blockhouse.com>.
I've been trying to see if I can modify the source to eliminate the
fonts that come packaged with it.  I'm not sure why it needs to include
Courier, Helvetica, etc.  I would think they're just a waste of space if
FOP is designed to use custom fonts or installed fonts.  I pass in
custom fonts using only Lucida which comes in one file for normal, one
for bold, one for unicode, and should be a different one for italic
which I haven't needed yet.

I'm passing in the files that came with Windows XP in the fonts folder,
l_10646.ttf for unicode.  For FOP to display a unicode character for the
'glyph not found' error rather than one of standard ascii, it should
come packaged with a unicode font set.  I print the &#x25A1; character
to my reports and passing in the l_10646.ttf font that works fine.


-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Friday, January 07, 2011 8:44 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: [Bug 50471] Greek Extended character throwing
ArrayIndexOutOfBoundException.

I think so. The use of "#" is mostly historical due to lack of Unicode
support initially. At least I believe so. The first fonts were WinAnsi
only. IMO, it makes sense to make that transition. However, for
single-byte fonts, we might still need to use "#". Not sure.

On 07.01.2011 14:17:42 Simon Pepping wrote:
> On Fri, Jan 07, 2011 at 07:31:07AM -0500, bugzilla@apache.org wrote:
> > https://issues.apache.org/bugzilla/show_bug.cgi?id=50471
> > 
> > --- Comment #4 from Andreas L. Delmelle <ad...@apache.org> 
> > 2011-01-07 07:31:03 EST ---
> > 
> > Very right indeed. 
> > So, if no one objects, I will apply the patch as proposed. FOP will 
> > no longer crash, but simply show a '#' for such unassigned
codepoints in the output.
> > Treating them as regular alphabetic characters seems to be safe 
> > enough for the time being.
> 
> Would it not be better to use character FFFD, 'Replacement Character',

> ?, for this?
> 
> Simon




Jeremias Maerki


Re: [Bug 50471] Greek Extended character throwing ArrayIndexOutOfBoundException.

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
I think so. The use of "#" is mostly historical due to lack of Unicode
support initially. At least I believe so. The first fonts were WinAnsi
only. IMO, it makes sense to make that transition. However, for
single-byte fonts, we might still need to use "#". Not sure.

On 07.01.2011 14:17:42 Simon Pepping wrote:
> On Fri, Jan 07, 2011 at 07:31:07AM -0500, bugzilla@apache.org wrote:
> > https://issues.apache.org/bugzilla/show_bug.cgi?id=50471
> > 
> > --- Comment #4 from Andreas L. Delmelle <ad...@apache.org> 2011-01-07 07:31:03 EST ---
> > 
> > Very right indeed. 
> > So, if no one objects, I will apply the patch as proposed. FOP will no longer
> > crash, but simply show a '#' for such unassigned codepoints in the output.
> > Treating them as regular alphabetic characters seems to be safe enough for the
> > time being.
> 
> Would it not be better to use character FFFD, 'Replacement Character',
> ?, for this?
> 
> Simon




Jeremias Maerki


Re: [Bug 50471] Greek Extended character throwing ArrayIndexOutOfBoundException.

Posted by Andreas Delmelle <an...@telenet.be>.
On 07 Jan 2011, at 14:58, Simon Pepping wrote:

<snip />
> I had not yet thought so far. I reflected on the use of '#' as the
> replacement character for missing glyphs. Is that not particular to
> FOP, and should we not conform to Unicode and use the Unicode
> replacement character in such situations?

OK, I see now. That's indeed FOP legacy, and it seems preferable to show U+FFFD in such cases, if possible.

As for the effort involved, it could turn out to be fairly straightforward to change this behavior.
The # replacement char is hardcoded as org.apache.fop.fonts.Typeface.NOT_FOUND, which is used in only three places (the mapChar() implementations of Font, SingleByteFont and MultiByteFont).

<snip />
> ...PDF/U1F00.pdf,
> shows no character assignment for this code point.) That means that it
> does not even have properties, such as a linebreaking class. Using
> class 'Ambiguous' seems the right solution for that problem.

OK, I will make sure this is reflected in the code-comment.


Regards,

Andreas
---


Re: [Bug 50471] Greek Extended character throwing ArrayIndexOutOfBoundException.

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Fri, Jan 07, 2011 at 02:38:49PM +0100, Andreas Delmelle wrote:
> On 07 Jan 2011, at 14:17, Simon Pepping wrote:
> 
> Hi Simon,
> 
> > On Fri, Jan 07, 2011 at 07:31:07AM -0500, bugzilla@apache.org wrote:
> >> So, if no one objects, I will apply the patch as proposed. FOP will no longer
> >> crash, but simply show a '#' for such unassigned codepoints in the output.
> >> Treating them as regular alphabetic characters seems to be safe enough for the
> >> time being.
> > 
> > Would it not be better to use character FFFD, 'Replacement Character',
> > �, for this?
> 
> Interesting. In the context of linebreaking, that comes down to basically the same thing.
> 
> U+FFFD has linebreak class 'AI' or 'Ambiguous', which is currently also converted to 'Alphabetic' as part of the initial conversions.
> 
> Are you suggesting that we substitute the codepoint in the actual text content (rather than leave it there, and further rely on the default treatment of 'missing glyphs')?

I had not yet thought so far. I reflected on the use of '#' as the
replacement character for missing glyphs. Is that not particular to
FOP, and should we not conform to Unicode and use the Unicode
replacement character in such situations?

Really replacing the character in the text would go very far. A
missing glyph is usually dependent on the chosen font, while the
character itself is quite valid. In this case, however, the character
itself is invalid, in the sense that the code point has not been
assigned to a character in Unicode. (The bug report calls 1F7E a Greek
extended character, but the Unicode chart for Greek
extended characters, http://www.unicode.org/charts/PDF/U1F00.pdf,
shows no character assignment for this code point.) That means that it
does not even have properties, such as a linebreaking class. Using
class 'Ambiguous' seems the right solution for that problem.

Simon

Re: [Bug 50471] Greek Extended character throwing ArrayIndexOutOfBoundException.

Posted by Andreas Delmelle <an...@telenet.be>.
On 07 Jan 2011, at 14:17, Simon Pepping wrote:

Hi Simon,

> On Fri, Jan 07, 2011 at 07:31:07AM -0500, bugzilla@apache.org wrote:
>> So, if no one objects, I will apply the patch as proposed. FOP will no longer
>> crash, but simply show a '#' for such unassigned codepoints in the output.
>> Treating them as regular alphabetic characters seems to be safe enough for the
>> time being.
> 
> Would it not be better to use character FFFD, 'Replacement Character',
> �, for this?

Interesting. In the context of linebreaking, that comes down to basically the same thing.

U+FFFD has linebreak class 'AI' or 'Ambiguous', which is currently also converted to 'Alphabetic' as part of the initial conversions.

Are you suggesting that we substitute the codepoint in the actual text content (rather than leave it there, and further rely on the default treatment of 'missing glyphs')?


Regards,

Andreas
---