Text stuffing with Cairo/pycairo?

Warren Vick <[email protected]> Wed, 24 Apr 2019 14:28:18 +0000
Newsgroups gmane.comp.lib.cairo
Message-ID <AM6PR10MB28696632998E29DFF1B939F6F93C0@AM6PR10MB2869.EURPRD10.PROD.OUTLOOK.COM>
--===============1578433196==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_AM6PR10MB28696632998E29DFF1B939F6F93C0AM6PR10MB2869EURP_"

--_000_AM6PR10MB28696632998E29DFF1B939F6F93C0AM6PR10MB2869EURP_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hello,

New to the list and wondering if Cairo might be the right library to help m=
e create some vector-based typographic art.

I'd like to create a piece that only use text at various font faces, sizes,=
 style, colours, etc. It would largely be machine generated so I'd like to =
find a software library that will help me place vector text on a canvas and=
 finally save as a large PDF. From a Python script, I'd like to be able to =
specify a bounding box on the page, the text string, text attributes and ge=
t the library to fill (by sizing and stretching) the text to fill the box. =
I'll repeat this process several thousand times and when I'm done, simply s=
ave the PDF. I'd love to avoid messing around with font metrics if I can an=
d get the library to do the "text stuffing" for me.

Is Cairo and the pycairo bindings the right library for me? Any simple exam=
ple out there that might help? Many thanks.

Regards,
Warren


--_000_AM6PR10MB28696632998E29DFF1B939F6F93C0AM6PR10MB2869EURP_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-GB" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hello,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">New to the list and wondering if Cairo might be the =
right library to help me create some vector-based typographic art.<o:p></o:=
p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I&#8217;d like to create a piece that only use text =
at various font faces, sizes, style, colours, etc. It would largely be mach=
ine generated so I&#8217;d like to find a software library that will help m=
e place vector text on a canvas and finally save
 as a large PDF. From a Python script, I&#8217;d like to be able to specify=
 a bounding box on the page, the text string, text attributes and get the l=
ibrary to fill (by sizing and stretching) the text to fill the box. I&#8217=
;ll repeat this process several thousand times
 and when I&#8217;m done, simply save the PDF. I&#8217;d love to avoid mess=
ing around with font metrics if I can and get the library to do the &#8220;=
text stuffing&#8221; for me.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Is Cairo and the pycairo bindings the right library =
for me? Any simple example out there that might help? Many thanks.<o:p></o:=
p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-GB">Regards,<=
o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-GB">Warren<o:=
p></o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_AM6PR10MB28696632998E29DFF1B939F6F93C0AM6PR10MB2869EURP_--

--===============1578433196==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

LS0gCmNhaXJvIG1haWxpbmcgbGlzdApjYWlyb0BjYWlyb2dyYXBoaWNzLm9yZwpodHRwczovL2xp
c3RzLmNhaXJvZ3JhcGhpY3Mub3JnL21haWxtYW4vbGlzdGluZm8vY2Fpcm8=

--===============1578433196==--