<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi<br>
<br>
Could I just ensure that I'm not going mad? I'm creating PDFs with
tight bounding boxes for multi-line text. What I do at the moment
is (code snippet in ruby) :-<br>
<br>
</font>
<pre><font face="Helvetica, Arial, sans-serif"> while true
@cr.update_pango_layout(@layout)
layout_ink_rect, layout_logical_rect = @layout.extents
ink_width = layout_ink_rect.x.abs + layout_ink_rect.width</font></pre>
<pre><font face="Helvetica, Arial, sans-serif"> break if ink_width <= width</font></pre>
<pre><font face="Helvetica, Arial, sans-serif"> @layout.width -= layout_ink_rect.x.abs</font></pre>
<pre><font face="Helvetica, Arial, sans-serif"> end</font></pre>
<pre><font face="Helvetica, Arial, sans-serif"> layout_ink_rect, layout_logical_rect = @layout.extents</font></pre>
<pre></pre>
<font face="Helvetica, Arial, sans-serif"><br>
I have to do this as otherwise my text will overlap my bounding
box as, especially for italic text, layout_ink_rect.x.abs will be
negative and I will have to move my drawing position to the right.<br>
This will cause the text to overlap the right hand side of the
bounding box</font><font face="Helvetica, Arial, sans-serif">.<br>
<br>
Is this the correct way to do this in </font><font
face="Helvetica, Arial, sans-serif">cairo</font><font
face="Helvetica, Arial, sans-serif">?<br>
<br>
Many Thanks<br>
<br>
Kieran<br>
<br>
</font>
</body>
</html>