<font color='black' size='2' face='Arial, Helvetica, sans-serif'>
<div style="font-size: 10pt; color: black; ">
<div id="AOLMsgPart_1_fc71efaa-dda9-441d-9ad0-0660b1f4769d">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "><font color="black" face="Arial, Helvetica, sans-serif">
<div>
<div style="margin-right: 0px; margin-left: 0px; margin-bottom: 0px; margin-top: 0px; ">
<div><pre><tt><font face="Arial, Helvetica, sans-serif" style="font-family: arial, helvetica; "><span style="white-space:normal">>></span></font><font face="Tahoma, Verdana, Arial, sans-serif" style="font-family: arial, helvetica; "><span style="font-size:9pt">>>Another workaround is to prerender the text to a similar surface
>>>>(cairo_surface_create_similar) and paint that intermediate surface to
>>>>the destination surface with the correct offset.
>>>
>>> Would using the latter method prevent me from using semi-transparent text
>>> and / or backgrounds?
>>
>>It would not if you pass CAIRO_CONTENT_COLOR_ALPHA to the function, see
</span></font><font face="Arial, Helvetica, sans-serif">></font><font face="arial, helvetica">></font><a target="_blank" __removedlink__1124929718__href="http://cairographics.org/manual/cairo-cairo-surface-t.html#cairo-surface-create-similar" style="font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 9pt; ">http://cairographics.org/manual/cairo-cairo-surface-t.html#cairo-surface-create-similar</a><font face="Tahoma, Verdana, Arial, sans-serif" style="font-family: arial, helvetica; "><span style="font-size:9pt">
>>
>>Prerendering the text is much faster that having to render the text
>>again in every frame. It's only really a reasonable shortcut when the
>>text is only translated and perhaps rotated, but not zoomed though.
</span></font></tt></pre></div>
<pre style="font-family: arial, helvetica; "><tt><font face="Tahoma, Verdana, Arial, sans-serif"><span style="font-size:9pt">>>I would love to pre-render the text but I think my use case makes it a bit more complex. </span></font></tt></pre>
<pre style="font-family: arial, helvetica; "><tt><font face="Tahoma, Verdana, Arial, sans-serif"><span style="font-size:9pt">>>The video frame is a fixed size ARGB surface which makes sense. However, the text can </span></font></tt></pre><pre style="font-family: arial, helvetica; "><tt><font face="Tahoma, Verdana, Arial, sans-serif"><span style="font-size:9pt">>>be any size </span></font></tt><span style="font-size:9pt;font-family:Tahoma,Verdana,Arial,sans-serif">and often much wider than the video image. I imagine this prevents me from being </span></pre>
<pre style="font-family: arial, helvetica; "><span style="font-size:9pt;font-family:Tahoma,Verdana,Arial,sans-serif">>>able to use </span><span style="font-size:9pt;font-family:Tahoma,Verdana,Arial,sans-serif">'create similar' since this would be using the video frame's surface, no? I guess </span></pre>
<pre style="font-family: arial, helvetica; "><span style="font-size:9pt;font-family:Tahoma,Verdana,Arial,sans-serif">>>I could </span><span style="font-size:9pt;font-family:Tahoma,Verdana,Arial,sans-serif">create a new ARGB image surface using the text dimensions?</span></pre>
<pre style="font-family: arial, helvetica; "><span style="font-size:9pt;font-family:Tahoma,Verdana,Arial,sans-serif"><br>
</span></pre></div>
</div>
</font></blockquote><font face="arial, helvetica">>I have done this before using cairo and pango, basically a ticker bar on a N width screen with smooth scrolling. My approach was something like this:</font><br>
<br>
<font face="arial, helvetica">>Make a text rendering surface 2 * N + C, C = 16 or such.</font><br>
<br>
<font face="arial, helvetica">>do {</font><br>
<font face="arial, helvetica">>Render text in the off screen part of the surface (which is now the rightmost half of the surface).</font><br>
<font face="arial, helvetica">>Composite that surface from X=0 at X=0 to your main surface.</font><br>
<font face="arial, helvetica">>Composite that surface from X=2 at X=0 to your main surface (assuming your step size = 2 pixels).</font><br>
<font face="arial, helvetica">>When you reach X = 2N render in the offscreen part of the text render surface (which is now the leftmost half of the surface).</font><br>
<font face="arial, helvetica">>} while (true);</font><br>
<br>
<font face="arial, helvetica">It looks like you are pre-rendering the text in chunks and updating the chunks as the text scrolls. Is there a way to render the entire text to a cairo surface whole? As far as I can see one needs a cairo surface before creating the pango layout. However, in my case, I do not know the dimensions of the cairo surface needed until after I start working in pango.</font>
</div>
<div class="gmail_quote"><font face="arial, helvetica"><br>
</font></div>
<div class="gmail_quote"><font face="arial, helvetica">Thanks again,</font></div>
<div class="gmail_quote"><font face="arial, helvetica">Bob</font></div>
</div>
<!-- end of AOLMsgPart_1_fc71efaa-dda9-441d-9ad0-0660b1f4769d -->
</div>
</font>