Custom Font In TextField

Luke Bowes <[email protected]> Fri, 19 Aug 2022 10:35:27 +0000
Newsgroups gmane.comp.python.reportlab.user
Message-ID <DU0PR02MB8595F2C8047534D4628C086DC76C9@DU0PR02MB8595.eurprd02.prod.outlook.com>
--===============0091010477032597577==
Content-Language: en-GB
Content-Type: multipart/alternative;
	boundary="_000_DU0PR02MB8595F2C8047534D4628C086DC76C9DU0PR02MB8595eurp_"

--_000_DU0PR02MB8595F2C8047534D4628C086DC76C9DU0PR02MB8595eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm trying to use a different font other than the default 14 in a TextField=
 but keep getting this error

ValueError: form font name, 'Calibri', is not one of the standard 14 fonts

I register the font

pdfmetrics.registerFont(TTFont('Calibri', 'Calibri.tff'))
but when i choose the font in the TextField I get the error


Any idea where I am going wrong please?

--_000_DU0PR02MB8595F2C8047534D4628C086DC76C9DU0PR02MB8595eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);" class=3D"elementToProof">
I'm trying to use a different font other than the default 14 in a TextField=
 but keep getting this error</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);" class=3D"elementToProof">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);" class=3D"elementToProof">
<span style=3D"margin:0px">ValueError: form font name, 'Calibri', is not on=
e of the standard 14 fonts</span><span style=3D"margin:0px"></span><br>
<div><br>
</div>
<div>I register the font</div>
<div><br>
</div>
<div>pdfmetrics.registerFont(TTFont('Calibri', 'Calibri.tff'))</div>
<div>but when i choose the font in the TextField I get the error</div>
<div><br>
</div>
<div><br>
</div>
Any idea where I am going wrong please?<br>
</div>
</body>
</html>

--_000_DU0PR02MB8595F2C8047534D4628C086DC76C9DU0PR02MB8595eurp_--

--===============0091010477032597577==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline