Ethereal-dev: Re: [Ethereal-dev] Made a lot of GUI changes today!

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 9 Feb 2004 13:50:53 -0800

On Feb 9, 2004, at 11:38 AM, Ulf Lamping wrote:

Yesterday I did some tests on my old notebook, about this system font size topic:

GTK1 on Win98: ok (smaller system fonts than "before",just like it should be) GTK2 on Win98: doesn't use the smaller system fonts (just like "before")

GTK1 on WinNT4: very small system font (like you describe)
GTK2 on WinNT4: doesn't use the smaller system fonts (just like "before")

So it seems, that the GTK2 port doesn't really uses this settings on the "old platform". Maybe some function is used, that isn't implemented on the "older platforms".

Different code is used to get the font when using GTK+ 1.2[.x] and 2.x.

The 1.2[.x] code does

    h_dc = CreateDC("DISPLAY", NULL, NULL, NULL);
    if (h_dc == NULL) return 1;
    h_font = GetStockObject(DEFAULT_GUI_FONT);
    if (h_font == NULL || !SelectObject(h_dc, h_font)) {
        DeleteDC(h_dc);
        return 1;
    }
    len = GetTextFace(h_dc, NAME_BUFFER_LEN, name);
    if (len <= 0) {
        DeleteDC(h_dc);
        return 1;
    }
    if (!GetTextMetrics(h_dc, &tm)) {
        DeleteDC(h_dc);
        return 1;
    }
    pix_height = tm.tmHeight;
    DeleteDC(h_dc);
    sprintf(fontspec, "-*-%s-*-*-*-*-%i-*-*-*-p-*-iso8859-1", name,
            pix_height);

and the 2.x code does

if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0)) {
        HDC screen = GetDC(0);
        double y_scale = 72.0 / GetDeviceCaps(screen, LOGPIXELSY);
        int point_size = (int) (ncm.lfMenuFont.lfHeight * y_scale);

        if (point_size < 0) point_size = -point_size;
        fontspec = g_strdup_printf("%s %d", ncm.lfMenuFont.lfFaceName,
                                   point_size);
        ReleaseDC(0, screen);
    }

The page on MSDN about SystemParametersInfo() doesn't seem to be saying anything to indicate that it doesn't work in pre-NT 5.0 systems.

It might, however, be an issue of the calls that GTK+ 2.x is using.