kbluck
09-22-2008, 05:42 AM
I think I'm almost there with my changes to enable third-party windowing library integration as described in the "Clanlib on Fltk", but I've run into one final roadblock that I need some consensus on.
I found that the CL_GraphicContext class has a Win32-only accessor: HDC get_drawable(). This is a bit of a problem for me, since I've been busily eliminating explicit references to the underlying platform-specific handles supplied by the window provider types in favor of a generic interface that can wrap other third-party providers. Now, I could hack in special support for this by requiring that adapter type to be able to provide an HDC on Win32, but it seems kludgy.
I've determined that the only place this special accessor is used appears to be in Win32 native font support. Creating fonts via Win32 API requires a DC. The problem is, this introduces a platform dependency and an assumption that there is a particular kind of window provider underneath. So, I'm trying to see if there's a way around this without having to hack in platform-specific accessors into what should be a platform-agnostic type.
My first thought is: since Clanlib is already using FreeType on Linux, is there any reason we don't want to just use FreeType all around for native fonts? In addition to solving my little problem, it would also have the advantage of helping to standardize font parameters and rendering; given the same TTF and parameters, fonts should come out much more consistently across platforms if it was always FreeType doing the rendering. We were actually just talking about getting away from Win32-specific font conventions in the "Linux Fonts" thread.
So, does using FreeType on Win32 as well as Linux/Mac seem like a good idea?
--- Kevin
I found that the CL_GraphicContext class has a Win32-only accessor: HDC get_drawable(). This is a bit of a problem for me, since I've been busily eliminating explicit references to the underlying platform-specific handles supplied by the window provider types in favor of a generic interface that can wrap other third-party providers. Now, I could hack in special support for this by requiring that adapter type to be able to provide an HDC on Win32, but it seems kludgy.
I've determined that the only place this special accessor is used appears to be in Win32 native font support. Creating fonts via Win32 API requires a DC. The problem is, this introduces a platform dependency and an assumption that there is a particular kind of window provider underneath. So, I'm trying to see if there's a way around this without having to hack in platform-specific accessors into what should be a platform-agnostic type.
My first thought is: since Clanlib is already using FreeType on Linux, is there any reason we don't want to just use FreeType all around for native fonts? In addition to solving my little problem, it would also have the advantage of helping to standardize font parameters and rendering; given the same TTF and parameters, fonts should come out much more consistently across platforms if it was always FreeType doing the rendering. We were actually just talking about getting away from Win32-specific font conventions in the "Linux Fonts" thread.
So, does using FreeType on Win32 as well as Linux/Mac seem like a good idea?
--- Kevin