From 7df755b181f4e9b8436a78d29fffc89ed767cc03 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 12 Dec 1999 01:32:53 +0000 Subject: [PATCH] More tweaks. Check only if at least one of those Unicode subrange bits we 1999-12-11 Tor Lillqvist * gdk/win32/gdkfont-win32.c (check_unicode_subranges): More tweaks. Check only if at least one of those Unicode subrange bits we care for is set. If no code page bits are set, guess (wildly) based on the charset. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gdk/win32/gdkfont-win32.c | 27 +++++++++++++++++---------- 8 files changed, 52 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40737f352b..99af5ca197 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,11 @@ * gdk/win32/makefile.msc: Update. + * gdk/win32/gdkfont-win32.c (check_unicode_subranges): More + tweaks. Check only if at least one of those Unicode subrange bits + we care for is set. If no code page bits are set, guess (wildly) + based on the charset. + * gdk/win32/gdkinput-win32.c: Remove debugging leftover. * gdk/win32/gdkwindow-win32.c (gdk_window_new): Assure title is diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 40737f352b..99af5ca197 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -15,6 +15,11 @@ * gdk/win32/makefile.msc: Update. + * gdk/win32/gdkfont-win32.c (check_unicode_subranges): More + tweaks. Check only if at least one of those Unicode subrange bits + we care for is set. If no code page bits are set, guess (wildly) + based on the charset. + * gdk/win32/gdkinput-win32.c: Remove debugging leftover. * gdk/win32/gdkwindow-win32.c (gdk_window_new): Assure title is diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 40737f352b..99af5ca197 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -15,6 +15,11 @@ * gdk/win32/makefile.msc: Update. + * gdk/win32/gdkfont-win32.c (check_unicode_subranges): More + tweaks. Check only if at least one of those Unicode subrange bits + we care for is set. If no code page bits are set, guess (wildly) + based on the charset. + * gdk/win32/gdkinput-win32.c: Remove debugging leftover. * gdk/win32/gdkwindow-win32.c (gdk_window_new): Assure title is diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 40737f352b..99af5ca197 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -15,6 +15,11 @@ * gdk/win32/makefile.msc: Update. + * gdk/win32/gdkfont-win32.c (check_unicode_subranges): More + tweaks. Check only if at least one of those Unicode subrange bits + we care for is set. If no code page bits are set, guess (wildly) + based on the charset. + * gdk/win32/gdkinput-win32.c: Remove debugging leftover. * gdk/win32/gdkwindow-win32.c (gdk_window_new): Assure title is diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 40737f352b..99af5ca197 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -15,6 +15,11 @@ * gdk/win32/makefile.msc: Update. + * gdk/win32/gdkfont-win32.c (check_unicode_subranges): More + tweaks. Check only if at least one of those Unicode subrange bits + we care for is set. If no code page bits are set, guess (wildly) + based on the charset. + * gdk/win32/gdkinput-win32.c: Remove debugging leftover. * gdk/win32/gdkwindow-win32.c (gdk_window_new): Assure title is diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 40737f352b..99af5ca197 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -15,6 +15,11 @@ * gdk/win32/makefile.msc: Update. + * gdk/win32/gdkfont-win32.c (check_unicode_subranges): More + tweaks. Check only if at least one of those Unicode subrange bits + we care for is set. If no code page bits are set, guess (wildly) + based on the charset. + * gdk/win32/gdkinput-win32.c: Remove debugging leftover. * gdk/win32/gdkwindow-win32.c (gdk_window_new): Assure title is diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 40737f352b..99af5ca197 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -15,6 +15,11 @@ * gdk/win32/makefile.msc: Update. + * gdk/win32/gdkfont-win32.c (check_unicode_subranges): More + tweaks. Check only if at least one of those Unicode subrange bits + we care for is set. If no code page bits are set, guess (wildly) + based on the charset. + * gdk/win32/gdkinput-win32.c: Remove debugging leftover. * gdk/win32/gdkwindow-win32.c (gdk_window_new): Assure title is diff --git a/gdk/win32/gdkfont-win32.c b/gdk/win32/gdkfont-win32.c index e64c3f95d2..dce4e0774c 100644 --- a/gdk/win32/gdkfont-win32.c +++ b/gdk/win32/gdkfont-win32.c @@ -517,7 +517,8 @@ typedef enum U_SMALL_FORM_VARIANTS = 66, U_ARABIC_PRESENTATION_FORMS_B = 67, U_SPECIALS = 69, - U_HALFWIDTH_AND_FULLWIDTH_FORMS = 68 + U_HALFWIDTH_AND_FULLWIDTH_FORMS = 68, + U_LAST_PLUS_ONE } unicode_subset; static struct { @@ -696,18 +697,19 @@ static gboolean check_unicode_subranges (UINT charset, FONTSIGNATURE *fsp) { + gint i; gboolean retval = FALSE; - /* If the fsUsb bit array has some bits set, trust it */ - if (fsp->fsUsb[0] || fsp->fsUsb[1] || fsp->fsUsb[2] || fsp->fsUsb[3]) - return FALSE; + /* If the fsUsb bit array has at least one of the bits set, trust it */ + for (i = 0; i < U_LAST_PLUS_ONE; i++) + if (i != U_PRIVATE_USE_AREA && (fsp->fsUsb[i/32] & (1 << (i % 32)))) + return FALSE; /* Otherwise, guess what subranges there should be in the font */ fsp->fsUsb[0] = fsp->fsUsb[1] = fsp->fsUsb[2] = fsp->fsUsb[3] = 0; #define set_bit(bitno) (fsp->fsUsb[(bitno)/32] |= (1 << ((bitno) % 32))) -#if 1 /* Set Unicode subrange bits based on code pages supported. * This is mostly just guesswork. */ @@ -868,10 +870,16 @@ check_unicode_subranges (UINT charset, set_bit (U_LATIN_1_SUPPLEMENT); retval = TRUE; } -#else - /* Guess based on charset. These somewhat optimistic guesses are - * based on the table in Appendix M in the book "Developing ..." - * mentioned above. + + if (retval) + return TRUE; + + GDK_NOTE (MISC, g_print ("... No code page bits set!\n")); + + /* Sigh. Not even any code page bits were set. Guess based on + * charset, then. These somewhat optimistic guesses are based on the + * table in Appendix M in the book "Developing ..." mentioned + * above. */ switch (charset) { @@ -1101,7 +1109,6 @@ check_unicode_subranges (UINT charset, retval = TRUE; break; } -#endif #undef set_bit return retval;