Hello, WINE developers!
While working on a cross-platform project, I tried to run some self-compiled GTK/W32 applications on a Debian GNU/Linux Sarge system using WINE 0.9.29, compiled from source. They crashed immediately.
After some long, but unsuccessful Google sessions and some long, but successful RTFS/debugging sessions, I am now able to run and test my cross-compiled GTK/W32 applications in WINE. :-)
Furthermore, I can start the W32 version of The GIMP up to the moment where it tries to load its plug-ins. (Without the plug-ins, the remaining parts of The GIMP even seem to work flawlessly.)
Since Google told me that running GTK/W32 applications in WiNE - in particular: The GIMP - was an unsolved problem, I am hereby telling you what I observed and what I did.
* Out of the box, pango (GTK's font renderer) does not find any suitable font.
OTOH a non-GTK program, opening a MessageBox, works flawlessly, so the fonts are there.
* When I tell pango to use a TrueType font *and* place the .ttf file in c:/windows/fonts/, I can start GTK's "Hello, world!" program, but the text is >300 pixels high, and thus unusable.
(Real-world programs used to crash with a message similar to "memory exhausted", but trying to reproduce the exact message now results in *running* programs with a giant font. Sorry.)
I conclude that (at least in my installation) pango does not find WINE's pixel fonts (even if I place them in c:/windows/fonts/), and sees the TTFs only with a wrong scaling factor.
* When I tell pango to use the font "Sans 0.1", I get satisfying results.
(In concrete, I got it working with the following gtkrc:
style "wine-default-style" { font_name = "Sans 0.1" }
widget "*" style "wine-default-style"
)
I cannot fine-tune the font size. Using "Sans 0.2" or "Sans 0.01" yields exactly the same as "Sans 0.1". There seems to be one more intermediate size at "Sans 0.5"; after that the "normal" font sizes start with "Sans 1".
Since both WINE and pango/GTK are free software, I am confident that these problems will be solved in the long run. I hope that you can use my observations.
BTW, let me thank you for over 10 years of WINE by hacking Tom Payne's famous quote on Unix:
Ten years ago mainstream users were choosing WABI over WINE. Now they are choosing $PROPRIETARY_FORK_OF_WINE over WINE. What part of that message aren't they getting?
Keep on your excellent work!
Cheers,
Peter
On Sunday 14 January 2007 22:30, Peter Gerwinski wrote:
Since both WINE and pango/GTK are free software, I am confident that these problems will be solved in the long run. I hope that you can use my observations.
Thank you for your elaborate diagnosis. This is probably related to the problem Mono has on Wine because it also uses Pango/GTK. Does it help if you install MS core fonts?
http://sourceforge.net/project/showfiles.php?group_id=34153&package_id=5...
It would be good if you could put your findings in a bug in Bugzilla (there may already exist a bug for this, otherwise you can open a new one).
-Hans
Hallo, Hans!
You wrote:
Thank you for your elaborate diagnosis. This is probably related to the problem Mono has on Wine because it also uses Pango/GTK. Does it help if you install MS core fonts?
I tried, but it did not help.
Cheers,
Peter
Hello!
Thank you for your elaborate diagnosis. This is probably related to the problem Mono has on Wine because it also uses Pango/GTK.
It seems as if this is not a problem with GTK or Pango but with cairo. GTK-2.6 (without cairo) works fine on wine. Here is a minimal cairo-win32 example basing uppon code from Owen Taylor:
/* * This example code is placed in the public domain * * Author: Owen Taylor otaylor@redhat.com, Red Hat Inc. */
#include <cairo-win32.h>
#define TITLE TEXT("Cairo test") #define BORDER_WIDTH 75. #define SNIPPET_WIDTH 300. #define SNIPPET_HEIGHT 300. #define FONT_SIZE 24
static void on_paint (HDC hdc) { cairo_surface_t *surface; cairo_t *cr; double line_width; cairo_font_extents_t font_extents;
surface = cairo_win32_surface_create (hdc); cr = cairo_create (surface);
line_width = cairo_get_line_width (cr);
/* Draw a box bordering the snippet */ cairo_rectangle (cr, BORDER_WIDTH - line_width / 2, BORDER_WIDTH - line_width / 2, SNIPPET_WIDTH + line_width, SNIPPET_WIDTH + line_width); cairo_stroke (cr);
/* And some text */ cairo_select_font_face (cr, "Arial", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size (cr, FONT_SIZE); cairo_font_extents (cr, &font_extents);
cairo_move_to (cr, BORDER_WIDTH, BORDER_WIDTH + SNIPPET_WIDTH + font_extents.ascent); cairo_show_text (cr, "This is some example text!");
cairo_destroy (cr); cairo_surface_destroy (surface); }
/* The WinMain and window procedure are loosely based on a example * from the Microsoft documentation. */ LRESULT CALLBACK WndProc (HWND window, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT paint_struct; HDC dc;
switch(message) { case WM_CHAR: switch (wParam) { case 'q': case 'Q': PostQuitMessage (0); return 0; break; } break; case WM_PAINT: dc = BeginPaint (window, &paint_struct); on_paint (dc); EndPaint (window, &paint_struct); return 0; case WM_DESTROY: PostQuitMessage (0); return 0; default: ; }
return DefWindowProc (window, message, wParam, lParam); }
#define WINDOW_STYLE WS_OVERLAPPEDWINDOW & ~(WS_MAXIMIZEBOX | WS_THICKFRAME)
INT WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT iCmdShow) { HWND window; MSG message; WNDCLASS window_class; RECT rect;
window_class.style = CS_HREDRAW | CS_VREDRAW; window_class.lpfnWndProc = WndProc; window_class.cbClsExtra = 0; window_class.cbWndExtra = 0; window_class.hInstance = hInstance; window_class.hIcon = LoadIcon (NULL, IDI_APPLICATION); window_class.hCursor = LoadCursor (NULL, IDC_ARROW); window_class.hbrBackground = (HBRUSH)GetStockObject (WHITE_BRUSH); window_class.lpszMenuName = NULL; window_class.lpszClassName = TITLE;
RegisterClass (&window_class);
/* Compute the window size to give us the desired client area */ rect.left = 0; rect.top = 0; rect.right = SNIPPET_WIDTH + 2 * BORDER_WIDTH; rect.bottom = SNIPPET_WIDTH + 2 * BORDER_WIDTH;
AdjustWindowRect (&rect, WINDOW_STYLE, FALSE /* no menu */);
window = CreateWindow (TITLE, /* Class name */ TITLE, /* Window name */ WINDOW_STYLE, CW_USEDEFAULT, CW_USEDEFAULT, /* initial position */ rect.right - rect.left, rect.bottom - rect.top, /* initial size */ NULL, /* Parent */ NULL, /* Menu */ hInstance, NULL); /* WM_CREATE lpParam */
ShowWindow (window, iCmdShow); UpdateWindow (window);
while (GetMessage (&message, NULL, 0, 0)) { TranslateMessage (&message); DispatchMessage (&message); }
return message.wParam; }
/************/
The font output isn't corrent -- see [1] and [2] as reference.
[1] http://gordon.cip.physik.uni-saarland.de/~oleid/cairo-wine.png [2] http://gordon.cip.physik.uni-saarland.de/~oleid/cairo-win32.png