From 86666507ded9c2dd4d89e21c8694d14eabe6c0d9 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 30 Nov 2000 21:04:52 +0000 Subject: Define PANGO_VERSION. 2000-11-30 Tor Lillqvist * pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION. Changes by Hans Breuer: * pango/pango-layout.c (shape_tab): Add a FIXME comment. * pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp. * pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second fallback location if there is no pango subdir in the Windows directory. * pango/pangowin32-fontmap.c (pango_win32_font_entry_get_coverage): Check if fopen succeeded. * pango/pangowin32-private.h (DEBUGGING): Turn off. * pango/pangowin32.c (pango_win32_unicode_classify): We can in fact get out of the loop. Return invalid value in that case. (subfont_has_glyph): Improve performance a bit. * pango/querymodules.c: Small change for MSVC build. * modules/basic/basic-win32.c (basic_engine_get_coverage): Performance improvement. * examples/viewer-win32.c (main): Disable double buffering on the layout widget. --- ChangeLog | 31 +++++++++++++++++++++++++++++++ ChangeLog.pre-1-0 | 31 +++++++++++++++++++++++++++++++ ChangeLog.pre-1-10 | 31 +++++++++++++++++++++++++++++++ ChangeLog.pre-1-2 | 31 +++++++++++++++++++++++++++++++ ChangeLog.pre-1-4 | 31 +++++++++++++++++++++++++++++++ ChangeLog.pre-1-6 | 31 +++++++++++++++++++++++++++++++ ChangeLog.pre-1-8 | 31 +++++++++++++++++++++++++++++++ examples/viewer-win32.c | 2 ++ modules/basic/basic-win32.c | 43 ++++++++++++++++++++++++++++++++++++++++--- pango/makefile.mingw.in | 2 +- pango/pango-layout.c | 4 ++++ pango/pango-markup.c | 2 +- pango/pango-utils.c | 34 +++++++++++++++++++++++++++++++++- pango/pangowin32-fontmap.c | 15 ++++++++++----- pango/pangowin32-private.h | 2 +- pango/pangowin32.c | 23 ++++++++++++++++++++--- pango/querymodules.c | 8 ++++++++ 17 files changed, 337 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f2d7616..7097893f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2000-11-30 Tor Lillqvist + + * pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION. + + Changes by Hans Breuer: + + * pango/pango-layout.c (shape_tab): Add a FIXME comment. + + * pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp. + + * pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second + fallback location if there is no pango subdir in the Windows + directory. + + * pango/pangowin32-fontmap.c + (pango_win32_font_entry_get_coverage): Check if fopen succeeded. + + * pango/pangowin32-private.h (DEBUGGING): Turn off. + + * pango/pangowin32.c (pango_win32_unicode_classify): We can in + fact get out of the loop. Return invalid value in that case. + (subfont_has_glyph): Improve performance a bit. + + * pango/querymodules.c: Small change for MSVC build. + + * modules/basic/basic-win32.c (basic_engine_get_coverage): + Performance improvement. + + * examples/viewer-win32.c (main): Disable double buffering on the + layout widget. + Wed Nov 29 11:08:52 2000 Owen Taylor * pango/mini-fribidi/fribidi.c pango/mini-fribidi/fribidi-tables.i: diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0 index 1f2d7616..7097893f 100644 --- a/ChangeLog.pre-1-0 +++ b/ChangeLog.pre-1-0 @@ -1,3 +1,34 @@ +2000-11-30 Tor Lillqvist + + * pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION. + + Changes by Hans Breuer: + + * pango/pango-layout.c (shape_tab): Add a FIXME comment. + + * pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp. + + * pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second + fallback location if there is no pango subdir in the Windows + directory. + + * pango/pangowin32-fontmap.c + (pango_win32_font_entry_get_coverage): Check if fopen succeeded. + + * pango/pangowin32-private.h (DEBUGGING): Turn off. + + * pango/pangowin32.c (pango_win32_unicode_classify): We can in + fact get out of the loop. Return invalid value in that case. + (subfont_has_glyph): Improve performance a bit. + + * pango/querymodules.c: Small change for MSVC build. + + * modules/basic/basic-win32.c (basic_engine_get_coverage): + Performance improvement. + + * examples/viewer-win32.c (main): Disable double buffering on the + layout widget. + Wed Nov 29 11:08:52 2000 Owen Taylor * pango/mini-fribidi/fribidi.c pango/mini-fribidi/fribidi-tables.i: diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 1f2d7616..7097893f 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,34 @@ +2000-11-30 Tor Lillqvist + + * pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION. + + Changes by Hans Breuer: + + * pango/pango-layout.c (shape_tab): Add a FIXME comment. + + * pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp. + + * pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second + fallback location if there is no pango subdir in the Windows + directory. + + * pango/pangowin32-fontmap.c + (pango_win32_font_entry_get_coverage): Check if fopen succeeded. + + * pango/pangowin32-private.h (DEBUGGING): Turn off. + + * pango/pangowin32.c (pango_win32_unicode_classify): We can in + fact get out of the loop. Return invalid value in that case. + (subfont_has_glyph): Improve performance a bit. + + * pango/querymodules.c: Small change for MSVC build. + + * modules/basic/basic-win32.c (basic_engine_get_coverage): + Performance improvement. + + * examples/viewer-win32.c (main): Disable double buffering on the + layout widget. + Wed Nov 29 11:08:52 2000 Owen Taylor * pango/mini-fribidi/fribidi.c pango/mini-fribidi/fribidi-tables.i: diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index 1f2d7616..7097893f 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,34 @@ +2000-11-30 Tor Lillqvist + + * pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION. + + Changes by Hans Breuer: + + * pango/pango-layout.c (shape_tab): Add a FIXME comment. + + * pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp. + + * pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second + fallback location if there is no pango subdir in the Windows + directory. + + * pango/pangowin32-fontmap.c + (pango_win32_font_entry_get_coverage): Check if fopen succeeded. + + * pango/pangowin32-private.h (DEBUGGING): Turn off. + + * pango/pangowin32.c (pango_win32_unicode_classify): We can in + fact get out of the loop. Return invalid value in that case. + (subfont_has_glyph): Improve performance a bit. + + * pango/querymodules.c: Small change for MSVC build. + + * modules/basic/basic-win32.c (basic_engine_get_coverage): + Performance improvement. + + * examples/viewer-win32.c (main): Disable double buffering on the + layout widget. + Wed Nov 29 11:08:52 2000 Owen Taylor * pango/mini-fribidi/fribidi.c pango/mini-fribidi/fribidi-tables.i: diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 1f2d7616..7097893f 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,34 @@ +2000-11-30 Tor Lillqvist + + * pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION. + + Changes by Hans Breuer: + + * pango/pango-layout.c (shape_tab): Add a FIXME comment. + + * pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp. + + * pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second + fallback location if there is no pango subdir in the Windows + directory. + + * pango/pangowin32-fontmap.c + (pango_win32_font_entry_get_coverage): Check if fopen succeeded. + + * pango/pangowin32-private.h (DEBUGGING): Turn off. + + * pango/pangowin32.c (pango_win32_unicode_classify): We can in + fact get out of the loop. Return invalid value in that case. + (subfont_has_glyph): Improve performance a bit. + + * pango/querymodules.c: Small change for MSVC build. + + * modules/basic/basic-win32.c (basic_engine_get_coverage): + Performance improvement. + + * examples/viewer-win32.c (main): Disable double buffering on the + layout widget. + Wed Nov 29 11:08:52 2000 Owen Taylor * pango/mini-fribidi/fribidi.c pango/mini-fribidi/fribidi-tables.i: diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 1f2d7616..7097893f 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,34 @@ +2000-11-30 Tor Lillqvist + + * pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION. + + Changes by Hans Breuer: + + * pango/pango-layout.c (shape_tab): Add a FIXME comment. + + * pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp. + + * pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second + fallback location if there is no pango subdir in the Windows + directory. + + * pango/pangowin32-fontmap.c + (pango_win32_font_entry_get_coverage): Check if fopen succeeded. + + * pango/pangowin32-private.h (DEBUGGING): Turn off. + + * pango/pangowin32.c (pango_win32_unicode_classify): We can in + fact get out of the loop. Return invalid value in that case. + (subfont_has_glyph): Improve performance a bit. + + * pango/querymodules.c: Small change for MSVC build. + + * modules/basic/basic-win32.c (basic_engine_get_coverage): + Performance improvement. + + * examples/viewer-win32.c (main): Disable double buffering on the + layout widget. + Wed Nov 29 11:08:52 2000 Owen Taylor * pango/mini-fribidi/fribidi.c pango/mini-fribidi/fribidi-tables.i: diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 1f2d7616..7097893f 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,34 @@ +2000-11-30 Tor Lillqvist + + * pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION. + + Changes by Hans Breuer: + + * pango/pango-layout.c (shape_tab): Add a FIXME comment. + + * pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp. + + * pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second + fallback location if there is no pango subdir in the Windows + directory. + + * pango/pangowin32-fontmap.c + (pango_win32_font_entry_get_coverage): Check if fopen succeeded. + + * pango/pangowin32-private.h (DEBUGGING): Turn off. + + * pango/pangowin32.c (pango_win32_unicode_classify): We can in + fact get out of the loop. Return invalid value in that case. + (subfont_has_glyph): Improve performance a bit. + + * pango/querymodules.c: Small change for MSVC build. + + * modules/basic/basic-win32.c (basic_engine_get_coverage): + Performance improvement. + + * examples/viewer-win32.c (main): Disable double buffering on the + layout widget. + Wed Nov 29 11:08:52 2000 Owen Taylor * pango/mini-fribidi/fribidi.c pango/mini-fribidi/fribidi-tables.i: diff --git a/examples/viewer-win32.c b/examples/viewer-win32.c index 6ecb41c9..41905fca 100644 --- a/examples/viewer-win32.c +++ b/examples/viewer-win32.c @@ -687,6 +687,8 @@ main (int argc, char **argv) gtk_signal_connect (GTK_OBJECT (layout), "button_press_event", GTK_SIGNAL_FUNC (button_press), paragraphs); + gtk_widget_set_double_buffered (layout, FALSE); + gtk_container_add (GTK_CONTAINER (scrollwin), layout); frame = gtk_frame_new (NULL); diff --git a/modules/basic/basic-win32.c b/modules/basic/basic-win32.c index a6a4b036..81b0b746 100644 --- a/modules/basic/basic-win32.c +++ b/modules/basic/basic-win32.c @@ -98,6 +98,9 @@ find_char (PangoFont *font, subrange = pango_win32_unicode_classify (wc); + if (PANGO_WIN32_U_LAST_PLUS_ONE == subrange) + return 0; + n_subfonts = pango_win32_list_subfonts (font, subrange, &subfonts); for (i = 0; i < n_subfonts; i++) @@ -254,10 +257,44 @@ basic_engine_get_coverage (PangoFont *font, { PangoCoverage *result = pango_coverage_new (); gunichar wc; + gint found = 0; + gint tested = 0; + gint irange = 0; + gunichar last; +#if DEBUGGING + GTimeVal tv0, tv1; + g_get_current_time (&tv0); +#endif + + for (irange = 0; irange < G_N_ELEMENTS(basic_ranges); irange++) + { + for (wc = basic_ranges[irange].start; wc <= basic_ranges[irange].end; wc++) + { + if (find_char (font, wc)) + { + pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); + found++; + last = wc; + } + tested++; + } + } - for (wc = 0; wc < 65536; wc++) - if (find_char (font, wc)) - pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); +#if DEBUGGING + { + PangoFontDescription *desc = pango_font_describe(font); + + g_get_current_time (&tv1); + if (tv1.tv_usec < tv0.tv_usec) + tv1.tv_sec--, tv1.tv_usec += 1000000L; + g_print ("\"%s\" (%d) found: %d tested: %d last: %d time: %ld.%06ld s\n", + desc->family_name, desc->weight, + found, tested, last, + tv1.tv_sec - tv0.tv_sec, tv1.tv_usec - tv0.tv_usec); + + pango_font_description_free (desc); + } +#endif return result; } diff --git a/pango/makefile.mingw.in b/pango/makefile.mingw.in index aa9b3a2f..b27ed386 100644 --- a/pango/makefile.mingw.in +++ b/pango/makefile.mingw.in @@ -8,7 +8,7 @@ PANGO_VER = @VERSION@ OPTIMIZE = -g -Wall INCLUDES = -I .. -I . -DEFINES = +DEFINES = -DPANGO_VERSION=\"$(PANGO_VER)\" DEPCFLAGS = $(GLIB_CFLAGS) $(LIBICONV_CFLAGS) $(FRIBIDI_CFLAGS) $(FREETYPE2_CFLAGS) all : \ diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 838c9830..4edb2da4 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2100,6 +2100,10 @@ shape_tab (PangoLayoutLine *line, glyphs->log_clusters[0] = 0; + /* FIXME: this is making an endless loop under certain continditions. + * It happens with get_tab_pos () returning 0, cause there are no tabs. + * HB: condition (i < line->layout->length) seems *not* to fix it. + */ for (i=0;;i++) { int tab_pos = get_tab_pos (line->layout, i); diff --git a/pango/pango-markup.c b/pango/pango-markup.c index 9677b6b5..b6cbe2e7 100644 --- a/pango/pango-markup.c +++ b/pango/pango-markup.c @@ -2143,7 +2143,7 @@ static ColorEntry xColors[] = { static int compare_xcolor_entries (const void *a, const void *b) { - return strcasecmp ((const char *) a, ((const ColorEntry *) b)->name); + return g_strcasecmp ((const char *) a, ((const ColorEntry *) b)->name); } static gboolean diff --git a/pango/pango-utils.c b/pango/pango-utils.c index b243f7be..91b50d80 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -41,6 +41,12 @@ #ifdef G_OS_WIN32 +#include +#include +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode)&_S_IFDIR) +#endif + #define STRICT #include @@ -618,7 +624,12 @@ pango_get_sysconf_subdirectory (void) /* On Windows we don't hardcode any paths (SYSCONFDIR) in the DLL, * but rely on an installation program to store the installation * directory in the registry. If no installation program has been - * used, punt and assume the Pango directory is %WINDIR%\Pango. + * used, assume the Pango directory is %WINDIR%\Pango. + * + * If the latter doesn't exist either, fall back to the directory + * the pango-$PANGO_VERSION.dll comes from, to stop polluting + * neither the Registry nor the windows directory (which may be + * write protected with Win2K anyway). */ static gboolean been_here = FALSE; @@ -627,6 +638,7 @@ pango_get_sysconf_subdirectory (void) HKEY reg_key = NULL; DWORD type; DWORD nbytes = sizeof (pango_sysconf_dir); + struct stat st; if (been_here) return pango_sysconf_dir; @@ -642,6 +654,26 @@ pango_get_sysconf_subdirectory (void) /* Uh oh. Use %WinDir%\Pango */ GetWindowsDirectory (win_dir, sizeof (win_dir)); sprintf (pango_sysconf_dir, "%s\\pango", win_dir); + + if (!stat (pango_sysconf_dir, &st) || !S_ISDIR (st.st_mode)) + { + /* Oops. %WinDir%\pango does not exist */ + HMODULE hm = NULL; + gchar* libname = g_strdup_printf ("pango-%s.dll", PANGO_VERSION); + hm = GetModuleHandle (libname); + if (!hm) + g_warning ("Can't find myself (%s)", libname); + else + { + GetModuleFileName (hm, + pango_sysconf_dir, + sizeof(pango_sysconf_dir)); + /* strip dll name */ + if (strrchr (pango_sysconf_dir, '\\')) + *strrchr (pango_sysconf_dir, '\\') = 0; + } + g_free (libname); + } } if (reg_key != NULL) diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index 83ce9454..9ad3999e 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -1397,12 +1397,17 @@ pango_win32_font_entry_get_coverage (PangoWin32FontEntry *entry, g_hash_table_destroy (coverage_hash); cache_file = fopen (cache_file_name, "wb"); - pango_coverage_to_bytes (result, &buf, &buflen); - PING (("saving %d bytes to %s", buflen, cache_file_name)); - fwrite (buf, buflen, 1, cache_file); - fclose (cache_file); + if (cache_file) + { + pango_coverage_to_bytes (result, &buf, &buflen); + PING (("saving %d bytes to %s", buflen, cache_file_name)); + fwrite (buf, buflen, 1, cache_file); + fclose (cache_file); + g_free (buf); + } + else + g_warning ("Unable to open %s for writing", cache_file_name); g_free (cache_file_name); - g_free (buf); } entry->coverage = result; diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h index 596f7a92..0fc0dd94 100644 --- a/pango/pangowin32-private.h +++ b/pango/pangowin32-private.h @@ -23,7 +23,7 @@ #ifndef __PANGOWIN32_PRIVATE_H__ #define __PANGOWIN32_PRIVATE_H__ -#define DEBUGGING 1 +#define DEBUGGING 0 #if defined(DEBUGGING) && DEBUGGING #ifdef __GNUC__ diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 2b457f4c..5c434a7a 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -557,8 +557,7 @@ pango_win32_unicode_classify (wchar_t wc) else return -1; } - /* NOTREACHED */ - return 0; + return PANGO_WIN32_U_LAST_PLUS_ONE; } static void @@ -989,13 +988,18 @@ subfont_has_glyph (PangoFont *font, { TEXTMETRIC tm; PangoWin32Font *win32font = (PangoWin32Font *) font; + PangoWin32UnicodeSubrange subrange; wchar_t default_wc; #ifdef HEAVY_DEBUGGING static int dispx = 5, dispy = 0; #endif + subrange = pango_win32_unicode_classify (wc); + if (PANGO_WIN32_U_LAST_PLUS_ONE == subrange) + return FALSE; + if (!pango_win32_logfont_has_subrange (win32font->fontmap, &info->logfont, - pango_win32_unicode_classify (wc))) + subrange)) return FALSE; if (info->buf_hbm == NULL) @@ -1044,6 +1048,19 @@ subfont_has_glyph (PangoFont *font, SelectObject (info->buf_hdc, info->buf_hbm); } + +#if 0 /* This doesn't work either */ + /* GetTextMetricsW unsupported on Win9x, questionable results + * on NT 4.0 + */ + if (GetTextMetricsW (info->buf_hdc, &tmw) + && ((tmw.tmLastChar < wc) || (wc < tmw.tmFirstChar))) + { + //g_print("ShortCut %d %d %d\n", wc, tmw.tmFirstChar, tmw.tmLastChar); + return FALSE; + } +#endif + /* Draw character into our bitmap; compare with the bitmap for * the default character. If they are identical, this character * does not exist in the font. diff --git a/pango/querymodules.c b/pango/querymodules.c index 6d8b3210..7ce2feb5 100644 --- a/pango/querymodules.c +++ b/pango/querymodules.c @@ -38,6 +38,14 @@ #ifdef G_OS_WIN32 #define SOEXT ".dll" +#ifndef PATH_MAX +#include +#define PATH_MAX _MAX_PATH +#endif /* PATH_MAX */ +#ifdef _MSC_VER +#include +#define getcwd _getcwd +#endif #else #define SOEXT ".so" #endif -- cgit v1.2.1