[Gtk-sharp-list] Gtk.TextView.ModifyFont Questions
Jeremiah McElroy
jeremiah@facility9.com
Thu, 22 Jan 2004 12:34:16 -0500
I am working on a simple text editor (entirely for my own edification)
that contains a TextView (named TVMain) in a ScrolledWindow.
I have created a FontSelectionDialog (named GetNewFont) and I am using
FontSelectionDialog.Run() to return a response which is parsed into a
Gtk.ResponseType. When the ResponseType is set to ResponseType.Ok, the
program attempts to change the font. When I do something like this:
string newFont = GetNewFont.FontName;
Pango.FontDescription fontdesc = new Pango.FontDescription();
fontdesc.Family = newFont;
TVMain.ModifyFont (fontdesc);
The font is correctly changed, but the size is not effected. If I parse
the font size out of the string, usually in the form of 'Monospace 12'
and set it through the following:
int fontsize;
// some code to parse out the font size from the font string
Pango.FontDescription fontdesc = new Pango.FontDescription();
fontdesc.Family = newFont;
fontdesc.Size = fontsite;
TVMain.ModifyFont (fontdesc);
The font appears to change, but I can't tell for sure because the font
size gets set to either 1 or 2 px, I'm not entirely sure because it's tiny.
Any help would be appreciated.
Jeremiah McElroy
--
There is no Freedom on Earth or in Any Star for those who deny Freedom to Others
-- Elbert Hubbard