Re: Styling first line of text



Sam:

The ClutterText of the St.Entry does not allow markup
because it is editable.  Using .set_use_markup(true) on
the ClutterText of a label works with pango markup. You
might consider adding a label for the title of your note.
You could parse out the first non-blank line of the entry 
text, add  the pango markup to it, then set the label text 
and then .set_use_markup(true) on the label's ClutterText.

Something like this... 

let lines = content.toString().split('\n');
//assuming first line has text in it....
let title = '<i>'+lines[0]+'</i>;
this._titleLabel.set_text(title);
let ct = this._titleLabel.get_clutter_text();
ct.set_use_markup(true);

You might want to trim the title to be the first N 
characters of the first line.  That might look
a bit better.

Good luck,
Norman

On Tue, 2013-01-01 at 16:29 +0000, Sam Bull wrote:
> Hi again, I think this is the last feature I'm attempting to complete
> now.
> 
> Is it possible to change the style of the first line of text in a
> St.Entry widget? I've tried using the CSS :first-line attribute, to no
> effect. I've also tried manually hacking the text with Pango markup, but
> the markup had no effect.
> 
> I'm attempting to make the first line of a note, have the appearance of
> a title.
> 
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org
> https://mail.gnome.org/mailman/listinfo/gnome-shell-list




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