[reportlab-users] reportlab-users Digest, Vol 112, Issue 14

Mike Driscoll mike at pythonlibrary.org
Wed May 29 14:14:46 EDT 2013

Hi everyone,

I'll answer inline to each of the answers and try to remove the cruft...

> Sending this backup to the listserv as a response - removing the image as

> it was 'too large'. My apologies if this gets double-posted.


> -j


> On Wed, May 29, 2013 at 12:39 PM, J. R. Carroll <jrc.csus at gmail.com>

> wrote:


> > Mike,

> >

> > Not sure, but if you are trying to get the 'funky P' shape you emailed

> > about a few weeks back (as in the image I am attaching [EDIT] IMAGE

> > REMOVED) - that's easy enough (but I'm assuming this is a different

> > issue)...


Actually, it is still the funky "P" thing I mentioned earlier, but I never
received much of a response then. I got one digest that seemed to be
commenting on someone's answer, but I couldn't find the actual answer.
Fortunately, at the time, no one at my company cared about the "P", but it
seems I need to re-implement this after all and now it's important again.

> >

> > If you are trying to get a semi-colon, I don't believe E13-B as a

> standard

> > has that (http://en.wikipedia.org/wiki/File:MICR.svg and its parent

> > article http://en.wikipedia.org/wiki/Magnetic_ink_character_recognition

> ).

> > On inspection of the "demo" fonts available via the links you provided

> (as

> > I would love to help *the Mr. Driscoll* of

> > http://www.blog.pythonlibrary.org/, I can't afford the $$ to buy the

> > legit font, no offense =P),

I figured you could use the Demo font...

> they say they only omit 7. 8. and 9 with no

> > mention of omitting a semi-colon. Furthermore, inspecting the

> > character/glyph map of the demo fonts show that there is no mapping for

> > semi-colon key-strokes to a comp micr/e13b glyph. If you are truly

> trying

> > to get a semi-colon, my guess is that you'll have to switch fonts

> > mid-string (or make your own glyph for the semi-colon - aka copy one

> over).

> >

> >

> > If, for whatever reason you were trying to get the 'funky P' you

> mentioned

> > in previous listserv questions, that symbol is mapped to the double-quote

> > key (as the image I attached shows [EDIT] IMAGE REMOVED) - if this is an

> > old/retired issue, then ignore this.

> >

> > -J


The double-quote DOES seem to work in my case. Thanks for that!

> Message: 2

> Date: Wed, 29 May 2013 13:02:23 -0400

> From: "J. R. Carroll" <jrc.csus at gmail.com>

> Subject: Re: [reportlab-users] Micr font advice in reportlab

> To: reportlab-users <reportlab-users at lists2.reportlab.com>

> Message-ID:

> <

> CAPjhJmUCZzZ2HZONksiAxqbcgnn9CtiX5MYDS5+7b2j2UZ4g5w at mail.gmail.com>

> Content-Type: text/plain; charset="iso-8859-1"


> I forgot to add that the ttf font does have the semi-colon mapped as the

> funky-p shape, but the afm/pfb fonts do not (they are using the

> double-quote instead). Perhaps thats the confusion between the font-spec

> provides versus the fonts you are trying to embed.


> -j




This is correct. I didn't quite follow how the font files worked, so thanks
for clarifying.

> Message: 3

> Date: Wed, 29 May 2013 10:45:34 -0700

> From: Tim Roberts <timr at probo.com>

> Subject: Re: [reportlab-users] Micr font advice in reportlab

> To: reportlab-users <reportlab-users at lists2.reportlab.com>

> Message-ID: <51A63EBE.7010700 at probo.com>

> Content-Type: text/plain; charset="ISO-8859-1"


> Mike Driscoll wrote:

> >

> > The colons turn into the correct character, but the semi-colons end up

> > looking blank. I have attached a quick example code and its output.

> > You can see the colons have been transformed per the spec, but the

> > semi-colons are eaten. There's a demo version of the font that has

> > both the characters (I think), so if anyone has any ideas or

> > solutions, I'm all ears.


> Believe it or not, the problem is in the font files. I had assumed you

> were using the TrueType file, and the TrueType file is correct.

> Instead, your code is using the Type 1 files (AFM/PFB). If you go look

> at the human-readable version (of that the PFA), you'll see that the

> Type 1 font simply does not include the semi-colon. (I checked the demo

> version, but I assume the real version is the same.)


> If you paid for this font (and I assume you did), that's a bug, and you

> should complain. In the meantime, if you switch to the TrueType

> version, this problem will go away.


> --

> Tim Roberts, timr at probo.com

> Providenza & Boekelheide, Inc.



I think we have purchased it, so I'll ask that we report it as a bug. The
reason I'm not using the TrueType font though is that I get an error when I
try to. Instead of that mess of code in my original post, you can simplify
the font embedding down to the following:

micr_font = "MICRCheckPrixa.ttf"
pdfmetrics.registerFont(TTFont("MICRCheckPrixa", micr_font))

When I do that and run the example script, I get the following traceback:

IndexError: list index out of range
File "C:\Users\mdriscoll\Documents\projects\comp_sigma\font\micr_test.py",
line 21, in <module>
File "C:\Python26\Lib\site-packages\reportlab\platypus\doctemplate.py",
line 1117, in build
BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
File "C:\Python26\Lib\site-packages\reportlab\platypus\doctemplate.py",
line 906, in build
File "C:\Python26\Lib\site-packages\reportlab\platypus\doctemplate.py",
line 848, in _endBuild
if getattr(self,'_doSave',1): self.canv.save()
File "C:\Python26\Lib\site-packages\reportlab\pdfgen\canvas.py", line 1123,
in save
self._doc.SaveToFile(self._filename, self)
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 235,
in SaveToFile
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 247,
in GetPDFData
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\ttfonts.py", line
1128, in addObjects
pdfFont.FontDescriptor = self.face.addSubsetObjects(doc, baseFontName,
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\ttfonts.py", line
926, in addSubsetObjects
fontFile.content = self.makeSubset(subset)
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\ttfonts.py", line
777, in makeSubset
while n > 1 and self.hmetrics[n][0] == self.hmetrics[n - 1][0]:

I'm not sure what is going on here, but Reportlab sure doesn't like
something about that font.

Mike Driscoll

Blog: http://blog.pythonlibrary.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130529/9ad2cdc4/attachment.html>

More information about the reportlab-users mailing list