Hi FOP users Today was a great success! We managed to get the AFP output working with OCR-B font.
To transform outline fonts with TypeTransformer was a good approach. What I couldn't know was the fact, AFP code pages cannot be found easily in the internet. You have to request one from a person working with AFP fonts and code pages. When the Instructions below has been followed, and the according code page is present AFP will work great with OCR-B! Remember: The OCR font I posted here isn't a real OCR-B font! Maybe of licensing purposes, the space character and the exclamation mark (probably more) are different to real OCR-B fonts. Thanks for the support and hopefully my success will lead others to theirs :) Regards Peter -----Original Message----- From: Jeremias Maerki [mailto:d...@jeremias-maerki.ch] Sent: Montag, 11. Oktober 2010 18:25 To: fop-users@xmlgraphics.apache.org Subject: Re: FOP - AFP Rendering in OCR-B Hi Peter On 08.10.2010 17:23:39 Peter Weber wrote: > Hi Jeremias > > Sounds like I was on a good way with TypeTransformer. > I followed Your instructions. I choose a Type 1 font 'ocrb10.pfm' and > transformed it to an AFP Outline font. > This font You can download at: > http://ansuz.sooke.bc.ca/software/ocrb-complete.zip > > I didn't configure any sizes, bitmap fonts, etc. I just leaved everything > empty in TypeTransformer and started the job. > > I got an error message: > ->There are missing characters in the character list that was generated using > filters. I get that, too. I don't think that's a problem as long as you don't need very special characters. > But TypeTransformer produced an OLN font 'CZA080.OLN', where I've removed the > file extension. > > > My Config: > <font> > <afp-font type="outline" codepage="T1EDO500" encoding="Cp500" > characterset="CZA282 " path="C:\Program Files (x86)\Type > Transformer\DUVTT\JOBPATH\OCRB10"/> > <font-triplet name="ocrb10" style="normal" weight="normal"/> </font> > > The Exception is the same like before: > org.apache.avalon.framework.configuration.ConfigurationException: Failed to > load the character set metrics CZA282 with > code page T1EDO500. I/O error: Resource not found: T1EDO500 > > Then I replaced the character set with 'CZA080', tried different code > pages and different disk location of the font-folder (TypeTransformer > default directory/Project directory). > > It's always the same error. That's strange. What I did was create a new directory somewhere and copy the character set file and the codepage file into that directory. Then I set "path" to this directory. That worked. > TypeTransformer provides the possibility to set Character Filters and a pre > defined Character List OCR-B. > But I can't see any difference. I wouldn't expect one. I think this is just a possibility to keep the character set (and file size) small by only transforming the characters you really need. For example, if you only need to print a Swiss ESR form, you only need "0123456789>+" and a space. > Last but not least I tried to get the metrics with PFMReader. Unfortunately, > I am not very familiar to Java so I couldn't get it working. > I was following these instructions: > http://xmlgraphics.apache.org/fop/1.0/fonts.html#advanced > I changed the filenames to the current versions like > 'avalon-framework-4.2.0.jar'. > > Following exception was generated: > Failed to load Main-Class manifest attribute from {some > path}\fop-1.0\lib\commons-io.jar Forget PFMReader. It's of no use anymore. It's still there for historical reasons. I managed to produce an AFP file with the OCR-B font converted to an outline font. However, the exclamation mark is converted to an "|" for some reason I haven't investigated, yet. Furthermore, some viewers had problems with the file, either completely or just with the first line (see attachments). I then also generated raster fonts (8, 9, 10, 11 and 12pt at 240dpi) and tried those, also with T1EDO500/Cp500. That gave me even better results in terms of viewer compatibility. I guess TypeTransformer may not be the fail-safe tool. At any rate, I'll have to investigate that strange character substitution when I have more time. It's not the first time I run into this. HTH > > Thanks for Your response Jeremias. > Do You have any tip left? > > Regards > Peter > > > -----Original Message----- > From: Jeremias Maerki [mailto:d...@jeremias-maerki.ch] > Sent: Donnerstag, 7. Oktober 2010 10:12 > To: fop-users@xmlgraphics.apache.org > Subject: Re: FOP - AFP Rendering in OCR-B > > Hi Peter > > Incidentally, I had to look into IBM's TypeTransformer for a client > recently. I haven't gone the raster font route. I had some problems > there. Instead, I produced an outline font from a Type 1 font. Here's > what I did: > > - Choose a Type 1 font in TypeTransformer (I took Sansa-Normal) > - Leave the Sizes empty. > - Choose "AFP Outline" as output font. Uncheck bitmap fonts. > - Leave character filters empty (remove them if present). > - Start the job. > --> that should produce a good OLN font with as many characters as are > --> available in the > Type 1 font. > > - Remove the ".OLN" at the end. > - Add a configuration entry like this: > > <font> > <afp-font type="outline" codepage="T1EDO500" encoding="Cp500" > characterset="CZA282 " > path="C:\Program Files\IBM\Type Transformer\DUVTT\JOBPATH\T1A"/> > <font-triplet name="Sansa" style="normal" weight="normal"/> > </font> > > Of course, you should also be able to use a different codepage, but > Cp500/T1EDO500 worked fine for me incl. German Umlauts, but except, > for some reason, the exclamation mark. I haven't investigated more > closely, yet. The codepage basically just selects the 8-bit subset you > want to work with. You just have to make sure your selected codepage > has as many of the font's characters mapped so you get most of the 256 > (8-bit) character set as possible. > > So I assume a similar approach should work in your case. Your > "Resource not found: T1000893" means you may need to move the code > page file to the same place as the character set. And you should > consider using absolute URIs instead of relative paths. Relative paths > are usually resolved based on the current directory of the application. > "base-uri" > and "path" are pretty much interchangeable: "base-uri" expects a URI, > "path" a file system path. > > HTH > > On 05.10.2010 11:26:26 Peter Weber wrote: > > Hello > > > > I was playing around with IBM TypeTransformer and thought I found a way to > > get this working. > > Type Transformer Created 3 raster Fonts for me: > > - C0A080A0.240 > > - C0A08000.240 > > - C0A08090.240 > > > > Wow, looks like the mystic characterset I couldn't figure out what > > it really is! :) > > > > One step forward but it still doesn't work. > > Here my Configuration: > > > > <font> > > <afp-font type="raster" codepage="T1000893" encoding="Cp893" > > base-uri="file:/../ocrb10/"> > > <afp-raster-font size="9" characterset="C0A08090"/> > > <afp-raster-font size="10" characterset="C0A08000"/> > > <afp-raster-font size="11" characterset="C0A080A0"/> > > </afp-font> > > <font-triplet name="ocrb10" style="normal" weight="normal"/> > > </font> > > > > When I run this with a simple Template. I get following error: > > SCHWERWIEGEND: Exception > > org.apache.avalon.framework.configuration.ConfigurationException: > > Failed to load the character set metrics C0A08090 with code page > > T1000893. I/O error: Resource not found: T1000893 > > > > > > I tried some things with the path: > > "../ocrb" > > "/../ocrb" > > "file:/../ocrb" > > "file://../ocrb" > > "file:///../ocrb" > > -> Same Exception as above. > > > > "..\ocrb" > > -> FOP replaces the config with the default config. > > > > base-uri="file:///D:/Labor/REM/REM_Reporting/afp_fop-1.0/OCRB10/" > > -> Throws the same Exception as above. > > > > > > Here the complete stack trace: > > > > 05.10.2010 11:25:38 org.apache.fop.apps.FopFactoryConfigurator > > configure > > INFO: Default page-height set to: 11in 05.10.2010 11:25:38 > > org.apache.fop.apps.FopFactoryConfigurator configure > > INFO: Default page-width set to: 8.26in 05.10.2010 11:25:38 > > org.apache.fop.cli.Main startFOP > > SCHWERWIEGEND: Exception > > org.apache.avalon.framework.configuration.ConfigurationException: > > Failed to load the character set metrics C0A08090 with code page T1000893. > > I/O error: Resource not found: T1000893 > > at org.apache.fop.util.LogUtil.handleException(LogUtil.java:53) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.setupFontInfo(AFPRendererConfigurator.java:493) > > at > > org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:165) > > at > > org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:181) > > at > > org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:73) > > at > > org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:130) > > at > > org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:102) > > at > > org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:359) > > at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:105) > > at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:101) > > at org.apache.fop.apps.Fop.<init>(Fop.java:79) > > at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:271) > > at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:109) > > at org.apache.fop.cli.Main.startFOP(Main.java:174) > > at org.apache.fop.cli.Main.main(Main.java:205) > > Caused by: > > org.apache.avalon.framework.configuration.ConfigurationException: Failed to > > load the character set metrics C0 A08090 with code page T1000893. I/O > > error: Resource not found: T1000893 > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.toConfigurationException(AFPRendererConfigurator.java:284) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.fontFromType(AFPRendererConfigurator.java:209) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.buildFont(AFPRendererConfigurator.java:138) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.buildFontListFromC > > onfiguration(AFPRendererConfigurator.java > > :316) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.setupFontInfo(AFPRendererConfigurator.java:489) > > ... 13 more > > Caused by: java.io.FileNotFoundException: Resource not found: T1000893 > > at > > org.apache.fop.afp.util.DefaultFOPResourceAccessor.createInputStream(DefaultFOPResourceAccessor.java:72) > > at > > org.apache.fop.afp.fonts.CharacterSetBuilder.openInputStream(CharacterSetBuilder.java:162) > > at > > org.apache.fop.afp.fonts.CharacterSetBuilder.loadCodePage(CharacterSetBuilder.java:309) > > at > > org.apache.fop.afp.fonts.CharacterSetBuilder.build(CharacterSetBuilder.java:222) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.fontFromType(AFPRendererConfigurator.java:206) > > ... 16 more > > > > --------- > > > > org.apache.avalon.framework.configuration.ConfigurationException: > > Failed to load the character set metrics C0A08090 with code page T1000893. > > I/O error: Resource not found: T1000893 > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.toConfigurationException(AFPRendererConfigurator.java:284) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.fontFromType(AFPRendererConfigurator.java:209) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.buildFont(AFPRendererConfigurator.java:138) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.buildFontListFromC > > onfiguration(AFPRendererConfigurator.java > > :316) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.setupFontInfo(AFPRendererConfigurator.java:489) > > at > > org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:165) > > at > > org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:181) > > at > > org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:73) > > at > > org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:130) > > at > > org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:102) > > at > > org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:359) > > at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:105) > > at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:101) > > at org.apache.fop.apps.Fop.<init>(Fop.java:79) > > at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:271) > > at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:109) > > at org.apache.fop.cli.Main.startFOP(Main.java:174) > > at org.apache.fop.cli.Main.main(Main.java:205) > > Caused by: java.io.FileNotFoundException: Resource not found: T1000893 > > at > > org.apache.fop.afp.util.DefaultFOPResourceAccessor.createInputStream(DefaultFOPResourceAccessor.java:72) > > at > > org.apache.fop.afp.fonts.CharacterSetBuilder.openInputStream(CharacterSetBuilder.java:162) > > at > > org.apache.fop.afp.fonts.CharacterSetBuilder.loadCodePage(CharacterSetBuilder.java:309) > > at > > org.apache.fop.afp.fonts.CharacterSetBuilder.build(CharacterSetBuilder.java:222) > > at > > org.apache.fop.render.afp.AFPRendererConfigurator.fontFromType(AFPRendererConfigurator.java:206) > > ... 16 more > > > > -----Original Message----- > > From: Peter Weber [mailto:peter.we...@garaio.com] > > Sent: Montag, 4. Oktober 2010 14:48 > > To: fop-users@xmlgraphics.apache.org > > Subject: FOP - AFP Rendering in OCR-B > > > > Hi FOP users > > > > One Question as simple as possible. > > How do I configure OCR-B font in FOP for the AFP Renderer? > > > > It would be very great if You can tell me which CodePage, Caractersets, > > Encoding etc., I need to submit in the fop.xconf. > > I need to use OCR-B font in an AFP Document. > > > > Last week I have posted a similar Problem but I think I've lost myself in > > the problem, there: > > http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-users/20101 > > 0.mbox/browser > > > > Thank You very much for Your help > > Peter > > > > > Jeremias Maerki > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org > For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org > Jeremias Maerki