Re: [Vala] Pango and Justify



On Mon, Dec 13, 2010 at 11:31:24PM -0500, Scott Ringwelski wrote:
> Hello,
> 
> I'm having some trouble working with pango and layouts.
> 
> I have a large body of text that I would like to draw onto a widget using pango. However, I'm having problems with the justify property. Justify is not working properly. Could somebody please give me an example of a pango layout with a specific width that prints the paragraph of text "justified" (doesn't wrap every word, only when it hits the width, then goes to new line). The code that I am using now that does not work is something like this (psuedo):
> 
> layout.width = 400;
> layout.justified = true;
> layout.set_text("this should be wrapping itself but instead it prints a new line after every word");
> 
> Pango.cairo_update_layout (cr, this.layout);
> Pango.cairo_show_layout (cr, this.layout);
> 
> Thank you,

From the docs width must be in Pango units (or -1 for no wrapping), so:
layout.width = 400*Pango.SCALE;

Also please use vala-list instead of vala-devel-list, or better a GTK+ list
given this is not really Vala related.

-- 
http://www.debian.org - The Universal Operating System

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]