From c44718c43a88b0d2655cf98ffb580e9a801f6c45 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 28 Feb 2006 21:57:33 +0000 Subject: pango/pangowin32-private.h (PING) pango/pangowin32.c Use g_print() instead 2006-02-28 Tor Lillqvist * pango/pangowin32-private.h (PING) * pango/pangowin32.c * modules/basic/basic-win32.c: Use g_print() instead of printf() for debugging output, to enable easy redirection using GLib facilities. (#332855) --- ChangeLog | 8 ++++ modules/basic/basic-win32.c | 92 ++++++++++++++++++++++----------------------- pango/pangowin32-private.h | 12 +++--- pango/pangowin32.c | 36 +++++++++--------- 4 files changed, 78 insertions(+), 70 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92027530..5c90d825 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-02-28 Tor Lillqvist + + * pango/pangowin32-private.h (PING) + * pango/pangowin32.c + * modules/basic/basic-win32.c: Use g_print() instead of printf() + for debugging output, to enable easy redirection using GLib + facilities. (#332855) + 2006-02-26 Behdad Esfahbod * === Released 1.11.99 "Just In Case" === diff --git a/modules/basic/basic-win32.c b/modules/basic/basic-win32.c index fed595d3..16cb6bed 100644 --- a/modules/basic/basic-win32.c +++ b/modules/basic/basic-win32.c @@ -503,23 +503,23 @@ dump_glyphs_and_log_clusters (gboolean rtl, { int j, k, nclusters, clusterix, charix, ng; - printf (" ScriptShape: nglyphs=%d: ", nglyphs); + g_print (" ScriptShape: nglyphs=%d: ", nglyphs); for (j = 0; j < nglyphs; j++) - printf ("%d%s", iglyphs[j], (j < nglyphs-1) ? "," : ""); - printf ("\n"); + g_print ("%d%s", iglyphs[j], (j < nglyphs-1) ? "," : ""); + g_print ("\n"); - printf (" log_clusters: "); + g_print (" log_clusters: "); for (j = 0; j < itemlen; j++) - printf ("%d ", log_clusters[j]); - printf ("\n"); + g_print ("%d ", log_clusters[j]); + g_print ("\n"); nclusters = 0; for (j = 0; j < itemlen; j++) { if (j == 0 || log_clusters[j-1] != log_clusters[j]) nclusters++; } - printf (" %d clusters:\n", nclusters); + g_print (" %d clusters:\n", nclusters); /* If RTL, first char is the last in the run, otherwise the * first. @@ -531,22 +531,22 @@ dump_glyphs_and_log_clusters (gboolean rtl, for (j = itemlen - 1, charix = charix0 + j; j >= 0; j--, charix--) { if (j == itemlen - 1 || log_clusters[j] != log_clusters[j+1]) - printf (" Cluster %d: chars %d--", - clusterix, charix); + g_print (" Cluster %d: chars %d--", + clusterix, charix); if (j == 0 || log_clusters[j-1] != log_clusters[j]) { ng = log_clusters[j] - firstglyphix + 1; - printf ("%d: %d glyphs: ", - charix, ng); + g_print ("%d: %d glyphs: ", + charix, ng); for (k = firstglyphix; k <= log_clusters[j]; k++) { - printf ("%d", iglyphs[k]); + g_print ("%d", iglyphs[k]); if (k < log_clusters[j]) - printf (","); + g_print (","); } firstglyphix = log_clusters[j] + 1; clusterix++; - printf ("\n"); + g_print ("\n"); } } } @@ -555,22 +555,22 @@ dump_glyphs_and_log_clusters (gboolean rtl, for (j = 0, charix = charix0; j < itemlen; j++, charix++) { if (j == 0 || log_clusters[j-1] != log_clusters[j]) - printf (" Cluster %d: wchar_t %d--", - clusterix, charix); + g_print (" Cluster %d: wchar_t %d--", + clusterix, charix); if (j == itemlen - 1 || log_clusters[j] != log_clusters[j+1]) { int klim = ((j == itemlen-1) ? nglyphs : log_clusters[j+1]); ng = klim - log_clusters[j]; - printf ("%d: %d glyphs: ", - charix, ng); + g_print ("%d: %d glyphs: ", + charix, ng); for (k = log_clusters[j]; k < klim; k++) { - printf ("%d", iglyphs[k]); + g_print ("%d", iglyphs[k]); if (k != klim - 1) - printf (","); + g_print (","); } clusterix++; - printf ("\n"); + g_print ("\n"); } } } @@ -728,22 +728,22 @@ itemize_shape_and_place (PangoFont *font, #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - printf (G_STRLOC ": ScriptItemize: uDefaultLanguage:%04x uBidiLevel:%d\n", - control.uDefaultLanguage, state.uBidiLevel); + g_print (G_STRLOC ": ScriptItemize: uDefaultLanguage:%04x uBidiLevel:%d\n", + control.uDefaultLanguage, state.uBidiLevel); #endif if ((*script_itemize) (wtext, wlen, G_N_ELEMENTS (items), &control, NULL, items, &nitems)) { #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - printf ("ScriptItemize failed\n"); + g_print ("ScriptItemize failed\n"); #endif return FALSE; } #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - printf ("%d items:\n", nitems); + g_print ("%d items:\n", nitems); #endif if (analysis->level % 2) @@ -781,17 +781,17 @@ itemize_shape_and_place (PangoFont *font, #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - printf (" Item %d: iCharPos=%d eScript=%d (%s) %s%s%s%s%s%s%s wchar_t %d--%d (%d)\n", - item, items[item].iCharPos, script, - lang_name (scripts[script]->langid), - scripts[script]->fComplex ? "complex" : "simple", - items[item].a.fRTL ? " fRTL" : "", - items[item].a.fLayoutRTL ? " fLayoutRTL" : "", - items[item].a.fLinkBefore ? " fLinkBefore" : "", - items[item].a.fLinkAfter ? " fLinkAfter" : "", - items[item].a.fLogicalOrder ? " fLogicalOrder" : "", - items[item].a.fNoGlyphIndex ? " fNoGlyphIndex" : "", - items[item].iCharPos, items[item+1].iCharPos-1, itemlen); + g_print (" Item %d: iCharPos=%d eScript=%d (%s) %s%s%s%s%s%s%s wchar_t %d--%d (%d)\n", + item, items[item].iCharPos, script, + lang_name (scripts[script]->langid), + scripts[script]->fComplex ? "complex" : "simple", + items[item].a.fRTL ? " fRTL" : "", + items[item].a.fLayoutRTL ? " fLayoutRTL" : "", + items[item].a.fLinkBefore ? " fLinkBefore" : "", + items[item].a.fLinkAfter ? " fLinkAfter" : "", + items[item].a.fLogicalOrder ? " fLogicalOrder" : "", + items[item].a.fNoGlyphIndex ? " fNoGlyphIndex" : "", + items[item].iCharPos, items[item+1].iCharPos-1, itemlen); #endif items[item].a.fRTL = analysis->level % 2; @@ -806,7 +806,7 @@ itemize_shape_and_place (PangoFont *font, { #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - printf ("pango-basic-win32: ScriptShape failed\n"); + g_print ("pango-basic-win32: ScriptShape failed\n"); #endif return FALSE; } @@ -831,7 +831,7 @@ itemize_shape_and_place (PangoFont *font, { #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - printf ("pango-basic-win32: ScriptPlace failed\n"); + g_print ("pango-basic-win32: ScriptPlace failed\n"); #endif return FALSE; } @@ -866,10 +866,10 @@ itemize_shape_and_place (PangoFont *font, #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) { - printf (" Pango log_clusters (level:%d), char index:", analysis->level); + g_print (" Pango log_clusters (level:%d), char index:", analysis->level); for (glyphix = 0; glyphix < glyphs->num_glyphs; glyphix++) - printf ("%d ", glyphs->log_clusters[glyphix]); - printf ("\n"); + g_print ("%d ", glyphs->log_clusters[glyphix]); + g_print ("\n"); } #endif @@ -913,10 +913,10 @@ uniscribe_shape (PangoFont *font, { int glyphix; - printf (" Pango log_clusters, byte offsets:"); + g_print (" Pango log_clusters, byte offsets:"); for (glyphix = 0; glyphix < glyphs->num_glyphs; glyphix++) - printf ("%d ", glyphs->log_clusters[glyphix]); - printf ("\n"); + g_print ("%d ", glyphs->log_clusters[glyphix]); + g_print ("\n"); } #endif } @@ -946,8 +946,8 @@ text_is_simple (const char *text, #ifdef BASIC_WIN32_DEBUGGING if (pango_win32_debug) - printf ("text_is_simple: %.*s (%ld wchar_t): %s\n", - MIN (length, 10), text, wlen, retval ? "YES" : "NO"); + g_print ("text_is_simple: %.*s (%ld wchar_t): %s\n", + MIN (length, 10), text, wlen, retval ? "YES" : "NO"); #endif return retval; diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h index 1e5e999c..d45a2768 100644 --- a/pango/pangowin32-private.h +++ b/pango/pangowin32-private.h @@ -34,16 +34,16 @@ #ifdef __GNUC__ #define PING(printlist) \ (pango_win32_debug ? \ - (printf ("%s:%d ", __PRETTY_FUNCTION__, __LINE__), \ - printf printlist, \ - printf ("\n")) : \ + (g_print ("%s:%d ", __PRETTY_FUNCTION__, __LINE__), \ + g_print printlist, \ + g_print ("\n")) : \ 0) #else #define PING(printlist) \ (pango_win32_debug ? \ - (printf ("%s:%d ", __FILE__, __LINE__), \ - printf printlist, \ - printf ("\n")) : \ + (g_print ("%s:%d ", __FILE__, __LINE__), \ + g_print printlist, \ + g_print ("\n")) : \ 0) #endif #else /* !PANGO_WIN32_DEBUGGING */ diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 2772700c..a04c4553 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -267,13 +267,13 @@ pango_win32_render (HDC hdc, PING (("num_glyphs:%d", glyphs->num_glyphs)); for (i = 0; i < glyphs->num_glyphs; i++) { - printf (" %d:%d", glyphs->glyphs[i].glyph, glyphs->glyphs[i].geometry.width); + g_print (" %d:%d", glyphs->glyphs[i].glyph, glyphs->glyphs[i].geometry.width); if (glyphs->glyphs[i].geometry.x_offset != 0 || glyphs->glyphs[i].geometry.y_offset != 0) - printf (":%d,%d", glyphs->glyphs[i].geometry.x_offset, - glyphs->glyphs[i].geometry.y_offset); + g_print (":%d,%d", glyphs->glyphs[i].geometry.x_offset, + glyphs->glyphs[i].geometry.y_offset); } - printf ("\n"); + g_print ("\n"); } #endif @@ -372,12 +372,12 @@ pango_win32_render (HDC hdc, #ifdef PANGO_WIN32_DEBUGGING if (pango_win32_debug) { - printf ("ExtTextOutW at %d,%d deltas:", - x + PANGO_PIXELS (start_x_offset), - y + PANGO_PIXELS (cur_y_offset)); + g_print ("ExtTextOutW at %d,%d deltas:", + x + PANGO_PIXELS (start_x_offset), + y + PANGO_PIXELS (cur_y_offset)); for (j = 0; j < num_valid_glyphs; j++) - printf (" %d", dX[j]); - printf ("\n"); + g_print (" %d", dX[j]); + g_print ("\n"); } #endif @@ -1592,9 +1592,9 @@ pango_win32_font_calc_coverage (PangoFont *font, if (pango_win32_debug) { if (end_count[i] == start_count[i]) - printf ("%04x ", start_count[i]); + g_print ("%04x ", start_count[i]); else - printf ("%04x:%04x ", start_count[i], end_count[i]); + g_print ("%04x:%04x ", start_count[i], end_count[i]); } #endif for (ch = start_count[i]; ch <= end_count[i]; ch++) @@ -1633,9 +1633,9 @@ pango_win32_font_calc_coverage (PangoFont *font, if (pango_win32_debug) { if (ch > ch0 + 2) - printf ("%04x:%04x ", ch0, ch - 1); + g_print ("%04x:%04x ", ch0, ch - 1); else - printf ("%04x ", ch0); + g_print ("%04x ", ch0); } ch0 = G_MAXUINT; } @@ -1647,9 +1647,9 @@ pango_win32_font_calc_coverage (PangoFont *font, if (pango_win32_debug) { if (ch > ch0 + 2) - printf ("%04x:%04x ", ch0, ch - 1); + g_print ("%04x:%04x ", ch0, ch - 1); else - printf ("%04x ", ch0); + g_print ("%04x ", ch0); } } #endif @@ -1666,9 +1666,9 @@ pango_win32_font_calc_coverage (PangoFont *font, if (pango_win32_debug) { if (cmap12->groups[i*3+0] == cmap12->groups[i*3+1]) - printf ("%04x ", cmap12->groups[i*3+0]); + g_print ("%04x ", cmap12->groups[i*3+0]); else - printf ("%04x:%04x ", cmap12->groups[i*3+0], cmap12->groups[i*3+1]); + g_print ("%04x:%04x ", cmap12->groups[i*3+0], cmap12->groups[i*3+1]); } #endif for (ch = cmap12->groups[i*3+0]; ch <= cmap12->groups[i*3+1]; ch++) @@ -1684,6 +1684,6 @@ pango_win32_font_calc_coverage (PangoFont *font, g_assert_not_reached (); #ifdef PANGO_WIN32_DEBUGGING if (pango_win32_debug) - printf ("\n"); + g_print ("\n"); #endif } -- cgit v1.2.1