Re: gtk/quartz default font woe, and gtk-font-name



Just a partial answer to my own 2nd question - Monodevelop's 
main/src/core/MonoDevelop.Ide/MonoDevelop.Components/IdeTheme.cs
contains this cryptic comment:

//HACK: we must initilize some Gtk rc before Gtk.Application is initialized on Mac/Windows
//      otherwise it will not be loaded correctly and theme switching won't work.

This suggests that it is known not to work by some of the Xamarin folks... I don't know whether it is 
gtk/quartz or gtk-sharp, but that at least suggests some workaround is needed.

--------------------------------------------
On Wed, 22/6/16, Hin-Tak Leung <htl10 users sourceforge net> wrote:

 Subject: gtk/quartz default font woe, and gtk-font-name
 To: gtk-devel-list gnome org, "Richard Hult" <richard imendio com>
 Date: Wednesday, 22 June, 2016, 19:03
 
 I have been staring at this
 particular section of code for a few days, and seem to be
 having problem with it:
 
 -----
 https://github.com/GNOME/gtk/commit/f3a6fecb671a2aec691940c9e1b74c7f11e15930
 
 Try setting the default font, might need to tweak this.
 
 2008-05-26  Richard Hult  <richard imendio com>
 
     * gdk/quartz/gdkevents-quartz.c:
 (gdk_screen_get_setting): Try
     setting the default font, might need to
 tweak this.
 
 svn path=/trunk/; revision=20181
 -----
 
 What I have is this error and this stack dump - which seems
 to come from "name = [[NSFont systemFontOfSize:0]
 familyName];" - 
 although the message is somewhat different, but there is
 only one thing in gdk_screen_get_setting which does fonts,
 so that must be it -
 I think __NSGetMetaFontInstance is some sort of backend code
 to "[[NSFont systemFontOfSize:0] familyName]".
 
  -[__NSCFType symbolicTraits]: unrecognized selector sent to
 instance 0x7c9a7000
 ---
 
 
        
 0   CoreFoundation       
               0x9569c471
 __raiseError + 193
        
 1   libobjc.A.dylib     
            
    0x92ad6091 objc_exception_throw + 162
        
 2   CoreFoundation       
               0x956a0cb3
 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
        
 3   CoreFoundation       
               0x955ec522
 ___forwarding___ + 1010
        
 4   CoreFoundation       
               0x955ec10e
 _CF_forwarding_prep_0 + 14
         5   AppKit 
                
             0x90dfee7e
 -[__NSFontTypefaceInfo _postscriptName] + 331
         6   AppKit 
                
             0x90dfe86e
 +[__NSFontTypefaceInfo typefaceInfoForPostscriptName:] +
 914
         7   AppKit 
                
             0x90dfddf5
 __NSGetMetaFontInstance + 592
        
 8   libgdk-quartz-2.0.0.dylib   
        0x0732befa
 gdk_screen_get_setting + 474
        
 9   libgtk-quartz-2.0.0.dylib   
        0x08ac31d6
 gtk_settings_get_property + 438
         10 
 libgobject-2.0.0.dylib         
     0x0782af08 object_get_property + 248
         11 
 libgobject-2.0.0.dylib         
     0x0782ab02 g_object_get_valist + 658
         12 
 libgobject-2.0.0.dylib         
     0x0782b115 g_object_get + 245
         13 
 libgtk-quartz-2.0.0.dylib       
    0x08a7894a gtk_rc_context_get + 314
         14 
 libgtk-quartz-2.0.0.dylib       
    0x08a78e9d gtk_rc_reparse_all_for_settings
 + 285
         15 
 libgtk-quartz-2.0.0.dylib       
    0x08abad27 gtk_settings_get_for_screen +
 423
         16 
 libgtk-quartz-2.0.0.dylib       
    0x08abafb6 gtk_settings_get_default + 38
         17 
 libgtk-quartz-2.0.0.dylib       
    0x08ada27b gtk_style_init + 27
         18 
 libgobject-2.0.0.dylib         
     0x07847f3e g_type_create_instance + 558
         19 
 libgobject-2.0.0.dylib         
     0x07829c44 g_object_constructor + 36
         20 
 libgobject-2.0.0.dylib         
     0x07828fc2 g_object_newv + 354
         21 
 libgobject-2.0.0.dylib         
     0x07828e1d g_object_new + 157
         22 
 libgtk-quartz-2.0.0.dylib       
    0x08ada993 gtk_style_new + 35
         23 
 libgtk-quartz-2.0.0.dylib       
    0x08c144f4 gtk_widget_get_default_style +
 36
         24 
 libgtk-quartz-2.0.0.dylib       
    0x08c06b5e gtk_widget_init + 478
         25 
 libgobject-2.0.0.dylib         
     0x07847ed9 g_type_create_instance + 457
         26 
 libgobject-2.0.0.dylib         
     0x07829c44 g_object_constructor + 36
         27 
 libgobject-2.0.0.dylib         
     0x078293af g_object_newv + 1359
         28 
 libglibsharpglue-2.so         
      0x07588e64 gtksharp_object_newv +
 228
 ---
 
 FWIW, I am trying to embed a gtk scrolledwindow inside a
 carbon application. The gtk scrolledwindow in turn, has
 another foreign Cocoa widget inside.
 
 I mainly have two questions:
 
 - I think the error I am seeing is that a "strange"
 non-Cocoa window doesn't let me get at Cocoa's default NS
 system fonts. I am tempted to reverse that patch (and
 hard-coding a particular font name) to see if I am right. Is
 there any caveate for trying to do that, or is there a
 better way of improving this change? or is there any way I
 can give my widget more of a Cocoa attributes/properties to
 make it happen? The problem is that the error is happening
 at gtk_widget_init, and I am at a loss at how I can insert
 anything "earlier" than the constructor.
 
 - supposedly setting "gtk-font-name" should bypass that code
 - but I ran dtruss against my app and it never tried to read
 ~/.gtkrc-20, any of the rc files in the gtk directory, etc.
 Is that a known quirk of gtk/quartz ? That it ignores
 ~/.gtkrc, GTK2_RC_FILES and friends? I don't think that's
 always the case since Monodevelop and Banshee both ships
 some sort of theming rc's. But it just seem that
 gtk_widget_init then gtk_style_init, never read those files,
 for some reason? this behavior seems to be poorly
 documented.
 (you can probably tell from that gtksharp_object_newv I am
 using gtksharp).


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