Mario,

Here's how I am using custom fonts.


In my application folder I have created a folder "MyAppFonts" and copied
all custom fonts in that folder. You can either refer to operating systems
folder such as c:\windows\fonts.

Copy fop.xconf file to your application folder and then rename to
YourAppNameConfig.xml

Open the YourAppNameConfig.xml in any editor and add you MyAppFonts folder
as shown below

      <fonts>
        <!-- embedded fonts -->
                    <!-- register all the fonts found in a directory -->
                    <directory>.\MyAppFonts</directory>

                    <!-- register all the fonts found in a directory
                         and all of its sub directories (use with care)
        -->
                    <directory recursive="true">.\MyAppFonts</directory>

                    <!-- automatically detect operating system installed
fonts
                    <auto-detect/>
        -->
      </fonts>


Sample java code

            // configure fopFactory as desired
            FopFactory fopFactory = FopFactory.newInstance();

            fopFactory.setUserConfig(new File( YourAppNameConfig.xml ));

            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();


I am using custom font in this manner.

I hope this information helps.

Regards,
Jayant



|------------>
| From:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"Mario Madunic" <mario_madu...@newflyer.com>                                 
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |<fop-users@xmlgraphics.apache.org>                                           
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |07/01/2010 02:19 PM                                                          
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |RE: FOP trunk error message when run from ant                                
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|





Thanks Eric,

I removed the following jar from my ant181/lib xmlgraphics-commons-1.3.1
and copied over the 1.4 version. The graphic error msg is gone but now have
an id reference error. Will work on this one before posting if I make no
head way. I'll start a new message on how to get Helvetica recognized. I
was unable to create an XML metric file for it with the method for 0.94.

Once again thanks Eric for your quick and knowledgeable reply.

Marijan (Mario) Madunic
Publishing Specialist
New Flyer Industries

-----Original Message-----
From: Eric Douglas [mailto:edoug...@blockhouse.com]
Sent: Thursday, July 01, 2010 1:07 PM
To: fop-users@xmlgraphics.apache.org
Subject: RE: FOP trunk error message when run from ant

Do you have the xmlgraphics-commons-1.4svn.jar in your trunk lib path?

New method for calling fonts?  Is this on embedding code or just on
running from a command line?
I'm using the FOP classes with embedded code and my custom fonts are
working nicely.

-----Original Message-----
From: Mario Madunic [mailto:mario_madu...@newflyer.com]
Sent: Thursday, July 01, 2010 10:13 AM
To: fop-users@xmlgraphics.apache.org
Subject: FOP trunk error message when run from ant

While running the trunk via ANT the build fails. The error message is at
the bottom.

Pieces I'm using
Java 1.6.0_16
ANT 1.8.1 (just started using it today, was using 1.7 and received same
error) Windows XP SP3

I executed the build by just typing ant in a cmd prompt.

In the config file I added the font metrics for the time being from my
0.94 config file, as it still seems to be valid. Example below <font
metrics-url="fontsForFOP/arial.xml" kerning="yes"
embed-url="file:///c:/Windows/fonts/ARIAL.TTF">
  <font-triplet name="Arial" style="normal" weight="normal"/> </font>

At the moment still trying to figure out the new method for calling
fonts. (want to use Helvetica and encoding utf-8)

Line 46 mentioned below of the build file (partsToPDF.xml) is <fop
format="application/pdf"
fofile="output/tempFilesDelete/SR_TEST_Parts.fo"
outfile="output/SR_TEST_Parts.pdf" messagelevel="info"
userconfig="fopConfig/fopNewFlyer-trunk.xconf" force="true" /> (I
receive the same error when using absolute paths, in case that makes a
difference)

Any help appreciated.

Thanks

BUILD FAILED
c:\ publishingWorkflow\antTargets\partsToPDF.xml:46:
java.lang.NoSuchMethodError:
org.apache.xmlgraphics.java2d.GraphicContext.<init>(Lorg/apache/xmlgraph
ics/java2d/GraphicContext;)V
  at
org.apache.fop.render.intermediate.IFGraphicContext.<init>(IFGraphicCont
ext.java:50)
  at
org.apache.fop.render.intermediate.IFGraphicContext.clone(IFGraphicConte
xt.java:56)
  at
org.apache.fop.render.intermediate.IFRenderer.saveGraphicsState(IFRender
er.java:632)
  at
org.apache.fop.render.intermediate.IFRenderer.startViewport(IFRenderer.j
ava:885)
  at
org.apache.fop.render.intermediate.IFRenderer.startVParea(IFRenderer.jav
a:878)
  at
org.apache.fop.render.AbstractRenderer.renderRegionViewport(AbstractRend
erer.java:289)
  at
org.apache.fop.render.intermediate.IFRenderer.renderRegionViewport(IFRen
derer.java:731)
  at
org.apache.fop.render.AbstractRenderer.renderPageAreas(AbstractRenderer.
java:249)
  at
org.apache.fop.render.AbstractRenderer.renderPage(AbstractRenderer.java:
230)
  at
org.apache.fop.render.intermediate.IFRenderer.renderPage(IFRenderer.java
:580)
  at
org.apache.fop.area.RenderPagesModel.addPage(RenderPagesModel.java:114)
  at
org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.finishPage(Ab
stractPageSequenceLayoutManager.java:312)
  at
org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage(PageSequen
ceLayoutManager.java:167)
  at
org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.makeNewPage(A
bstractPageSequenceLayoutManager.java:284)
  at
org.apache.fop.layoutmgr.PageBreaker.handleBreakTrait(PageBreaker.java:5
26)
  at
org.apache.fop.layoutmgr.PageBreaker.startPart(PageBreaker.java:429)
  at
org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:5
47)
  at
org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:4
97)
  at org.apache.fop.layoutmgr.PageBreaker.doPhase3(PageBreaker.java:308)
  at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:4
50)
  at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:85)
  at
org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSe
quenceLayoutManager.java:107)
  at
org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java
:238)
  at
org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:12
0)
  at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.j
ava:349)
  at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
  at
net.sf.saxon.event.ContentHandlerProxy.endElement(ContentHandlerProxy.ja
va:391)
  at
net.sf.saxon.event.NamespaceReducer.endElement(NamespaceReducer.java:213
)
  at
net.sf.saxon.event.ReceivingContentHandler.endElement(ReceivingContentHa
ndler.java:447)
  at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1528)
  at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
  at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
  at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
  at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
  at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
  at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:397)
  at net.sf.saxon.event.Sender.send(Sender.java:182)
  at
net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:32)
  at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)
  at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
  at
org.apache.fop.tools.anttasks.FOPTaskStarter.renderInputHandler(Fop.java
:657)
  at org.apache.fop.tools.anttasks.FOPTaskStarter.render(Fop.java:680)
  at org.apache.fop.tools.anttasks.FOPTaskStarter.run(Fop.java:539)
  at org.apache.fop.tools.anttasks.Fop.execute(Fop.java:368)
  at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:1
06)
  at org.apache.tools.ant.Task.perform(Task.java:348)
  at org.apache.tools.ant.Target.execute(Target.java:390)
  at org.apache.tools.ant.Target.performTasks(Target.java:411)
  at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
  at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
  at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:41)
  at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
  at org.apache.tools.ant.Main.runBuild(Main.java:801)
  at org.apache.tools.ant.Main.startAnt(Main.java:218)
  at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
  at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)


Marijan (Mario) Madunic
Publishing Specialist
New Flyer Industries

--------------------------------------------------------------------
Please consider the environment before printing this e-mail.

CONFIDENTIALITY STATEMENT: This communication (and  any and all
information or material transmitted with this communication) is
confidential, may be privileged and is intended only for the use of the
intended recipient. If you are not the intended recipient, any review,
retransmission, circulation, distribution, reproduction, conversion to
hard copy, copying or other use of this communication, information or
material is strictly prohibited and may be illegal. If you received this
communication in error or if it is forwarded to you without the express
authorization of New Flyer, please notify us immediately by telephone or
by return email and permanently delete the communication, information
and material from any computer, disk drive, diskette or other storage
device or media. Thank you.


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


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


--------------------------------------------------------------------
Please consider the environment before printing this e-mail.

CONFIDENTIALITY STATEMENT: This communication (and  any and all information
or material transmitted with this communication) is confidential, may be
privileged and is intended only for the use of the intended recipient. If
you are not the intended recipient, any review, retransmission,
circulation, distribution, reproduction, conversion to hard copy, copying
or other use of this communication, information or material is strictly
prohibited and may be illegal. If you received this communication in error
or if it is forwarded to you without the express authorization of New
Flyer, please notify us immediately by telephone or by return email and
permanently delete the communication, information and material from any
computer, disk drive, diskette or other storage device or media. Thank you.


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







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

Reply via email to