Re: how to get the width of a string
- From: "Marco Scholten" <mscholtn xs4all nl>
- To: "rion10" <astar_ly yahoo com cn>
- Cc: gtkmm-list gnome org
- Subject: Re: how to get the width of a string
- Date: Thu, 17 Nov 2005 10:04:39 +0100
there is a entry in my window, so I want to put a string to the entry box.
if the string is too long to fit the entry, so I need cut the string to be
like this:
aaaaaa...bbb,
so, my question is how to get the width of the specify string with default
font style.
Thanks for any hint!
something like:
Glib::RefPtr<Pango::Layout> layout;
layout = m_entry.create_pango_layout("");
layout->set_markup("<span font_desc=\"sans 12\">some text</span>");
int LayoutWidth, LayoutHeight;
layout->get_size(LayoutWidth, LayoutHeight);
double text_width = LayoutWidth / PANGO_SCALE;
--
Marco
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]