[Glade-users] Chaning the font size for an entire application....



This is a multi-part message in MIME format.

------=_NextPart_000_0025_01C51349.C450D7E0
Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: 7bit

 
I found some documentation on the use of rc files and think that's the way
to go, but I still cannot get the
font size to change.
 
I have an RC file that is:
 
style "Application"
{
    font="-*-courier-*-*-*-*-10-*-*-*-*-*-*-*"
}
 
In my code I am trying to do this for a Dialog base class as a test to get
all dialogs which derive from this to
change the font size.
 
I have this as a class definition:
 
class CDialog : public Gtk::Dialog
{
....
};
 
In my constructor, which I verified is being run, the gobj() is returning a
ptr to the underlying C object, I do this:
 
CDialog::CDialog(....)
{
    GtkDialog * pWidget = gobj();
    gtk_parse_rc(myFilename);
    gtk_widget_set_name((GtkWidget *)pWidget, "Application");
 
...
}
 
I have also moved the above code to be just before the dialog is shown on
the screen (it is loaded invisible).
 
Same results:
 
at run time, I get the following assertion failures:
 
fonts.c  pango_font_description_get_size assertion desc != NULL failed
fonts.c  pango_font_description_set_size assertion desc != NULL failed
Gtk::RcStyle::set_font assertion font_desc.gobj() != 0 failed.
 
Any help would be greatly appreciated!
 
 
 


  _____  

From: glade-users-admin lists ximian com
[mailto:glade-users-admin lists ximian com] On Behalf Of Bob Huston
Sent: Tuesday, February 15, 2005 9:19 AM
To: glade-users lists ximian com
Subject: [Glade-users] Chaning the font size for an entire application....


 
I have an application running on Linux 9, useing Glade to design the UI,
then libglade to load/process
the xml. The backend code is written in C++ using gtkmm.
 
When i design the UI screens, they are fine. When I load the XML file, then
call get_widget  to put the
dialogs and windows and controls onto the screen, they have a totally
different and much larger font size
than was used during the glade session for design.
 
How can I change the font size used by the application at run time? I have
found sample code to change 
font characteristics for a control, but I need to do it for all controls in
all windows.
 
Any help would be appreciated.
 
Thanks!
 
Bob


------=_NextPart_000_0025_01C51349.C450D7E0
Content-Type: text/html;
        charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2800.1491" name=3DGENERATOR></HEAD>
<BODY>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff=20
size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D000192715-15022005></SPAN><FONT face=3DArial><FONT=20
color=3D#0000ff><FONT=20
size=3D2>I&nbsp;found&nbsp;some&nbsp;documentation&nbsp;on&nbsp;the&nbsp;=
use&nbsp;of&nbsp;rc&nbsp;files&nbsp;and&nbsp;think&nbsp;that's&nbsp;the&n=
bsp;way&nbsp;to&nbsp;go,&nbsp;but&nbsp;I&nbsp;still&nbsp;cannot&nbsp;get&=
nbsp;the</FONT></FONT></FONT></DIV>
<DIV><FONT><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT><SPAN=20
class=3D000192715-15022005></SPAN><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2>f<SPAN class=3D000192715-15022005>ont size to=20
change.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>I have an RC file that=20
is:</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>style =
"Application"</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>{</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>&nbsp;&nbsp;&nbsp;=20
font=3D"-*-courier-*-*-*-*-10-*-*-*-*-*-*-*"</SPAN></FONT></FONT></FONT><=
/DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>}</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>In my code I am trying to do this for a =
Dialog base=20
class as&nbsp;a test to get all dialogs which derive from this=20
to</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>change the font =
size.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>I have this as a class=20
definition:</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>class CDialog&nbsp;: public=20
Gtk::Dialog</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>{</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>....</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>};</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>In my constructor, which I verified is being =
run, the=20
gobj() is returning a ptr to the underlying C object, I do=20
this:</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>CDialog::CDialog(....)</SPAN></FONT></FONT></F=
ONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>{</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>&nbsp;&nbsp;&nbsp; GtkDialog * pWidget =3D=20
gobj();</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>&nbsp;&nbsp;&nbsp;=20
gtk_parse_rc(myFilename);</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>&nbsp;&nbsp;&nbsp; =
gtk_widget_set_name((GtkWidget=20
*)pWidget, "Application");</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>...</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>}</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>I have also moved the above code to be just =
before the=20
dialog is shown on the screen (it is loaded=20
invisible).</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>Same =
results:</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>at run time, I get the following assertion=20
failures:</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>fonts.c&nbsp; pango_font_description_get_size =
assertion=20
desc !=3D NULL failed</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>fonts.c&nbsp; pango_font_description_set_size =
assertion=20
desc !=3D NULL failed</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>Gtk::RcStyle::set_font assertion =
font_desc.gobj() !=3D 0=20
failed.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005>Any help would be greatly=20
appreciated!</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D000192715-15022005></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><BR></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
  <HR tabIndex=3D-1>
  <FONT face=3DTahoma size=3D2><B>From:</B> =
glade-users-admin lists ximian com=20
  [mailto:glade-users-admin lists ximian com] <B>On Behalf Of </B>Bob=20
  Huston<BR><B>Sent:</B> Tuesday, February 15, 2005 9:19 =
AM<BR><B>To:</B>=20
  glade-users lists ximian com<BR><B>Subject:</B> [Glade-users] Chaning =
the font=20
  size for an entire application....<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial size=3D2>I =
have an=20
  application running on Linux 9, useing Glade to design the UI, then =
libglade=20
  to load/process</FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial size=3D2>the =
xml. The=20
  backend code is written in C++ using gtkmm.</FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial size=3D2>When =
i design the=20
  UI screens, they are fine. When I load the XML file, then call=20
  get_widget&nbsp; to put the</FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial =
size=3D2>dialogs and=20
  windows and controls onto the screen, they have a totally different =
and much=20
  larger font size</FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial size=3D2>than =
was used=20
  during the glade session for design.</FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial size=3D2>How =
can I change=20
  the font size used by the application at run time? I have found sample =
code to=20
  change </FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial size=3D2>font =

  characteristics for a control, but I need to do it for all controls in =
all=20
  windows.</FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial size=3D2>Any =
help would be=20
  appreciated.</FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial=20
  size=3D2>Thanks!</FONT></SPAN></DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial=20
  size=3D2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=3D704401614-15022005><FONT face=3DArial=20
  size=3D2>Bob</FONT></SPAN></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0025_01C51349.C450D7E0--






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