[gtkada] Font on Win32 cant load MS Sans Serif 8

Michael Bode michael.bode at laserline.de
Fri Nov 26 08:49:44 CET 2004


Mark Gawler schrieb:

>I've written a small GtkAda Application, which works fine under Linux, but
>moving to a Windows NT platform the application runs but continually
>streams out:
>"Couldn't load font "MS Sans Serif 8" falling back to Sans 8"
>  
>

I've read Gtk+ on Windows wants TrueType Fonts. The following solves the problem for me on Win98. For Windows 2000 and XP it is not needed.


Use a resource file. In your code do something like this:
   Gtk.Main.Init;
   Gtk.Rc.Parse ("your_program_name.rc");
    ...

And create your_program_name.rc for Windows like this:

# Text style
style "text"
{
  font_name = "arial"
  text[NORMAL] = { 0.0, 0.0, 0.0 } # black
  fg[NORMAL]   = { 0.0, 0.0, 0.0 } # black
  base[NORMAL] = { 1.0, 1.0, 1.0 } # white : background color
}

# All widgets will have the "text" style
widget "*" style "text"

-- 
Michael Bode





More information about the gtkada mailing list