You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Peter <pc...@gmail.com> on 2006/11/29 22:00:27 UTC

NPE IN SingleByteFont.hasChar when using IDAutomationC39S font

Gentlepeople,

I am trying to use a Barcode font (IDAutomationC39S) and I am getting an NPE
with the following trace listed lower. 

Before I dive into the debugger and try to find out what is going on, has
anyone any idea whether a barcode font is supposed to work and/or what could
be wrong.

The metrics generations did not complain 

Both trunk (relative old one) and 0.92 beta show the behavior on Windows XP
and Java 1.5

Thanks,

Peter
---------

FO file is

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:ltml="http://www.luma.com/ltml">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="master" page-height="200pt"
page-width="200pt">
      <fo:region-body></fo:region-body>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="master">
    <fo:flow flow-name="xsl-region-body">
      <fo:block-container absolute-position="fixed" height="40" left="14pt"
top="10pt" width="180pt">
        <fo:block font-size="20pt">
          <fo:inline font-family="IDAutomationC39S">0123</fo:inline>
        </fo:block>
      </fo:block-container>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
</fo:root>



Stack trace is

java.lang.NullPointerException
        at
org.apache.fop.fonts.SingleByteFont.hasChar(SingleByteFont.java:102)
        at org.apache.fop.fonts.LazyFont.hasChar(LazyFont.java:159)
        at org.apache.fop.fonts.Font.hasChar(Font.java:188)
        at org.apache.fop.fonts.Font.getCharWidth(Font.java:230)
        at
org.apache.fop.layoutmgr.inline.TextLayoutManager.initialize(TextLayoutManag
er.java:175)
        at
org.apache.fop.layoutmgr.AbstractLayoutManager.getChildLM(AbstractLayoutMana
ger.java:109)
        at
org.apache.fop.layoutmgr.inline.InlineLayoutManager.getNextKnuthElements(Inl
ineLayoutManager.java:281)
        at
org.apache.fop.layoutmgr.inline.LineLayoutManager.collectInlineKnuthElements
(LineLayoutManager.java:647)
        at
org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineL
ayoutManager.java:582)
        at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(Blo
ckStackingLayoutManager.java:275)
        at
org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayout
Manager.java:105)
        at
org.apache.fop.layoutmgr.BlockContainerLayoutManager$BlockContainerBreaker.g
etNextKnuthElements(BlockContainerLayoutManag
er.java:596)
        at
org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.ja
va:502)
        at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:252)
        at
org.apache.fop.layoutmgr.BlockContainerLayoutManager.getNextKnuthElementsAbs
olute(BlockContainerLayoutManager.java:498)
        at
org.apache.fop.layoutmgr.BlockContainerLayoutManager.getNextKnuthElements(Bl
ockContainerLayoutManager.java:186)
        at
org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutMa
nager.java:98)
        at
org.apache.fop.layoutmgr.PageSequenceLayoutManager$PageBreaker.getNextKnuthE
lements(PageSequenceLayoutManager.java:234)
        at
org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.ja
va:502)
        at
org.apache.fop.layoutmgr.PageSequenceLayoutManager$PageBreaker.getNextBlockL
ist(PageSequenceLayoutManager.java:226)
        at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:252)
        at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:220)
        at
org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequen
ceLayoutManager.java:152)
        at
org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:320
)
        at
org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:147)
        at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:
357)
        at
org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:193)
        at
org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerI
dentityImpl.java:1101)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerId
entityImpl.java:484)
        at
org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:164)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:114)
        at org.apache.fop.cli.Main.startFOP(Main.java:159)
        at org.apache.fop.cli.Main.main(Main.java:190)



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: NPE IN SingleByteFont.hasChar when using IDAutomationC39S font

Posted by Peter <pc...@gmail.com>.
> In any case if you generate PDF you should specify measurements
> in mm, pt or in.
Oops...sorry for the extra noise, thanks, Peter.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: NPE IN SingleByteFont.hasChar when using IDAutomationC39S font

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Peter wrote:
> Fop now says
> 
> SEVERE: file:///c:/temp/lala.fo:9:42: No conversion defined 40;
> property:'height'

This is unrelated to the barcode/font issue, it means
FOP can't convert the value into something it understands.
I think this is a bug in FOP (measurements without a unit
should be interpreted as pixel, unless I overlooked something).
In any case if you generate PDF you should specify measurements
in mm, pt or in.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: NPE IN SingleByteFont.hasChar when using IDAutomationC39S font

Posted by Peter <pc...@gmail.com>.
Jeremias,

That gets me a little further.

Fop now says

SEVERE: file:///c:/temp/lala.fo:9:42: No conversion defined 40;
property:'height'

A PDF is however created and when I open it, Acrobat Reader complains PDF
with
"The font 'IDAutomationC39S' contains bad /Flags."

A document is however opened which does contain "a" barcode.

Note that I am not necessarily in a big hurry, so if you say "I'm sure it
can be made to work with some coding but right now" is there anything I can
do to actually make it work?

Thanks,

Peter

> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> Sent: Thursday, November 30, 2006 7:41 AM
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: NPE IN SingleByteFont.hasChar when using IDAutomationC39S
> font
> 
> The problem is the "UnknownEncoding" in the XML. FOP did not recognize
> the encoding and can't handle a font like that. I'm sure it can be made
> to work with some coding but right now, the only thing you can try is to
> replace "UnknownEncoding" with "StandardEncoding" and check if it works.
> Otherwise, you should check out http://barcode4j.sourceforge.net as an
> alternative.
> 
> On 30.11.2006 00:56:54 Peter wrote:
> > Thanks for the reply,
> >
> > I started from a Type1 font for which, I have the impression, the -enc
> ansi
> > option is not supported/relevant.
> >
> > Attached the metrics file.
> >
> > All guidance where to look is appreciated,
> >
> > Thanks,
> >
> > Peter
> >
> > > -----Original Message-----
> > > From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> > > Sent: Wednesday, November 29, 2006 11:32 PM
> > > To: fop-users@xmlgraphics.apache.org
> > > Subject: Re: NPE IN SingleByteFont.hasChar when using IDAutomationC39S
> > > font
> > >
> > > Peter wrote:
> > > > I am trying to use a Barcode font (IDAutomationC39S) and I am
> getting an
> > > NPE
> > > > with the following trace listed lower.
> > >
> > > Barcode fonts are tricky, because barcode glyphs are not separate
> > > unicode glyphs.
> > > It seems that the encoding for your font is unknown. Try to generate
> > > the font metrics using the -enc ansi, although I think you did this
> > > already. Would you mind sending in your metrics file?
> > >
> > > If all else fails, try the barcode4j extension or generate a SVG
> > > for the barcode and use this (there are XSLT style sheets out there
> > > for this purpose).
> > >
> > > J.Pietschmann
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: NPE IN SingleByteFont.hasChar when using IDAutomationC39S font

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
The problem is the "UnknownEncoding" in the XML. FOP did not recognize
the encoding and can't handle a font like that. I'm sure it can be made
to work with some coding but right now, the only thing you can try is to
replace "UnknownEncoding" with "StandardEncoding" and check if it works.
Otherwise, you should check out http://barcode4j.sourceforge.net as an
alternative.

On 30.11.2006 00:56:54 Peter wrote:
> Thanks for the reply,
> 
> I started from a Type1 font for which, I have the impression, the -enc ansi
> option is not supported/relevant.
> 
> Attached the metrics file.
> 
> All guidance where to look is appreciated,
> 
> Thanks,
> 
> Peter
> 
> > -----Original Message-----
> > From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> > Sent: Wednesday, November 29, 2006 11:32 PM
> > To: fop-users@xmlgraphics.apache.org
> > Subject: Re: NPE IN SingleByteFont.hasChar when using IDAutomationC39S
> > font
> > 
> > Peter wrote:
> > > I am trying to use a Barcode font (IDAutomationC39S) and I am getting an
> > NPE
> > > with the following trace listed lower.
> > 
> > Barcode fonts are tricky, because barcode glyphs are not separate
> > unicode glyphs.
> > It seems that the encoding for your font is unknown. Try to generate
> > the font metrics using the -enc ansi, although I think you did this
> > already. Would you mind sending in your metrics file?
> > 
> > If all else fails, try the barcode4j extension or generate a SVG
> > for the barcode and use this (there are XSLT style sheets out there
> > for this purpose).
> > 
> > J.Pietschmann


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: NPE IN SingleByteFont.hasChar when using IDAutomationC39S font

Posted by Peter <pc...@gmail.com>.
Thanks for the reply,

I started from a Type1 font for which, I have the impression, the -enc ansi
option is not supported/relevant.

Attached the metrics file.

All guidance where to look is appreciated,

Thanks,

Peter

> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> Sent: Wednesday, November 29, 2006 11:32 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: NPE IN SingleByteFont.hasChar when using IDAutomationC39S
> font
> 
> Peter wrote:
> > I am trying to use a Barcode font (IDAutomationC39S) and I am getting an
> NPE
> > with the following trace listed lower.
> 
> Barcode fonts are tricky, because barcode glyphs are not separate
> unicode glyphs.
> It seems that the encoding for your font is unknown. Try to generate
> the font metrics using the -enc ansi, although I think you did this
> already. Would you mind sending in your metrics file?
> 
> If all else fails, try the barcode4j extension or generate a SVG
> for the barcode and use this (there are XSLT style sheets out there
> for this purpose).
> 
> J.Pietschmann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

Re: NPE IN SingleByteFont.hasChar when using IDAutomationC39S font

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Peter wrote:
> I am trying to use a Barcode font (IDAutomationC39S) and I am getting an NPE
> with the following trace listed lower. 

Barcode fonts are tricky, because barcode glyphs are not separate
unicode glyphs.
It seems that the encoding for your font is unknown. Try to generate
the font metrics using the -enc ansi, although I think you did this
already. Would you mind sending in your metrics file?

If all else fails, try the barcode4j extension or generate a SVG
for the barcode and use this (there are XSLT style sheets out there
for this purpose).

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org