[reportlab-users] Problems with truetype barcode font

Marius Gedminas reportlab-users@reportlab.com
Tue, 28 Oct 2003 10:50:00 +0200


--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

On Mon, Oct 27, 2003 at 01:24:50PM +0200, Shayan Raghavjee wrote:
> I'm having a problem using a truetype font called 3of9.ttf. It gives me=
=20
> the following error:
>=20
> TTFError: Font does not have cmap for Unicode (platform 3, encoding 1,=20
> format 4 or platform 0 any encoding format 4)

It would be interesting to know what cmaps it does have.  I've attached
a Python script I used for inspecting TTFs; could you send me the output
of

  ttftest.py 3of9.ttf -cmap

?

> I've tried using a different truetype font like Arial for example, and=20
> that seems to work okay. Is there anything I can do to make the font=20
> work, or does anyone have an alternate font I could use?

Reportlab could be updated to handle other CMAP tables, not just
Unicode.  So far Unicode has been enough (or at least no one reported
seeing this error on the list).

What Reportlab needs is a mapping from Unicode code points to glyph
indices in the file.  Usually the font provides this mapping in a
Unicode CMAP table.  But this mapping can be easily inferred from a
mapping of, say, Windows-1252 code points to glyph indices. =20

> It looks like the font can't handle Unicode text or something, but the=20
> error is raised when on the line:
>=20
>   pdfmetrics.registerFont(TTFont('Barcode',=20
> 'C:\\WINDOWS\\Fonts\\3of9.TTF'))
>=20
> before I've even started making the PDF.

The TTFont constructor tries to open and parse the font file.  That's why it
fails at this point.

> I'm not sure about the policy on attachments, so I haven't attached the=
=20
> font. If it's okay I can.

You could send it to me personally, but I am quite busy this week, so I
cannot promise a quick resolution.

Marius Gedminas
--=20
   TCP_SeqNum - The 32-bit Sequence Number, encoded as an ASCII string
      representing the hex value of the Sequence number.  This field
      MUST be sent as lower case because it is not urgent.
		-- RFC 3093

--+HP7ph2BbKc20aGI
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/ni24kVdEXeem148RAoIqAJ9mlmIFofpMNdYjzayfqzAmr5jxLQCfRkHa
8F9t4g0H7MHIEpIl/vzQJrA=
=bHjt
-----END PGP SIGNATURE-----

--+HP7ph2BbKc20aGI--