From: Behdad Esfahbod Date: Tue, 16 Jan 2007 20:20:35 +0000 (+0000) Subject: *.c, *.h: Replace preceding sequences of 8 spaces with tabs. X-Git-Tag: PANGO_1_15_4~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0225fbf560de93c7b41acf9dbf01c9d99173af9;p=platform%2Fupstream%2Fpango.git *.c, *.h: Replace preceding sequences of 8 spaces with tabs. 2007-01-16 Behdad Esfahbod *.c, *.h: Replace preceding sequences of 8 spaces with tabs. svn path=/trunk/; revision=2165 --- diff --git a/ChangeLog b/ChangeLog index a108c9d..3f0eb7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-01-16 Behdad Esfahbod + *.c, *.h: Replace preceding sequences of 8 spaces with tabs. + +2007-01-16 Behdad Esfahbod + * examples/pangowin32tobmp.c (SaveBitmap): * modules/tibetan/tibetan-fc.c: Replace C++-style // comments with C-style /* */ ones. diff --git a/examples/cairotwisted.c b/examples/cairotwisted.c index 586f44d..33d634c 100644 --- a/examples/cairotwisted.c +++ b/examples/cairotwisted.c @@ -210,7 +210,7 @@ point_on_path (parametrized_path_t *param, parametrization_t *parametrization = param->parametrization; for (i=0; i + path->data[i].header.length < path->num_data && - (d > parametrization[i] || + (d > parametrization[i] || path->data[i].header.type == CAIRO_PATH_MOVE_TO); i += path->data[i].header.length) { d -= parametrization[i]; @@ -254,22 +254,22 @@ point_on_path (parametrized_path_t *param, case CAIRO_PATH_CURVE_TO: ratio = d / parametrization[i]; *x = current_point.point.x * (1 - ratio) * (1 - ratio) * (1 - ratio) - + 3 * data[1].point.x * (1 - ratio) * (1 - ratio) * ratio - + 3 * data[2].point.x * (1 - ratio) * ratio * ratio - + data[3].point.x * ratio * ratio * ratio; + + 3 * data[1].point.x * (1 - ratio) * (1 - ratio) * ratio + + 3 * data[2].point.x * (1 - ratio) * ratio * ratio + + data[3].point.x * ratio * ratio * ratio; *y = current_point.point.y * (1 - ratio) * (1 - ratio) * (1 - ratio) - + 3 * data[1].point.y * (1 - ratio) * (1 - ratio) * ratio - + 3 * data[2].point.y * (1 - ratio) * ratio * ratio - + data[3].point.y * ratio * ratio * ratio; + + 3 * data[1].point.y * (1 - ratio) * (1 - ratio) * ratio + + 3 * data[2].point.y * (1 - ratio) * ratio * ratio + + data[3].point.y * ratio * ratio * ratio; dx =-3 * current_point.point.x * (1 - ratio) * (1 - ratio) - + 3 * data[1].point.x * (1 - 4 * ratio + 3 * ratio * ratio) - + 3 * data[2].point.x * ( 2 * ratio - 3 * ratio * ratio) - + 3 * data[3].point.x * ratio * ratio; + + 3 * data[1].point.x * (1 - 4 * ratio + 3 * ratio * ratio) + + 3 * data[2].point.x * ( 2 * ratio - 3 * ratio * ratio) + + 3 * data[3].point.x * ratio * ratio; dy =-3 * current_point.point.y * (1 - ratio) * (1 - ratio) - + 3 * data[1].point.y * (1 - 4 * ratio + 3 * ratio * ratio) - + 3 * data[2].point.y * ( 2 * ratio - 3 * ratio * ratio) - + 3 * data[3].point.y * ratio * ratio; + + 3 * data[1].point.y * (1 - 4 * ratio + 3 * ratio * ratio) + + 3 * data[2].point.y * ( 2 * ratio - 3 * ratio * ratio) + + 3 * data[3].point.y * ratio * ratio; d = oldy; ratio = d / sqrt (dx * dx + dy * dy); diff --git a/examples/pangowin32tobmp.c b/examples/pangowin32tobmp.c index bd80172..19ef392 100644 --- a/examples/pangowin32tobmp.c +++ b/examples/pangowin32tobmp.c @@ -47,12 +47,12 @@ static float calc_duration (GTimeVal *tv1, GTimeVal *tv0) { return ( ((float)tv1->tv_sec - tv0->tv_sec) - + (tv1->tv_usec - tv0->tv_usec) / 1000000.0); + + (tv1->tv_usec - tv0->tv_usec) / 1000000.0); } static int compare_font_family (PangoFontFamily** a, - PangoFontFamily** b) + PangoFontFamily** b) { return strcmp (pango_font_family_get_name (*a), pango_font_family_get_name (*b)); } @@ -90,14 +90,14 @@ int main (int argc, char **argv) /* try to load some fonts often hardcoded */ for (i = 0; i < G_N_ELEMENTS (std_fonts); i++) - { - PangoFontDescription *desc = pango_font_description_from_string(std_fonts[i]); + { + PangoFontDescription *desc = pango_font_description_from_string(std_fonts[i]); - /* spits warnings if font cannot be loaded */ - font = pango_font_map_load_font (fontmap, context, desc); + /* spits warnings if font cannot be loaded */ + font = pango_font_map_load_font (fontmap, context, desc); - g_object_unref (font); - } + g_object_unref (font); + } } else { @@ -106,13 +106,13 @@ int main (int argc, char **argv) s = g_string_new (argv[1]); for (i = 2; i < argc; i++) - { - s = g_string_append_c (s, ' '); - s = g_string_append (s, argv[i]); + { + s = g_string_append_c (s, ' '); + s = g_string_append (s, argv[i]); - if (0 != atoi (argv[i])) - my_font_size = atoi (argv[i]); - } + if (0 != atoi (argv[i])) + my_font_size = atoi (argv[i]); + } desc = pango_font_description_from_string(s->str); family_name = g_strdup (pango_font_description_get_family (desc)); @@ -138,14 +138,14 @@ int main (int argc, char **argv) { /* Get on the family faces. No simple way ? */ for (i = 0; i < nb; i++) - { - if (0 == g_ascii_strcasecmp (pango_font_family_get_name (families[i]), family_name)) - { - pango_font_family_list_faces (families[i], &faces, &nb); - /* now nb is the number of faces */ - break; - } - } + { + if (0 == g_ascii_strcasecmp (pango_font_family_get_name (families[i]), family_name)) + { + pango_font_family_list_faces (families[i], &faces, &nb); + /* now nb is the number of faces */ + break; + } + } g_free (families); families = NULL; g_free (family_name); @@ -162,23 +162,23 @@ int main (int argc, char **argv) PangoStyle style; if (families) - { - desc = pango_font_description_new (); + { + desc = pango_font_description_new (); - f_name = pango_font_family_get_name (families[i]); - pango_font_description_set_family (desc, f_name); - } + f_name = pango_font_family_get_name (families[i]); + pango_font_description_set_family (desc, f_name); + } else - { - desc = pango_font_face_describe (faces[i]); - /* this is _not_ the family name from above */ - f_name = pango_font_description_get_family (desc); - } + { + desc = pango_font_face_describe (faces[i]); + /* this is _not_ the family name from above */ + f_name = pango_font_description_get_family (desc); + } weight = pango_font_description_get_weight (desc); style = pango_font_description_get_style (desc); g_print ("%s; Style: %d; Weight: %d\n", - f_name, style, weight); + f_name, style, weight); /* give it an arbitray size to load it */ pango_font_description_set_size (desc, my_font_size * PANGO_SCALE); @@ -189,58 +189,58 @@ int main (int argc, char **argv) g_print ("\tpango_font_map_load_font took %.3f sec\n", calc_duration (&tv1, &tv0)); if (font) - { - PangoItem *item; - PangoGlyphString * glyphs; - char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "1234567890 -+*/!\xc2\xa7$%&()[]{}<>|#=?@"; - - g_get_current_time (&tv0); - coverage = pango_font_get_coverage (font, lang); - g_get_current_time (&tv1); - g_print ("\tpango_font_get_coverage took %.3f sec\n", calc_duration (&tv1, &tv0)); - - /* ... */ - pango_context_set_language (context, lang); - pango_context_set_base_dir (context, PANGO_DIRECTION_LTR); - pango_context_set_font_description (context, desc); - - glyphs = pango_glyph_string_new (); - item = pango_item_new (); - - item->analysis.shape_engine = pango_font_find_shaper (font, lang, s[0]); - item->analysis.font = g_object_ref (font); - pango_shape ( s, sizeof(s), &(item->analysis), glyphs); - - if (hdc) - { - /* the positioning isn't correct */ - char* name = g_strdup_printf ("%s (%s%s)", - f_name, - weight == PANGO_WEIGHT_NORMAL ? "n" : - (weight == PANGO_WEIGHT_HEAVY ? "h" : - (weight > PANGO_WEIGHT_NORMAL ? "b" : "l")), - style == PANGO_STYLE_OBLIQUE ? "o" : - (style == PANGO_STYLE_ITALIC ? "i" : "n")); - - TextOut (hdc, 0, line, name, strlen(name)); - g_get_current_time (&tv0); - pango_win32_render (hdc, font, glyphs, 200, line); - g_get_current_time (&tv1); - g_print ("\tpango_win32_render took %.3f sec\n", - calc_duration (&tv1, &tv0)); - line += (3 * my_font_size / 2); - g_free(name); - } - - /* free glyphs, ... */ - pango_glyph_string_free (glyphs); - pango_item_free (item); - - pango_coverage_unref (coverage); - g_object_unref (font); - } + { + PangoItem *item; + PangoGlyphString * glyphs; + char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "1234567890 -+*/!\xc2\xa7$%&()[]{}<>|#=?@"; + + g_get_current_time (&tv0); + coverage = pango_font_get_coverage (font, lang); + g_get_current_time (&tv1); + g_print ("\tpango_font_get_coverage took %.3f sec\n", calc_duration (&tv1, &tv0)); + + /* ... */ + pango_context_set_language (context, lang); + pango_context_set_base_dir (context, PANGO_DIRECTION_LTR); + pango_context_set_font_description (context, desc); + + glyphs = pango_glyph_string_new (); + item = pango_item_new (); + + item->analysis.shape_engine = pango_font_find_shaper (font, lang, s[0]); + item->analysis.font = g_object_ref (font); + pango_shape ( s, sizeof(s), &(item->analysis), glyphs); + + if (hdc) + { + /* the positioning isn't correct */ + char* name = g_strdup_printf ("%s (%s%s)", + f_name, + weight == PANGO_WEIGHT_NORMAL ? "n" : + (weight == PANGO_WEIGHT_HEAVY ? "h" : + (weight > PANGO_WEIGHT_NORMAL ? "b" : "l")), + style == PANGO_STYLE_OBLIQUE ? "o" : + (style == PANGO_STYLE_ITALIC ? "i" : "n")); + + TextOut (hdc, 0, line, name, strlen(name)); + g_get_current_time (&tv0); + pango_win32_render (hdc, font, glyphs, 200, line); + g_get_current_time (&tv1); + g_print ("\tpango_win32_render took %.3f sec\n", + calc_duration (&tv1, &tv0)); + line += (3 * my_font_size / 2); + g_free(name); + } + + /* free glyphs, ... */ + pango_glyph_string_free (glyphs); + pango_item_free (item); + + pango_coverage_unref (coverage); + g_object_unref (font); + } pango_font_description_free (desc); } @@ -396,7 +396,7 @@ SaveBitmap (HBITMAP hBmp, const char* pszFile) */ hDC = CreateCompatibleDC(NULL); if (!GetDIBits(hDC, hBmp, 0, (WORD) pbih->biHeight, - lpBits, pbmi, DIB_RGB_COLORS)) + lpBits, pbmi, DIB_RGB_COLORS)) return FALSE; /* Create the .BMP file. */ hf = CreateFile (pszFile, @@ -412,13 +412,13 @@ SaveBitmap (HBITMAP hBmp, const char* pszFile) hdr.bfType = 0x4d42; /* 0x42 = "B" 0x4d = "M" */ /* Compute the size of the entire file. */ hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) - + pbih->biSize + pbih->biClrUsed + + pbih->biSize + pbih->biClrUsed * sizeof(RGBQUAD) + pbih->biSizeImage); hdr.bfReserved1 = 0; hdr.bfReserved2 = 0; /* Compute the offset to the array of color indices. */ hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) - + pbih->biSize + pbih->biClrUsed + + pbih->biSize + pbih->biClrUsed * sizeof (RGBQUAD); /* Copy the BITMAPFILEHEADER into the .BMP file. */ if (!WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER), @@ -426,14 +426,14 @@ SaveBitmap (HBITMAP hBmp, const char* pszFile) return FALSE; /* Copy the BITMAPINFOHEADER and RGBQUAD array into the file. */ if (!WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER) - + pbih->biClrUsed * sizeof (RGBQUAD), + + pbih->biClrUsed * sizeof (RGBQUAD), (LPDWORD) &dwTmp, (LPOVERLAPPED) NULL)) return FALSE; /* Copy the array of color indices into the .BMP file. */ dwTotal = cb = pbih->biSizeImage; if (!WriteFile(hf, (LPSTR) lpBits, (int) cb, - (LPDWORD) &dwTotal, (LPOVERLAPPED) NULL)) + (LPDWORD) &dwTotal, (LPOVERLAPPED) NULL)) return FALSE; /* Close the .BMP file. */ diff --git a/modules/arabic/arabic-lang.c b/modules/arabic/arabic-lang.c index 885977c..7022b04 100644 --- a/modules/arabic/arabic-lang.c +++ b/modules/arabic/arabic-lang.c @@ -110,7 +110,7 @@ arabic_engine_break (PangoEngineLang *engine, (prev_wc == ALEF && IS_COMPOSITE_WITH_ALEF (this_wc)) || (this_wc == HAMZA_ABOVE && (prev_wc == WAW || prev_wc == YEH)) )) - attrs[i+1].backspace_deletes_character = FALSE; + attrs[i+1].backspace_deletes_character = FALSE; } } diff --git a/modules/arabic/arabic-ot.c b/modules/arabic/arabic-ot.c index bf7cd07..ab57fd2 100644 --- a/modules/arabic/arabic-ot.c +++ b/modules/arabic/arabic-ot.c @@ -194,7 +194,7 @@ TT_Error Build_Arabic_Glyph_Properties (TT_CharMap char_map, MARK_GLYPH : SIMPLE_GLYPH; Arabic[j].glyph_index = TT_Char_Index (char_map, i); if (Arabic[j].glyph_index) - j++; + j++; } num_glyphs = j; @@ -222,7 +222,7 @@ TT_Error Build_Arabic_Glyph_Properties (TT_CharMap char_map, classes[j] = Arabic[i].class; if (glyph_indices[j - 1] != glyph_indices[j]) - j++; + j++; } num_glyphs = j; @@ -291,26 +291,26 @@ static joining_class Get_Joining_Class (gunichar* string, while (1) { if (pos == 0 && direction < 0) - return none; + return none; pos += direction; if (pos >= length) - return none; + return none; if (string[pos] >= 0x0620 && - string[pos] < 0x0700) - j = arabic[string[pos] - 0x0620]; + string[pos] < 0x0700) + j = arabic[string[pos] - 0x0620]; else if (string[pos] >= 0x0750 && - string[pos] < 0x0780) - j = arabic_supplement[string[pos] - 0x0750]; + string[pos] < 0x0780) + j = arabic_supplement[string[pos] - 0x0750]; else if (string[pos] == 0x200D) - return causing; + return causing; else - return none; + return none; if (!direction || j != transparent) - return j; + return j; } } @@ -345,7 +345,7 @@ FT_Error Arabic_Assign_Properties (gunichar *string, if (previous == causing || previous == left || previous == dual ) - if (current == right) + if (current == right) { properties[i] |= final_p; continue; @@ -354,7 +354,7 @@ FT_Error Arabic_Assign_Properties (gunichar *string, /* R3 */ if (current == left) - if (next == causing || + if (next == causing || next == right || next == dual ) { @@ -367,8 +367,8 @@ FT_Error Arabic_Assign_Properties (gunichar *string, if (previous == causing || previous == left || previous == dual ) - if (current == dual) - if (next == causing || + if (current == dual) + if (next == causing || next == right || next == dual ) { @@ -381,8 +381,8 @@ FT_Error Arabic_Assign_Properties (gunichar *string, if (previous == causing || previous == left || previous == dual ) - if (current == dual) - if (!(next == causing || + if (current == dual) + if (!(next == causing || next == right || next == dual )) { @@ -395,8 +395,8 @@ FT_Error Arabic_Assign_Properties (gunichar *string, if (!(previous == causing || previous == left || previous == dual )) - if (current == dual) - if (next == causing || + if (current == dual) + if (next == causing || next == right || next == dual ) { diff --git a/modules/arabic/arabic.c b/modules/arabic/arabic.c index 9b6aae7..161f4c3 100644 --- a/modules/arabic/arabic.c +++ b/modules/arabic/arabic.c @@ -29,10 +29,10 @@ static PangoEngineRange arabic_range[] = { static PangoEngineInfo script_engines[] = { { - "ArabicScriptEngineX", - PANGO_ENGINE_TYPE_SHAPE, - PANGO_RENDER_TYPE_X, - arabic_range, G_N_ELEMENTS(arabic_range) + "ArabicScriptEngineX", + PANGO_ENGINE_TYPE_SHAPE, + PANGO_RENDER_TYPE_X, + arabic_range, G_N_ELEMENTS(arabic_range) } }; @@ -48,28 +48,28 @@ arabic_unicodeinit(PangoFont *font, PangoXSubfont subfont) ArabicFontInfo *fs = NULL; if (subfont != 0) - { - if ( pango_x_has_glyph /* Alif-Madda */ - (font,PANGO_X_MAKE_GLYPH(subfont,0xFE81))) - { - fs = g_new (ArabicFontInfo,1); - fs->level = ar_standard | ar_unifont; - fs->subfonts[0] = subfont; - - if ( pango_x_has_glyph /* Shadda+Kasra */ - (font,PANGO_X_MAKE_GLYPH(subfont,0xFC62))) - { - fs->level |= ar_composedtashkeel; - /* extra vowels in font, hopefully */ - } - if ( pango_x_has_glyph /* Lam-Min alone */ - (font,PANGO_X_MAKE_GLYPH(subfont,0xFC42))) - { - fs->level |= ar_lig; - /* extra ligatures in font, hopefully */ - } - } - } + { + if ( pango_x_has_glyph /* Alif-Madda */ + (font,PANGO_X_MAKE_GLYPH(subfont,0xFE81))) + { + fs = g_new (ArabicFontInfo,1); + fs->level = ar_standard | ar_unifont; + fs->subfonts[0] = subfont; + + if ( pango_x_has_glyph /* Shadda+Kasra */ + (font,PANGO_X_MAKE_GLYPH(subfont,0xFC62))) + { + fs->level |= ar_composedtashkeel; + /* extra vowels in font, hopefully */ + } + if ( pango_x_has_glyph /* Lam-Min alone */ + (font,PANGO_X_MAKE_GLYPH(subfont,0xFC42))) + { + fs->level |= ar_lig; + /* extra ligatures in font, hopefully */ + } + } + } return fs; } @@ -77,9 +77,9 @@ static ArabicFontInfo* find_unic_font (PangoFont *font) { static char *charsets[] = { - "iso10646-1", - "iso8859-6.8x", - "mulearabic-2", + "iso10646-1", + "iso8859-6.8x", + "mulearabic-2", "urdunaqsh-0", /* "symbol-0" */ }; @@ -95,44 +95,44 @@ find_unic_font (PangoFont *font) if (fs) return fs; n_subfonts = pango_x_list_subfonts (font, charsets, 4, - &subfonts, &subfont_charsets); + &subfonts, &subfont_charsets); for (i=0; i < n_subfonts; i++) - { - if ( !strcmp (charsets[subfont_charsets[i]], "mulearabic-2")) - { + { + if ( !strcmp (charsets[subfont_charsets[i]], "mulearabic-2")) + { #ifdef DEBUG - if (getenv("PANGO_AR_NOMULEFONT") == NULL ) + if (getenv("PANGO_AR_NOMULEFONT") == NULL ) #endif - fs = arabic_muleinit(font); - } - else if ( !strcmp (charsets[subfont_charsets[i]], "iso8859-6.8x")) - { + fs = arabic_muleinit(font); + } + else if ( !strcmp (charsets[subfont_charsets[i]], "iso8859-6.8x")) + { #ifdef DEBUG - if (getenv("PANGO_AR_NOLBOXFONT") == NULL ) + if (getenv("PANGO_AR_NOLBOXFONT") == NULL ) #endif - fs = arabic_lboxinit(font); - } - else if ( !strcmp (charsets[subfont_charsets[i]], "urdunaqsh-0")) - { + fs = arabic_lboxinit(font); + } + else if ( !strcmp (charsets[subfont_charsets[i]], "urdunaqsh-0")) + { #ifdef DEBUG - if (getenv("PANGO_AR_NONQFONT") == NULL ) + if (getenv("PANGO_AR_NONQFONT") == NULL ) #endif - fs = urdu_naqshinit(font); - } - else - { + fs = urdu_naqshinit(font); + } + else + { #ifdef DEBUG - if (getenv("PANGO_AR_NOUNIFONT") == NULL ) + if (getenv("PANGO_AR_NOUNIFONT") == NULL ) #endif - fs = arabic_unicodeinit(font,subfonts[i]); - } - if (fs){ - g_object_set_qdata_full (G_OBJECT (font), info_id, - fs, (GDestroyNotify)g_free); - break; - } - } + fs = arabic_unicodeinit(font,subfonts[i]); + } + if (fs){ + g_object_set_qdata_full (G_OBJECT (font), info_id, + fs, (GDestroyNotify)g_free); + break; + } + } g_free (subfonts); g_free (subfont_charsets); @@ -144,8 +144,8 @@ find_unic_font (PangoFont *font) static void set_glyph (PangoGlyphString *glyphs, - PangoFont *font, PangoXSubfont subfont, - int i, int cluster_start, int glyph, int is_vowel) + PangoFont *font, PangoXSubfont subfont, + int i, int cluster_start, int glyph, int is_vowel) { PangoRectangle logical_rect; @@ -157,13 +157,13 @@ set_glyph (PangoGlyphString *glyphs, pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect); glyphs->log_clusters[i] = cluster_start; if (is_vowel) - { - glyphs->glyphs[i].geometry.width = 0; - } + { + glyphs->glyphs[i].geometry.width = 0; + } else - { - glyphs->glyphs[i].geometry.width = logical_rect.width; - } + { + glyphs->glyphs[i].geometry.width = logical_rect.width; + } } @@ -171,10 +171,10 @@ set_glyph (PangoGlyphString *glyphs, static void arabic_engine_shape (PangoFont *font, - const char *text, - int length, - PangoAnalysis *analysis, - PangoGlyphString *glyphs) + const char *text, + int length, + PangoAnalysis *analysis, + PangoGlyphString *glyphs) { PangoXSubfont subfont; int n_chars; @@ -193,42 +193,42 @@ arabic_engine_shape (PangoFont *font, */ if (! (fs = find_unic_font (font)) ) - { + { - PangoGlyph unknown_glyph = pango_x_get_unknown_glyph (font); + PangoGlyph unknown_glyph = pango_x_get_unknown_glyph (font); - n_chars = g_utf8_strlen(text,length); - pango_glyph_string_set_size (glyphs, n_chars); + n_chars = g_utf8_strlen(text,length); + pango_glyph_string_set_size (glyphs, n_chars); - p = text; - for (i=0; ilevel % 2 == 0) - { - wc = g_utf8_to_ucs4_fast(text,length,&n_chars); - /* We were called on a LTR directional run (e.g. some numbers); - fallback as simple as possible */ - pango_glyph_string_set_size (glyphs, n_chars); + { + wc = g_utf8_to_ucs4_fast(text,length,&n_chars); + /* We were called on a LTR directional run (e.g. some numbers); + fallback as simple as possible */ + pango_glyph_string_set_size (glyphs, n_chars); - } + } else - { - wc = (gunichar *)g_malloc(sizeof(gunichar)* (length) ); /* length is succicient: all arabic chars use at + { + wc = (gunichar *)g_malloc(sizeof(gunichar)* (length) ); /* length is succicient: all arabic chars use at least 2 bytes in utf-8 encoding */ - n_chars = length; - arabic_reshape(&n_chars,text,wc,fs->level); - pango_glyph_string_set_size (glyphs, n_chars); - }; + n_chars = length; + arabic_reshape(&n_chars,text,wc,fs->level); + pango_glyph_string_set_size (glyphs, n_chars); + }; p = text; @@ -237,59 +237,59 @@ arabic_engine_shape (PangoFont *font, subfont = fs->subfonts[0]; while(i < n_chars) - { - if (wc[i] == 0) - { - p = g_utf8_next_char (p); + { + if (wc[i] == 0) + { + p = g_utf8_next_char (p); #ifdef DEBUG - fprintf(stderr,"NULL-character detected in generated string.!"); + fprintf(stderr,"NULL-character detected in generated string.!"); #endif - i++; - } - else - { - int cluster_start ; - int is_vowel = arabic_isvowel(wc[i]); - cluster_start = is_vowel ? pold - text : p - text; - - if ( fs->level & ar_mulefont ) - { - arabic_mule_recode(&subfont,&(wc[i]), - fs->subfonts); - } - else if ( fs->level & ar_lboxfont ) - { - if (( i < n_chars-1 )&&(wc[i+1] == 0)) - { - arabic_lbox_recode(&subfont,&(wc[i]), - &(wc[i+1]), - fs->subfonts); - } - else - arabic_lbox_recode(&subfont,&(wc[i]),NULL, - fs->subfonts); - } - else if ( fs->level & ar_naqshfont ) - { - if (( i < n_chars-1 )&&(wc[i+1] == 0)) - { - urdu_naqsh_recode(&subfont,&(wc[i]), - &(wc[i+1]), - fs->subfonts); - } - else - urdu_naqsh_recode(&subfont,&(wc[i]),NULL, - fs->subfonts); - } - - set_glyph(glyphs, font, subfont, n_chars - i - 1, - cluster_start, wc[i], is_vowel); - - pold = p; - p = g_utf8_next_char (p); - i++; - } - } + i++; + } + else + { + int cluster_start ; + int is_vowel = arabic_isvowel(wc[i]); + cluster_start = is_vowel ? pold - text : p - text; + + if ( fs->level & ar_mulefont ) + { + arabic_mule_recode(&subfont,&(wc[i]), + fs->subfonts); + } + else if ( fs->level & ar_lboxfont ) + { + if (( i < n_chars-1 )&&(wc[i+1] == 0)) + { + arabic_lbox_recode(&subfont,&(wc[i]), + &(wc[i+1]), + fs->subfonts); + } + else + arabic_lbox_recode(&subfont,&(wc[i]),NULL, + fs->subfonts); + } + else if ( fs->level & ar_naqshfont ) + { + if (( i < n_chars-1 )&&(wc[i+1] == 0)) + { + urdu_naqsh_recode(&subfont,&(wc[i]), + &(wc[i+1]), + fs->subfonts); + } + else + urdu_naqsh_recode(&subfont,&(wc[i]),NULL, + fs->subfonts); + } + + set_glyph(glyphs, font, subfont, n_chars - i - 1, + cluster_start, wc[i], is_vowel); + + pold = p; + p = g_utf8_next_char (p); + i++; + } + } g_free(wc); } @@ -297,15 +297,15 @@ arabic_engine_shape (PangoFont *font, static PangoCoverage * arabic_engine_get_coverage (PangoFont *font, - const char *lang) + const char *lang) { gunichar i; PangoCoverage *result = pango_coverage_new (); for (i = 0x60B; i <= 0x66D; i++) - pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); for (i = 0x670; i <= 0x6D3; i++) - pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); return result; } diff --git a/modules/basic/basic-fc.c b/modules/basic/basic-fc.c index 0dcdbbd..a459225 100644 --- a/modules/basic/basic-fc.c +++ b/modules/basic/basic-fc.c @@ -174,9 +174,9 @@ fallback_shape (PangoEngineShape *engine, index = pango_fc_font_get_glyph (fc_font, wc); if (!index) - { + { index = PANGO_GET_UNKNOWN_GLYPH ( wc); - set_glyph (font, glyphs, i, p - text, index); + set_glyph (font, glyphs, i, p - text, index); } else { @@ -262,38 +262,38 @@ get_ruleset (FT_Face face) for (i = 0; i < G_N_ELEMENTS (scripts); i++) { - PangoOTTag script_tag = FT_MAKE_TAG (scripts[i][0], scripts[i][1], scripts[i][2], scripts[i][3]); - guint script_index; + PangoOTTag script_tag = FT_MAKE_TAG (scripts[i][0], scripts[i][1], scripts[i][2], scripts[i][3]); + guint script_index; - if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, script_tag, &script_index)) - for (j = 0; j < G_N_ELEMENTS (gpos_features); j++) + if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, script_tag, &script_index)) + for (j = 0; j < G_N_ELEMENTS (gpos_features); j++) { - PangoOTTag feature_tag = FT_MAKE_TAG (gpos_features[j][0], gpos_features[j][1], - gpos_features[j][2], gpos_features[j][3]); - guint feature_index; - - /* 0xffff means default language */ - if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GPOS, feature_tag, script_index, 0xffff,&feature_index)) - { - pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GPOS, feature_index, 0xffff); + PangoOTTag feature_tag = FT_MAKE_TAG (gpos_features[j][0], gpos_features[j][1], + gpos_features[j][2], gpos_features[j][3]); + guint feature_index; + + /* 0xffff means default language */ + if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GPOS, feature_tag, script_index, 0xffff,&feature_index)) + { + pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GPOS, feature_index, 0xffff); } } - if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, script_tag, &script_index)) - for (j = 0; j < G_N_ELEMENTS (gsub_features); j++) - { - PangoOTTag feature_tag = FT_MAKE_TAG (gsub_features[j][0], gsub_features[j][1], - gsub_features[j][2], gsub_features[j][3]); - guint feature_index; - - /* 0xffff means default language */ - if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GSUB, feature_tag, - script_index, 0xffff, &feature_index)) - { - pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GSUB, feature_index, 0xffff); - } - } + if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, script_tag, &script_index)) + for (j = 0; j < G_N_ELEMENTS (gsub_features); j++) + { + PangoOTTag feature_tag = FT_MAKE_TAG (gsub_features[j][0], gsub_features[j][1], + gsub_features[j][2], gsub_features[j][3]); + guint feature_index; + + /* 0xffff means default language */ + if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GSUB, feature_tag, + script_index, 0xffff, &feature_index)) + { + pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GSUB, feature_index, 0xffff); + } + } } g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, (GDestroyNotify) g_object_unref); @@ -375,7 +375,7 @@ basic_engine_shape (PangoEngineShape *engine, pango_ot_buffer_add_glyph (buffer, PANGO_GLYPH_EMPTY, unknown_property, p - text); } else - { + { index = pango_fc_font_get_glyph (fc_font, wc); if (!index) diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c index 31784f9..fe5ad75 100644 --- a/modules/basic/basic-x.c +++ b/modules/basic/basic-x.c @@ -372,8 +372,8 @@ conv_16bit (CharCache *cache, static PangoGlyph conv_16bit_MSB_on (CharCache *cache, - GIConv cd, - const char *input) + GIConv cd, + const char *input) { char outbuf[2]; diff --git a/modules/hangul/hangul-fc.c b/modules/hangul/hangul-fc.c index 03f3b30..32470fe 100644 --- a/modules/hangul/hangul-fc.c +++ b/modules/hangul/hangul-fc.c @@ -75,7 +75,7 @@ set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGl static void set_glyph_tone (PangoFont *font, PangoGlyphString *glyphs, int i, - int offset, PangoGlyph glyph) + int offset, PangoGlyph glyph) { PangoRectangle logical_rect, ink_rect; PangoRectangle logical_rect_cluster; @@ -116,8 +116,8 @@ set_glyph_tone (PangoFont *font, PangoGlyphString *glyphs, int i, if (logical_rect.width) { glyphs->glyphs[i].geometry.x_offset -= ink_rect.width; - glyphs->glyphs[j + 1].geometry.width += ink_rect.width; - glyphs->glyphs[j + 1].geometry.x_offset += ink_rect.width; + glyphs->glyphs[j + 1].geometry.width += ink_rect.width; + glyphs->glyphs[j + 1].geometry.x_offset += ink_rect.width; } } @@ -130,7 +130,7 @@ set_glyph_tone (PangoFont *font, PangoGlyphString *glyphs, int i, static void render_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs, - int *n_glyphs, int cluster_offset) + int *n_glyphs, int cluster_offset) { int index; @@ -145,11 +145,11 @@ render_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs, /* fall back : HTONE1(0x302e) => middle-dot, HTONE2(0x302f) => colon */ index = find_char (font, tone == HTONE1 ? 0x00b7 : 0x003a); if (index) - { - set_glyph_tone (font, glyphs, *n_glyphs, cluster_offset, index); - } + { + set_glyph_tone (font, glyphs, *n_glyphs, cluster_offset, index); + } else - set_glyph (font, glyphs, *n_glyphs, cluster_offset, + set_glyph (font, glyphs, *n_glyphs, cluster_offset, PANGO_GET_UNKNOWN_GLYPH (tone)); } (*n_glyphs)++; @@ -324,7 +324,7 @@ render_syllable (PangoFont *font, const char *str, int length, continue; } else if (IS_S(wc)) - { + { pango_glyph_string_set_size (glyphs, *n_glyphs + 1); set_glyph (font, glyphs, *n_glyphs, cluster_offset, PANGO_GET_UNKNOWN_GLYPH (wc)); diff --git a/modules/hebrew/hebrew-fc.c b/modules/hebrew/hebrew-fc.c index d26cb52..098b285 100644 --- a/modules/hebrew/hebrew-fc.c +++ b/modules/hebrew/hebrew-fc.c @@ -77,7 +77,7 @@ get_cluster_glyphs(PangoFont *font, if (pango_is_zero_width (wc)) glyph_num[i] = PANGO_GLYPH_EMPTY; else - { + { glyph_num[i] = pango_fc_font_get_glyph ((PangoFcFont *)font, wc); if (!glyph_num[i]) diff --git a/modules/hebrew/hebrew-shaper.c b/modules/hebrew/hebrew-shaper.c index ae77f68..7256675 100644 --- a/modules/hebrew/hebrew-shaper.c +++ b/modules/hebrew/hebrew-shaper.c @@ -98,20 +98,20 @@ static const gint char_class_table[128] = { /* 0, 1, 2, 3, 4, 5, 6, 7 */ /*00*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, + _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, /*10*/ _ND, _NS, _NS, _NS, _NS, _NS, _NS, _NS, - _NS, _NS, _NS, _NS, _NS, _NS, _NS, _NS, + _NS, _NS, _NS, _NS, _NS, _NS, _NS, _NS, /*20*/ _NS, _NS, _ND, _NS, _NS, _NS, _NS, _NS, - _NS, _NS, _NS, _NS, _NS, _NS, _NS, _NS, + _NS, _NS, _NS, _NS, _NS, _NS, _NS, _NS, /*30*/ _NS, _NS, _NS, _NS, _NS, _NS, _NS, _NS, - _NS, _NS, _ND, _NS, _DA, _NS, _SP, _NS, + _NS, _NS, _ND, _NS, _DA, _NS, _SP, _NS, /*40*/ _SP, _NS, _NS, _SP, _NS, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, + _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, /*50*/ _SP, _SP, _SP, _SP, _SP, _SP, _SP, _SP, - _SP, _SP, _SP, _SP, _SP, _SP, _SP, _SP, + _SP, _SP, _SP, _SP, _SP, _SP, _SP, _SP, /*60*/ _SP, _SP, _SP, _SP, _SP, _SP, _SP, _SP, - _SP, _SP, _SP, _ND, _ND, _ND, _ND, _ND, + _SP, _SP, _SP, _ND, _ND, _ND, _ND, _ND, /*70*/ _SP, _SP, _SP, _SP, _SP, _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, }; @@ -120,20 +120,20 @@ static const gint char_type_table[128] = { /* 0, 1, 2, 3, 4, 5, 6, 7 */ /*00*/ __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, - __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, + __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, /*10*/ __ND, __NS, __NS, __NS, __NS, __NS, __NS, __NS, - __NS, __NS, __NS, __NS, __NS, __NS, __NS, __NS, + __NS, __NS, __NS, __NS, __NS, __NS, __NS, __NS, /*20*/ __NS, __NS, __ND, __NS, __NS, __NS, __NS, __NS, - __NS, __NS, __NS, __NS, __NS, __NS, __NS, __NS, + __NS, __NS, __NS, __NS, __NS, __NS, __NS, __NS, /*30*/ __NS, __NS, __NS, __NS, __NS, __NS, __NS, __NS, - __NS, __NS, __ND, __NS, __DA, __NS, __SP, __NS, + __NS, __NS, __ND, __NS, __DA, __NS, __SP, __NS, /*40*/ __SP, __NS, __NS, __SP, __NS, __ND, __ND, __ND, - __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, + __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, /*50*/ __SP, __SP, __SP, __SP, __SP, __SP, __SP, __SP, - __SP, __SP, __SP, __SP, __SP, __SP, __SP, __SP, + __SP, __SP, __SP, __SP, __SP, __SP, __SP, __SP, /*60*/ __SP, __SP, __SP, __SP, __SP, __SP, __SP, __SP, - __SP, __SP, __SP, __ND, __ND, __ND, __ND, __ND, + __SP, __SP, __SP, __ND, __ND, __ND, __ND, __ND, /*70*/ __SP, __SP, __SP, __SP, __SP, __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, }; diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c index cdfa769..5d81c6c 100644 --- a/modules/indic/indic-fc.c +++ b/modules/indic/indic-fc.c @@ -155,7 +155,7 @@ maybe_add_GSUB_feature (PangoOTRuleset *ruleset, static void maybe_add_GPOS_feature (PangoOTRuleset *ruleset, - PangoOTInfo *info, + PangoOTInfo *info, guint script_index, PangoOTTag feature_tag, gulong property_bit) @@ -274,7 +274,7 @@ set_glyphs (PangoFont *font, (!process_zwj || wcs[i] != 0x200D)) glyph = PANGO_GLYPH_EMPTY; else - { + { glyph = pango_fc_font_get_glyph (fc_font, wcs[i]); if (!glyph) diff --git a/modules/indic/indic-lang.c b/modules/indic/indic-lang.c index 89ab301..132bedc 100644 --- a/modules/indic/indic-lang.c +++ b/modules/indic/indic-lang.c @@ -154,58 +154,58 @@ indic_engine_break (PangoEngineLang *engine, attrs[i].is_mandatory_break = FALSE; } else if (prev_wc != 0 && (this_wc == 0x200D || this_wc == 0x200C)) - { - if (next_wc != 0) - { - if (next_next_wc == 0) - { - attrs[i].is_cursor_position = FALSE; - attrs[i].is_char_break = FALSE; - attrs[i].is_line_break = FALSE; - attrs[i].is_mandatory_break = FALSE; - - i++; - - attrs[i].is_cursor_position = FALSE; - attrs[i].is_char_break = FALSE; - attrs[i].is_line_break = FALSE; - attrs[i].is_mandatory_break = FALSE; - } - else if ((next_next_wc != 0) && - (next_wc == 0x09CD || /* Bengali */ - next_wc == 0x0ACD || /* Gujarati */ - next_wc == 0x094D || /* Hindi */ - next_wc == 0x0CCD || /* Kannada */ - next_wc == 0x0D4D || /* Malayalam */ - next_wc == 0x0B4D || /* Oriya */ - next_wc == 0x0A4D || /* Punjabi */ - next_wc == 0x0BCD || /* Tamil */ - next_wc == 0x0C4D || /* Telugu */ - next_wc == 0x0DCA)) /*Sinhala*/ - { - attrs[i].is_cursor_position = FALSE; - attrs[i].is_char_break = FALSE; - attrs[i].is_line_break = FALSE; - attrs[i].is_mandatory_break = FALSE; - - i++; - - attrs[i].is_cursor_position = FALSE; - attrs[i].is_char_break = FALSE; - attrs[i].is_line_break = FALSE; - attrs[i].is_mandatory_break = FALSE; - - i++; - attrs[i].is_cursor_position = FALSE; - } - } - else - { - attrs[i].is_cursor_position = FALSE; + { + if (next_wc != 0) + { + if (next_next_wc == 0) + { + attrs[i].is_cursor_position = FALSE; + attrs[i].is_char_break = FALSE; + attrs[i].is_line_break = FALSE; + attrs[i].is_mandatory_break = FALSE; + + i++; + + attrs[i].is_cursor_position = FALSE; + attrs[i].is_char_break = FALSE; + attrs[i].is_line_break = FALSE; + attrs[i].is_mandatory_break = FALSE; + } + else if ((next_next_wc != 0) && + (next_wc == 0x09CD || /* Bengali */ + next_wc == 0x0ACD || /* Gujarati */ + next_wc == 0x094D || /* Hindi */ + next_wc == 0x0CCD || /* Kannada */ + next_wc == 0x0D4D || /* Malayalam */ + next_wc == 0x0B4D || /* Oriya */ + next_wc == 0x0A4D || /* Punjabi */ + next_wc == 0x0BCD || /* Tamil */ + next_wc == 0x0C4D || /* Telugu */ + next_wc == 0x0DCA)) /*Sinhala*/ + { + attrs[i].is_cursor_position = FALSE; + attrs[i].is_char_break = FALSE; + attrs[i].is_line_break = FALSE; + attrs[i].is_mandatory_break = FALSE; + + i++; + + attrs[i].is_cursor_position = FALSE; + attrs[i].is_char_break = FALSE; + attrs[i].is_line_break = FALSE; + attrs[i].is_mandatory_break = FALSE; + + i++; + attrs[i].is_cursor_position = FALSE; + } + } + else + { + attrs[i].is_cursor_position = FALSE; attrs[i].is_char_break = FALSE; attrs[i].is_line_break = FALSE; attrs[i].is_mandatory_break = FALSE; - } + } } } } diff --git a/modules/indic/indic-ot-class-tables.c b/modules/indic/indic-ot-class-tables.c index fe664bc..5c56176 100644 --- a/modules/indic/indic-ot-class-tables.c +++ b/modules/indic/indic-ot-class-tables.c @@ -245,7 +245,7 @@ static const IndicOTSplitMatra tamlSplitTable[] = {{0x0BC6, 0x0BBE}, {0x0BC7, 0x static const IndicOTSplitMatra teluSplitTable[] = {{0x0C46, 0x0C56}}; static const IndicOTSplitMatra kndaSplitTable[] = {{0x0CBF, 0x0CD5}, {0x0CC6, 0x0CD5}, {0x0CC6, 0x0CD6}, {0x0CC6, 0x0CC2}, - {0x0CC6, 0x0CC2, 0x0CD5}}; + {0x0CC6, 0x0CC2, 0x0CD5}}; static const IndicOTSplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x0D3E}, {0x0D46, 0x0D57}}; @@ -279,7 +279,7 @@ static const IndicOTSplitMatra sinhSplitTable[] = {{0x0DD9, 0x0DCA}, {0x0DD9, 0x /* Add a little macro to compute lastChar based on size of the charClasses * table */ #define INDIC_OT_CLASS_TABLE_DEFINE(name, firstChar, worstCaseExpansion, scriptFlags, charClasses, splitMatraTable) \ const IndicOTClassTable name = {firstChar, firstChar + G_N_ELEMENTS (charClasses) - 1, \ - worstCaseExpansion, scriptFlags, charClasses, splitMatraTable} + worstCaseExpansion, scriptFlags, charClasses, splitMatraTable} INDIC_OT_CLASS_TABLE_DEFINE (deva_class_table, 0x0900, 2, DEVA_SCRIPT_FLAGS, devaCharClasses, NULL); INDIC_OT_CLASS_TABLE_DEFINE (beng_class_table, 0x0980, 3, BENG_SCRIPT_FLAGS, bengCharClasses, bengSplitTable); INDIC_OT_CLASS_TABLE_DEFINE (guru_class_table, 0x0A00, 2, GURU_SCRIPT_FLAGS, guruCharClasses, NULL); @@ -427,15 +427,15 @@ gboolean indic_ot_has_below_base_form(const IndicOTClassTable *class_table, guni IndicOTCharClass indic_ot_get_char_class(const IndicOTClassTable *class_table, gunichar ch) { if (ch == C_SIGN_ZWJ) { - return CF_CONSONANT | CC_ZERO_WIDTH_MARK; + return CF_CONSONANT | CC_ZERO_WIDTH_MARK; } if (ch == C_SIGN_ZWNJ) { - return CC_ZERO_WIDTH_MARK; + return CC_ZERO_WIDTH_MARK; } if (ch < class_table->firstChar || ch > class_table->lastChar) { - return CC_RESERVED; + return CC_RESERVED; } return class_table->charClasses[ch - class_table->firstChar]; @@ -464,57 +464,57 @@ glong indic_ot_find_syllable(const IndicOTClassTable *class_table, const gunicha gint8 state = 0; while (cursor < char_count) { - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, chars[cursor]); + IndicOTCharClass char_class = indic_ot_get_char_class(class_table, chars[cursor]); - state = stateTable[state][char_class & CF_CLASS_MASK]; + state = stateTable[state][char_class & CF_CLASS_MASK]; - /*for the components of split matra*/ + /*for the components of split matra*/ if ((char_count >= cursor + 3) && (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DCF && chars[cursor + 2] == 0x0DCA)) { /*for 3 split matra of Sinhala*/ return cursor + 3; } else if ((char_count >= cursor + 3) && - (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CC2 && chars[cursor + 2] == 0x0CD5)) { /*for 3 split matra of Kannada*/ + (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CC2 && chars[cursor + 2] == 0x0CD5)) { /*for 3 split matra of Kannada*/ return cursor + 3; } - /*for 2 split matra*/ + /*for 2 split matra*/ else if (char_count >= cursor + 2) { - /*for Bengali*/ - if ((chars[cursor] == 0x09C7 && chars[cursor + 1] == 0x09BE) || - (chars[cursor] == 0x09C7 && chars[cursor + 1] == 0x09D7) || - /*for Oriya*/ - (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B3E) || - (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B56) || - (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B57) || - /*for Tamil*/ - (chars[cursor] == 0x0BC6 && chars[cursor + 1] == 0x0BBE) || - (chars[cursor] == 0x0BC6 && chars[cursor + 1] == 0x0BD7) || - (chars[cursor] == 0x0BC7 && chars[cursor + 1] == 0x0BBE) || - /*for Malayalam*/ - (chars[cursor] == 0x0D46 && chars[cursor + 1] == 0x0D3E) || - (chars[cursor] == 0x0D46 && chars[cursor + 1] == 0x0D57) || - (chars[cursor] == 0x0D47 && chars[cursor + 1] == 0x0D3E) || - /*for Sinhala*/ - (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DCA) || - (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DCF) || - (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DDF) || - (chars[cursor] == 0x0DDC && chars[cursor + 1] == 0x0DCA) || - /*for Telugu*/ - (chars[cursor] == 0x0C46 && chars[cursor + 1] == 0x0C56) || - /*for Kannada*/ - (chars[cursor] == 0x0CBF && chars[cursor + 1] == 0x0CD5) || - (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CD5) || - (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CD6) || - (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CC2) || - (chars[cursor] == 0x0CCA && chars[cursor + 1] == 0x0CD5)) + /*for Bengali*/ + if ((chars[cursor] == 0x09C7 && chars[cursor + 1] == 0x09BE) || + (chars[cursor] == 0x09C7 && chars[cursor + 1] == 0x09D7) || + /*for Oriya*/ + (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B3E) || + (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B56) || + (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B57) || + /*for Tamil*/ + (chars[cursor] == 0x0BC6 && chars[cursor + 1] == 0x0BBE) || + (chars[cursor] == 0x0BC6 && chars[cursor + 1] == 0x0BD7) || + (chars[cursor] == 0x0BC7 && chars[cursor + 1] == 0x0BBE) || + /*for Malayalam*/ + (chars[cursor] == 0x0D46 && chars[cursor + 1] == 0x0D3E) || + (chars[cursor] == 0x0D46 && chars[cursor + 1] == 0x0D57) || + (chars[cursor] == 0x0D47 && chars[cursor + 1] == 0x0D3E) || + /*for Sinhala*/ + (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DCA) || + (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DCF) || + (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DDF) || + (chars[cursor] == 0x0DDC && chars[cursor + 1] == 0x0DCA) || + /*for Telugu*/ + (chars[cursor] == 0x0C46 && chars[cursor + 1] == 0x0C56) || + /*for Kannada*/ + (chars[cursor] == 0x0CBF && chars[cursor + 1] == 0x0CD5) || + (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CD5) || + (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CD6) || + (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CC2) || + (chars[cursor] == 0x0CCA && chars[cursor + 1] == 0x0CD5)) return cursor + 2; } - if (state < 0) { - break; - } + if (state < 0) { + break; + } - cursor += 1; + cursor += 1; } return cursor; diff --git a/modules/indic/indic-ot.c b/modules/indic/indic-ot.c index 3b39267..477c53e 100644 --- a/modules/indic/indic-ot.c +++ b/modules/indic/indic-ot.c @@ -89,17 +89,17 @@ static void saveMatra(Output *output, gunichar matra, IndicOTCharClass matraClas { /* FIXME: check if already set, or if not a matra... */ if (IS_M_PRE(matraClass)) { - output->fMpre = matra; + output->fMpre = matra; } else if (IS_M_BELOW(matraClass)) { - output->fMbelow = matra; + output->fMbelow = matra; } else if (IS_M_ABOVE(matraClass)) { - output->fMabove = matra; + output->fMabove = matra; } else if (IS_M_POST(matraClass)) { - output->fMpost = matra; + output->fMpost = matra; } else if (IS_LENGTH_MARK(matraClass)) { - output->fLengthMark = matra; + output->fLengthMark = matra; } else if (IS_AL_LAKUNA(matraClass)) { - output->fAlLakuna = matra; + output->fAlLakuna = matra; } } @@ -117,19 +117,19 @@ static gboolean noteMatra(Output *output, const IndicOTClassTable *classTable, g IndicOTCharClass matraClass = indic_ot_get_char_class(classTable, matra); if (IS_MATRA(matraClass)) { - if (IS_SPLIT_MATRA(matraClass)) { - const IndicOTSplitMatra *splitMatra = indic_ot_get_split_matra(classTable, matraClass); - int i; + if (IS_SPLIT_MATRA(matraClass)) { + const IndicOTSplitMatra *splitMatra = indic_ot_get_split_matra(classTable, matraClass); + int i; - for (i = 0; i < 3 && (*splitMatra)[i] != 0; i += 1) { - gunichar piece = (*splitMatra)[i]; - IndicOTCharClass pieceClass = indic_ot_get_char_class(classTable, piece); + for (i = 0; i < 3 && (*splitMatra)[i] != 0; i += 1) { + gunichar piece = (*splitMatra)[i]; + IndicOTCharClass pieceClass = indic_ot_get_char_class(classTable, piece); - saveMatra(output, piece, pieceClass); - } - } else { - saveMatra(output, matra, matraClass); - } + saveMatra(output, piece, pieceClass); + } + } else { + saveMatra(output, matra, matraClass); + } return TRUE; } else @@ -139,7 +139,7 @@ static gboolean noteMatra(Output *output, const IndicOTClassTable *classTable, g static void noteBaseConsonant(Output *output) { if (output->fMPreFixups && output->fMPreOutIndex >= 0) { - indic_mprefixups_add(output->fMPreFixups, output->fOutIndex, output->fMPreOutIndex); + indic_mprefixups_add(output->fMPreFixups, output->fOutIndex, output->fMPreOutIndex); } } @@ -167,9 +167,9 @@ static void swapChars(Output *output, int a, int b) static void writeChar(Output *output, gunichar ch, guint32 charIndex, gulong charTags) { if (output->fOutChars != NULL) { - output->fOutChars[output->fOutIndex] = ch; - output->fCharIndices[output->fOutIndex] = output->fOriginalOffsets[charIndex]; - output->fCharTags[output->fOutIndex] = charTags; + output->fOutChars[output->fOutIndex] = ch; + output->fCharIndices[output->fOutIndex] = output->fOriginalOffsets[charIndex]; + output->fCharTags[output->fOutIndex] = charTags; } output->fOutIndex += 1; @@ -178,47 +178,47 @@ static void writeChar(Output *output, gunichar ch, guint32 charIndex, gulong cha static void writeMpre(Output *output) { if (output->fMpre != 0) { - gulong tags = output->fMatraTags; + gulong tags = output->fMatraTags; if (output->fMatraWordStart) tags &= ~init; - output->fMPreOutIndex = output->fOutIndex; - writeChar(output, output->fMpre, output->fMatraIndex, tags); + output->fMPreOutIndex = output->fOutIndex; + writeChar(output, output->fMpre, output->fMatraIndex, tags); } } static void writeMbelow(Output *output) { if (output->fMbelow != 0) { - writeChar(output, output->fMbelow, output->fMatraIndex, output->fMatraTags); + writeChar(output, output->fMbelow, output->fMatraIndex, output->fMatraTags); } } static void writeMabove(Output *output) { if (output->fMabove != 0) { - writeChar(output, output->fMabove, output->fMatraIndex, output->fMatraTags); + writeChar(output, output->fMabove, output->fMatraIndex, output->fMatraTags); } } static void writeMpost(Output *output) { if (output->fMpost != 0) { - writeChar(output, output->fMpost, output->fMatraIndex, output->fMatraTags); + writeChar(output, output->fMpost, output->fMatraIndex, output->fMatraTags); } } static void writeLengthMark(Output *output) { if (output->fLengthMark != 0) { - writeChar(output, output->fLengthMark, output->fMatraIndex, output->fMatraTags); + writeChar(output, output->fLengthMark, output->fMatraIndex, output->fMatraTags); } } static void writeAlLakuna(Output *output) { if (output->fAlLakuna != 0) { - writeChar(output, output->fAlLakuna, output->fMatraIndex, output->fMatraTags); + writeChar(output, output->fAlLakuna, output->fMatraIndex, output->fMatraTags); } } @@ -244,87 +244,87 @@ glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong c initOutput(&output, utf8_offsets, out_chars, char_indices, char_tags, mpreFixups); while (prev < char_count) { - glong syllable = indic_ot_find_syllable(class_table, chars, prev, char_count); - glong matra, vmabove, vmpost = syllable; + glong syllable = indic_ot_find_syllable(class_table, chars, prev, char_count); + glong matra, vmabove, vmpost = syllable; - while (vmpost > prev && indic_ot_is_vm_post(class_table, chars[vmpost - 1])) { - vmpost -= 1; - } + while (vmpost > prev && indic_ot_is_vm_post(class_table, chars[vmpost - 1])) { + vmpost -= 1; + } - vmabove = vmpost; - while (vmabove > prev && indic_ot_is_vm_above(class_table, chars[vmabove - 1])) { - vmabove -= 1; - } + vmabove = vmpost; + while (vmabove > prev && indic_ot_is_vm_above(class_table, chars[vmabove - 1])) { + vmabove -= 1; + } - matra = vmabove - 1; + matra = vmabove - 1; initMatra(&output, prev, blwf_p, !last_in_word); - while (noteMatra(&output, class_table, chars[matra]) && - matra != prev) - matra--; + while (noteMatra(&output, class_table, chars[matra]) && + matra != prev) + matra--; last_in_word = TRUE; - switch (indic_ot_get_char_class(class_table, chars[prev]) & CF_CLASS_MASK) { - case CC_RESERVED: + switch (indic_ot_get_char_class(class_table, chars[prev]) & CF_CLASS_MASK) { + case CC_RESERVED: last_in_word = FALSE; /* Fall through */ - case CC_INDEPENDENT_VOWEL: - case CC_ZERO_WIDTH_MARK: - for (i = prev; i < syllable; i += 1) { - writeChar(&output, chars[i], /*i*/ prev, blwf_p); - } - - break; - - case CC_MODIFYING_MARK_ABOVE: - case CC_MODIFYING_MARK_POST: - case CC_NUKTA: - case CC_VIRAMA: - case CC_AL_LAKUNA: - writeChar(&output, C_DOTTED_CIRCLE, prev, blwf_p); - writeChar(&output, chars[prev], prev, blwf_p); - break; - - case CC_DEPENDENT_VOWEL: - writeMpre(&output); - writeChar(&output, C_DOTTED_CIRCLE, prev, blwf_p); - writeMbelow(&output); - writeMabove(&output); - writeMpost(&output); - writeLengthMark(&output); - writeAlLakuna(&output); - break; - - case CC_CONSONANT: - case CC_CONSONANT_WITH_NUKTA: - { - guint32 length = vmabove - prev; - glong lastConsonant = vmabove - 1; - glong baseLimit = prev; - glong baseConsonant, postBase, postBaseLimit; + case CC_INDEPENDENT_VOWEL: + case CC_ZERO_WIDTH_MARK: + for (i = prev; i < syllable; i += 1) { + writeChar(&output, chars[i], /*i*/ prev, blwf_p); + } + + break; + + case CC_MODIFYING_MARK_ABOVE: + case CC_MODIFYING_MARK_POST: + case CC_NUKTA: + case CC_VIRAMA: + case CC_AL_LAKUNA: + writeChar(&output, C_DOTTED_CIRCLE, prev, blwf_p); + writeChar(&output, chars[prev], prev, blwf_p); + break; + + case CC_DEPENDENT_VOWEL: + writeMpre(&output); + writeChar(&output, C_DOTTED_CIRCLE, prev, blwf_p); + writeMbelow(&output); + writeMabove(&output); + writeMpost(&output); + writeLengthMark(&output); + writeAlLakuna(&output); + break; + + case CC_CONSONANT: + case CC_CONSONANT_WITH_NUKTA: + { + guint32 length = vmabove - prev; + glong lastConsonant = vmabove - 1; + glong baseLimit = prev; + glong baseConsonant, postBase, postBaseLimit; gboolean seenVattu, seenBelowBaseForm, supressVattu; glong bcSpan; - /* Check for REPH at front of syllable */ - if (length > 2 && indic_ot_is_reph(class_table, chars[prev]) && indic_ot_is_virama(class_table, chars[prev + 1])) { - baseLimit += 2; - - /* Check for eyelash RA, if the script supports it */ - if ((class_table->scriptFlags & SF_EYELASH_RA) != 0 && - chars[baseLimit] == C_SIGN_ZWJ) { - if (length > 3) { - baseLimit += 1; - } else { - baseLimit -= 2; - } - } - } + /* Check for REPH at front of syllable */ + if (length > 2 && indic_ot_is_reph(class_table, chars[prev]) && indic_ot_is_virama(class_table, chars[prev + 1])) { + baseLimit += 2; + + /* Check for eyelash RA, if the script supports it */ + if ((class_table->scriptFlags & SF_EYELASH_RA) != 0 && + chars[baseLimit] == C_SIGN_ZWJ) { + if (length > 3) { + baseLimit += 1; + } else { + baseLimit -= 2; + } + } + } - while (lastConsonant > baseLimit && !indic_ot_is_consonant(class_table, chars[lastConsonant])) { - lastConsonant -= 1; - } + while (lastConsonant > baseLimit && !indic_ot_is_consonant(class_table, chars[lastConsonant])) { + lastConsonant -= 1; + } - baseConsonant = lastConsonant; - postBase = lastConsonant + 1; + baseConsonant = lastConsonant; + postBase = lastConsonant + 1; postBaseLimit = class_table->scriptFlags & SF_POST_BASE_LIMIT_MASK; seenVattu = false; @@ -412,7 +412,7 @@ glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong c } } - /* note the base consonant for post-GSUB fixups */ + /* note the base consonant for post-GSUB fixups */ noteBaseConsonant(&output); /* write base consonant */ @@ -420,7 +420,7 @@ glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong c writeChar(&output, chars[i], /*i*/ prev, nukt_p); } - /* for the special conjuction of Cons+0x0d4d+0x0d31 or Cons+0x0d4d+0x0d30 of Malayalam */ + /* for the special conjuction of Cons+0x0d4d+0x0d31 or Cons+0x0d4d+0x0d30 of Malayalam */ if ((baseConsonant - 2 >= 0) && (chars[baseConsonant - 1] == 0x0d4d) && ((chars[baseConsonant] == 0x0d31) || @@ -429,25 +429,25 @@ glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong c (chars[baseConsonant - 2] <= 0x0d39))) { swapChars (&output, -1, -3); - if (mpreFixups) { + if (mpreFixups) { if (mpreFixups->fFixupCount > 0) { - mpreFixups->fFixupCount--; + mpreFixups->fFixupCount--; } - } + } } if ((class_table->scriptFlags & SF_MATRAS_AFTER_BASE) != 0) { gboolean is_for_0C48 = FALSE; - if (output.fOutChars != NULL) { /*for 0x0C48 of Telugu*/ + if (output.fOutChars != NULL) { /*for 0x0C48 of Telugu*/ int t; for (t = prev; t < syllable; t++) { - if (chars[t] == 0x0C48) { + if (chars[t] == 0x0C48) { writeMabove(&output); writeMbelow(&output); writeMpost(&output); - is_for_0C48 = TRUE; - break; + is_for_0C48 = TRUE; + break; } } } @@ -532,15 +532,15 @@ glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong c writeChar(&output, chars[i], /*i*/ prev, blwf_p); } - break; - } + break; + } - default: - break; - } + default: + break; + } - prev = syllable; + prev = syllable; } if (outMPreFixups) { diff --git a/modules/khmer/khmer-fc.c b/modules/khmer/khmer-fc.c index 3a92b05..563a0cf 100644 --- a/modules/khmer/khmer-fc.c +++ b/modules/khmer/khmer-fc.c @@ -315,7 +315,7 @@ static const gint8 khmerStateTable[][CC_COUNT] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 1 - exit state (or sign to the right of the syllable) */ {-1, -1, -1, -1, 3, 4, 5, 6, 16, 17, 1, -1}, /* 2 - Base consonant */ {-1, -1, -1, -1, -1, 4, -1, -1, 16, -1, -1, -1}, /* 3 - First ZWNJ before a register shifter - It can only be followed by a shifter or a vowel */ + It can only be followed by a shifter or a vowel */ {-1, -1, -1, -1, 15, -1, -1, 6, 16, 17, 1, 14}, /* 4 - First register shifter */ {-1, -1, -1, -1, -1, -1, -1, -1, 20, -1, 1, -1}, /* 5 - Robat */ {-1, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1}, /* 6 - First Coeng */ @@ -417,35 +417,35 @@ find_syllable (const gunichar *chars, static void maybe_add_GSUB_feature (PangoOTRuleset *ruleset, - PangoOTInfo *info, - guint script_index, - PangoOTTag tag, - gulong property_bit) + PangoOTInfo *info, + guint script_index, + PangoOTTag tag, + gulong property_bit) { guint feature_index; /* 0xffff == default language system */ if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GSUB, - tag, script_index, 0xffff, &feature_index)) + tag, script_index, 0xffff, &feature_index)) pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GSUB, feature_index, - property_bit); + property_bit); } static void maybe_add_GPOS_feature (PangoOTRuleset *ruleset, - PangoOTInfo *info, - guint script_index, - PangoOTTag tag, - gulong property_bit) + PangoOTInfo *info, + guint script_index, + PangoOTTag tag, + gulong property_bit) { guint feature_index; /* 0xffff == default language system */ if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GPOS, - tag, script_index, 0xffff, &feature_index)) + tag, script_index, 0xffff, &feature_index)) pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GPOS, feature_index, - property_bit); + property_bit); } @@ -473,31 +473,31 @@ get_ruleset (FT_Face face) ruleset = pango_ot_ruleset_new (info); if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, - khmer_tag, &script_index)) - { - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','r','e','f'), pref); - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('b','l','w','f'), blwf); - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('a','b','v','f'), abvf); - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','s','t','f'), pstf); - - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','r','e','s'), pres); - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('b','l','w','s'), blws); - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('a','b','v','s'), abvs); - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','s','t','s'), psts); - maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('c','l','i','g'), clig); - } + khmer_tag, &script_index)) + { + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','r','e','f'), pref); + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('b','l','w','f'), blwf); + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('a','b','v','f'), abvf); + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','s','t','f'), pstf); + + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','r','e','s'), pres); + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('b','l','w','s'), blws); + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('a','b','v','s'), abvs); + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','s','t','s'), psts); + maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('c','l','i','g'), clig); + } if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, - khmer_tag, &script_index)) - { - maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('d','i','s','t'), dist); - maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('b','l','w','m'), blwm); - maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('a','b','v','m'), abvm); - maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('m','k','m','k'), mkmk); - } + khmer_tag, &script_index)) + { + maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('d','i','s','t'), dist); + maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('b','l','w','m'), blwm); + maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('a','b','v','m'), abvm); + maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('m','k','m','k'), mkmk); + } g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, - (GDestroyNotify)g_object_unref); + (GDestroyNotify)g_object_unref); } return ruleset; @@ -516,11 +516,11 @@ get_index (PangoFcFont *fc_font, gunichar wc) static void khmer_engine_shape (PangoEngineShape *engine, - PangoFont *font, - const char *text, - int length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs) + PangoFont *font, + const char *text, + int length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs) { PangoFcFont *fc_font; FT_Face face; @@ -563,43 +563,43 @@ khmer_engine_shape (PangoEngineShape *engine, syllable = find_syllable (wcs, cursor, n_chars); for (i = cursor; i < syllable; i += 1) - { - charClass = get_char_class (wcs[i]); - - /* if a split vowel, write the pre part. In Khmer the pre part - * is the same for all split vowels, same glyph as pre vowel C_VOWEL_E - */ - if (charClass & CF_SPLIT_VOWEL) - { - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, C_VOWEL_E), pref_p, p - text); - break; /* there can be only one vowel */ - } - - /* if a vowel with pos before write it out */ - if (charClass & CF_POS_BEFORE) - { - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), pref_p, p - text); - break; /* there can be only one vowel */ - } - - /* look for coeng + ro and remember position - * works because coeng + ro is always in front of a vowel (if there is a vowel) - * and because CC_CONSONANT2 is enough to identify it, as it is the only consonant - * with this flag - */ - if ((charClass & CF_COENG) && (i + 1 < syllable) && - ((get_char_class (wcs[i + 1]) & CF_CLASS_MASK) == CC_CONSONANT2)) - { - coengRo = i; - } - } + { + charClass = get_char_class (wcs[i]); + + /* if a split vowel, write the pre part. In Khmer the pre part + * is the same for all split vowels, same glyph as pre vowel C_VOWEL_E + */ + if (charClass & CF_SPLIT_VOWEL) + { + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, C_VOWEL_E), pref_p, p - text); + break; /* there can be only one vowel */ + } + + /* if a vowel with pos before write it out */ + if (charClass & CF_POS_BEFORE) + { + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), pref_p, p - text); + break; /* there can be only one vowel */ + } + + /* look for coeng + ro and remember position + * works because coeng + ro is always in front of a vowel (if there is a vowel) + * and because CC_CONSONANT2 is enough to identify it, as it is the only consonant + * with this flag + */ + if ((charClass & CF_COENG) && (i + 1 < syllable) && + ((get_char_class (wcs[i + 1]) & CF_CLASS_MASK) == CC_CONSONANT2)) + { + coengRo = i; + } + } /* write coeng + ro if found */ if (coengRo > -1) - { - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, C_COENG), pref_p, p - text); - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, C_RO), pref_p, p - text); - } + { + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, C_COENG), pref_p, p - text); + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, C_RO), pref_p, p - text); + } /* shall we add a dotted circle? * If in the position in which the base should be (first char in the string) there is @@ -607,51 +607,51 @@ khmer_engine_shape (PangoEngineShape *engine, * then write a dotted circle */ if (get_char_class (wcs[cursor]) & CF_DOTTED_CIRCLE) - { - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, C_DOTTED_CIRCLE), default_p, p - text); - } + { + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, C_DOTTED_CIRCLE), default_p, p - text); + } /* copy what is left to the output, skipping before vowels and * coeng Ro if they are present */ for (i = cursor; i < syllable; i += 1) - { - charClass = get_char_class (wcs[i]); - - /* skip a before vowel, it was already processed */ - if (charClass & CF_POS_BEFORE) - { - p = g_utf8_next_char (p); - continue; - } - - /* skip coeng + ro, it was already processed */ - if (i == coengRo) - { - p = g_utf8_next_char (p); - i += 1; - p = g_utf8_next_char (p); - continue; - } - - switch (charClass & CF_POS_MASK) - { - case CF_POS_ABOVE : + { + charClass = get_char_class (wcs[i]); + + /* skip a before vowel, it was already processed */ + if (charClass & CF_POS_BEFORE) + { + p = g_utf8_next_char (p); + continue; + } + + /* skip coeng + ro, it was already processed */ + if (i == coengRo) + { + p = g_utf8_next_char (p); + i += 1; + p = g_utf8_next_char (p); + continue; + } + + switch (charClass & CF_POS_MASK) + { + case CF_POS_ABOVE : pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), abvf_p, p - text); break; - case CF_POS_AFTER : + case CF_POS_AFTER : pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), pstf_p, p - text); break; - case CF_POS_BELOW : + case CF_POS_BELOW : pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); break; - default: - /* assign the correct flags to a coeng consonant - * Consonants of type 3 are taged as Post forms and those type 1 as below forms - */ + default: + /* assign the correct flags to a coeng consonant + * Consonants of type 3 are taged as Post forms and those type 1 as below forms + */ if ((charClass & CF_COENG) && i + 1 < syllable) { if ((get_char_class (wcs[i + 1]) & CF_CLASS_MASK) == CC_CONSONANT3) @@ -672,47 +672,47 @@ khmer_engine_shape (PangoEngineShape *engine, } } - /* if a shifter is followed by an above vowel change the shifter to below form, - * an above vowel can have two possible positions i + 1 or i + 3 - * (position i+1 corresponds to unicode 3, position i+3 to Unicode 4) - * and there is an extra rule for C_VOWEL_AA + C_SIGN_NIKAHIT also for two - * different positions, right after the shifter or after a vowel (Unicode 4) - */ - if ((charClass & CF_SHIFTER) && (i + 1 < syllable)) - { - if (get_char_class (wcs[i + 1]) & CF_ABOVE_VOWEL) - { - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); - break; - } - if (i + 2 < syllable && - (wcs[i + 1] == C_VOWEL_AA) && - (wcs[i + 2] == C_SIGN_NIKAHIT) ) - { - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); - break; - } - if (i + 3 < syllable && (get_char_class (wcs[i + 3]) & CF_ABOVE_VOWEL) ) - { - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); - break; - } - if (i + 4 < syllable && - (wcs[i + 3] == C_VOWEL_AA) && - (wcs[i + 4] == C_SIGN_NIKAHIT) ) - { - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); - break; - } - - } - - /* default - any other characters */ - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), default_p, p - text); - break; - } /* switch */ - p = g_utf8_next_char (p); - } /* for */ + /* if a shifter is followed by an above vowel change the shifter to below form, + * an above vowel can have two possible positions i + 1 or i + 3 + * (position i+1 corresponds to unicode 3, position i+3 to Unicode 4) + * and there is an extra rule for C_VOWEL_AA + C_SIGN_NIKAHIT also for two + * different positions, right after the shifter or after a vowel (Unicode 4) + */ + if ((charClass & CF_SHIFTER) && (i + 1 < syllable)) + { + if (get_char_class (wcs[i + 1]) & CF_ABOVE_VOWEL) + { + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); + break; + } + if (i + 2 < syllable && + (wcs[i + 1] == C_VOWEL_AA) && + (wcs[i + 2] == C_SIGN_NIKAHIT) ) + { + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); + break; + } + if (i + 3 < syllable && (get_char_class (wcs[i + 3]) & CF_ABOVE_VOWEL) ) + { + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); + break; + } + if (i + 4 < syllable && + (wcs[i + 3] == C_VOWEL_AA) && + (wcs[i + 4] == C_SIGN_NIKAHIT) ) + { + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); + break; + } + + } + + /* default - any other characters */ + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), default_p, p - text); + break; + } /* switch */ + p = g_utf8_next_char (p); + } /* for */ cursor = syllable; /* move the pointer to the start of next syllable */ } /* while */ @@ -741,7 +741,7 @@ khmer_engine_fc_class_init (PangoEngineShapeClass *class) } PANGO_ENGINE_SHAPE_DEFINE_TYPE (KhmerEngineFc, khmer_engine_fc, - khmer_engine_fc_class_init, NULL) + khmer_engine_fc_class_init, NULL) void @@ -759,7 +759,7 @@ PANGO_MODULE_ENTRY(exit) (void) void PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) + int *n_engines) { *engines = script_engines; *n_engines = G_N_ELEMENTS (script_engines); diff --git a/modules/syriac/syriac-ot.c b/modules/syriac/syriac-ot.c index 4650c9d..abbe856 100644 --- a/modules/syriac/syriac-ot.c +++ b/modules/syriac/syriac-ot.c @@ -77,12 +77,12 @@ Get_Joining_Class (gunichar* string, while (1) { if (pos == 0 && direction < 0) - return none; + return none; pos += direction; if (pos >= length) - return none; + return none; if (string[pos] < 0x0700 || string[pos] >= 0x074F) @@ -93,10 +93,10 @@ Get_Joining_Class (gunichar* string, return none; } else - j = syriac[string[pos] - 0x0700]; + j = syriac[string[pos] - 0x0700]; if (!direction || j != transparent) - return j; + return j; } } @@ -230,57 +230,57 @@ syriac_assign_properties (gunichar *string, /* R1 */ if (current == transparent) - { + { properties[i] |= isolated_p; continue; - } + } /* R2 */ if (string[i] == 0x0722 || string[i] == 0x071F) - if (previous == causing || - previous == right) - if (!(next == causing || + if (previous == causing || + previous == right) + if (!(next == causing || next == right || next == dual)) - { - properties[i] |= isolated_p; - continue; - } + { + properties[i] |= isolated_p; + continue; + } /* R3 */ if (string[i] == 0x0710) - if (previous == causing || - previous == right) - if (!(string[i - 1] == 0x0715 || + if (previous == causing || + previous == right) + if (!(string[i - 1] == 0x0715 || string[i - 1] == 0x0716 || string[i - 1] == 0x072A)) - { - properties[i] |= final2_p; - continue; - } + { + properties[i] |= final2_p; + continue; + } /* R4 */ if (string[i] == 0x0710) - if (previous == causing || - previous == right) - if (string[i - 1] == 0x0715 || - string[i - 1] == 0x0716 || - string[i - 1] == 0x072A) - { - properties[i] |= final3_p; - continue; - } + if (previous == causing || + previous == right) + if (string[i - 1] == 0x0715 || + string[i - 1] == 0x0716 || + string[i - 1] == 0x072A) + { + properties[i] |= final3_p; + continue; + } /* R5 */ if (previous == causing || previous == right || previous == dual) - if (current == right) + if (current == right) { properties[i] |= final_p; continue; @@ -289,50 +289,50 @@ syriac_assign_properties (gunichar *string, /* R6 */ if (previous == causing || - previous == right || + previous == right || previous == dual) - if (current == dual) - if (!(next == causing || + if (current == dual) + if (!(next == causing || next == right || next == dual )) { - properties[i] |= final_p; - continue; + properties[i] |= final_p; + continue; } /* R7 */ if (previous == causing || - previous == left || - previous == dual) - if (current == dual) - if (next == causing || - next == right || - next == dual ) + previous == left || + previous == dual) + if (current == dual) + if (next == causing || + next == right || + next == dual ) { - properties[i] |= medial_p; - continue; + properties[i] |= medial_p; + continue; } /* R8 */ if (string[i] == 0x0710) - if (previous == causing || - previous == right) - if (next == causing || - next == right || - next == dual) - { - properties[i] |= medial2_p; - continue; - } + if (previous == causing || + previous == right) + if (next == causing || + next == right || + next == dual) + { + properties[i] |= medial2_p; + continue; + } /* R9 */ if (current == left) - if (next == causing || - next == right || - next == dual) + if (next == causing || + next == right || + next == dual) { properties[i] |= initial_p; continue; @@ -343,13 +343,13 @@ syriac_assign_properties (gunichar *string, if (!(previous == causing || previous == left || previous == dual )) - if (current == dual) - if (next == causing || - next == right || - next == dual) + if (current == dual) + if (next == causing || + next == right || + next == dual) { - properties[i] |= initial_p; - continue; + properties[i] |= initial_p; + continue; } /* R11 */ diff --git a/modules/thai/thai-charprop.c b/modules/thai/thai-charprop.c index a05592b..26e1331 100644 --- a/modules/thai/thai-charprop.c +++ b/modules/thai/thai-charprop.c @@ -28,92 +28,92 @@ const gshort thai_char_type[256] = { /* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F */ + 8, 9, A, B, C, D, E, F */ - /* CL1 */ + /* CL1 */ /*00*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, + _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, /*10*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, + _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /* Lao zone: [U+0E80..U+0EDF] */ + /* Lao zone: [U+0E80..U+0EDF] */ /*20*/ _ND, _NC, _NC, _ND, _NC, _ND, _ND, _NC, - _NC, _ND, _NC, _ND, _ND, _NC, _ND, _ND, + _NC, _ND, _NC, _ND, _ND, _NC, _ND, _ND, /*30*/ _ND, _ND, _ND, _ND, _NC, _NC, _NC, _NC, - _ND, _NC, _NC, _UC, _NC, _UC, _NC, _UC, + _ND, _NC, _NC, _UC, _NC, _UC, _NC, _UC, /*40*/ _ND, _NC, _UC, _NC, _ND, _NC, _ND, _NC, - _ND, _ND, _NC, _NC, _ND, _NC, _NC, _ND, + _ND, _ND, _NC, _NC, _ND, _NC, _NC, _ND, /*50*/ _ND, _AV, _ND, _AM, _AV, _AV, _AV, _AV, - _BV, _BV, _ND, _AV, _BD, _NC, _ND, _ND, + _BV, _BV, _ND, _AV, _BD, _NC, _ND, _ND, /*60*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _AD, - _TN, _TN, _TN, _TN, _AD, _AD, _ND, _ND, + _TN, _TN, _TN, _TN, _AD, _AD, _ND, _ND, /*70*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _NC, _NC, _ND, _ND, + _ND, _ND, _ND, _ND, _NC, _NC, _ND, _ND, - /* CL2 */ + /* CL2 */ /*80*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, + _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, /*90*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, + _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /* Thai zone: [U+0E00..U+0E5F] */ + /* Thai zone: [U+0E00..U+0E5F] */ /*A0*/ _ND, _NC, _NC, _NC, _NC, _NC, _NC, _NC, - _NC, _NC, _NC, _NC, _NC, _SC, _BC, _BC, + _NC, _NC, _NC, _NC, _NC, _SC, _BC, _BC, /*B0*/ _SC, _NC, _NC, _NC, _NC, _NC, _NC, _NC, - _NC, _NC, _NC, _UC, _NC, _UC, _NC, _UC, + _NC, _NC, _NC, _UC, _NC, _UC, _NC, _UC, /*C0*/ _NC, _NC, _NC, _NC, _ND, _NC, _ND, _NC, - _NC, _NC, _NC, _NC, _UC, _NC, _NC, _ND, + _NC, _NC, _NC, _NC, _UC, _NC, _NC, _ND, /*D0*/ _ND, _AV, _ND, _AM, _AV, _AV, _AV, _AV, - _BV, _BV, _BD, _ND, _ND, _ND, _ND, _ND, + _BV, _BV, _BD, _ND, _ND, _ND, _ND, _ND, /*E0*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _AD, - _TN, _TN, _TN, _TN, _AD, _AD, _AD, _ND, + _TN, _TN, _TN, _TN, _AD, _AD, _AD, _ND, /*F0*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, + _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, }; const gshort thai_TAC_char_class[256] = { /* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F */ + 8, 9, A, B, C, D, E, F */ - /* CL1 */ + /* CL1 */ /*00*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, + CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, /*10*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, + CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - /* Lao zone: [U+0E80..U+0EDF] */ + /* Lao zone: [U+0E80..U+0EDF] */ /*20*/ NON,CONS,CONS, NON,CONS, NON, NON,CONS, - CONS, NON,CONS, NON, NON,CONS, NON, NON, + CONS, NON,CONS, NON, NON,CONS, NON, NON, /*30*/ NON, NON, NON, NON,CONS,CONS,CONS,CONS, - NON,CONS,CONS,CONS,CONS,CONS,CONS,CONS, + NON,CONS,CONS,CONS,CONS,CONS,CONS,CONS, /*40*/ NON,CONS,CONS,CONS, NON,CONS, NON,CONS, - NON, NON,CONS,CONS, NON,CONS,CONS, NON, + NON, NON,CONS,CONS, NON,CONS,CONS, NON, /*50*/ FV1, AV2, FV1, AM, AV1, AV3, AV2, AV3, - BV1, BV2, NON, AV2,BCON, FV3, NON, NON, + BV1, BV2, NON, AV2,BCON, FV3, NON, NON, /*60*/ LV, LV, LV, LV, LV, NON, NON, NON, - TONE,TONE,TONE,TONE, AD1, AD4, NON, NON, + TONE,TONE,TONE,TONE, AD1, AD4, NON, NON, /*70*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON,CONS,CONS, NON,CTRL, + NON, NON, NON, NON,CONS,CONS, NON,CTRL, - /* CL2 */ + /* CL2 */ /*80*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, + CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, /*90*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, + CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - /* Thai zone: [U+0E00..U+0E5F] */ + /* Thai zone: [U+0E00..U+0E5F] */ /*A0*/ NON,CONS,CONS,CONS,CONS,CONS,CONS,CONS, - CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS, + CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS, /*B0*/ CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS, - CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS, + CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS, /*C0*/ CONS,CONS,CONS,CONS, FV3,CONS, FV3,CONS, - CONS,CONS,CONS,CONS,CONS,CONS,CONS, NON, + CONS,CONS,CONS,CONS,CONS,CONS,CONS, NON, /*D0*/ FV1, AV2, FV1, AM, AV1, AV3, AV2, AV3, - BV1, BV2, BD, NON, NON, NON, NON, NON, + BV1, BV2, BD, NON, NON, NON, NON, NON, /*E0*/ LV, LV, LV, LV, LV, FV2, NON, AD2, - TONE,TONE,TONE,TONE, AD1, AD4, AD3, NON, + TONE,TONE,TONE,TONE, AD1, AD4, AD3, NON, /*F0*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON,CTRL, + NON, NON, NON, NON, NON, NON, NON,CTRL, }; const gchar thai_TAC_compose_input[20][20] = { @@ -121,44 +121,44 @@ const gchar thai_TAC_compose_input[20][20] = { /*CTRL NON CONS LV FV1 FV2 FV3 AM BV1 BV2 * BD TONE AD1 AD2 AD3 AD4 AV1 AV2 AV3 BCON*/ /*CTRL*/{'X','A','A','A','A','A','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*NON */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*CONS*/{'X','A','A','A','A','S','A','C','C','C', - 'C','C','C','C','C','C','C','C','C','C'}, + 'C','C','C','C','C','C','C','C','C','C'}, /*LV */{'X','S','A','S','S','S','S','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*FV1 */{'X','A','A','A','A','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*FV2 */{'X','A','A','A','A','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*FV3 */{'X','A','A','A','S','A','S','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*AM */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*BV1 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','C','R','R','C','R','R','R','R'}, + 'R','C','C','R','R','C','R','R','R','R'}, /*BV2 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','R','R','R','R','R','R','R','R'}, + 'R','C','R','R','R','R','R','R','R','R'}, /*BD */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*TONE*/{'X','A','A','A','A','A','A','C','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*AD1 */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*AD2 */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*AD3 */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, + 'R','R','R','R','R','R','R','R','R','R'}, /*AD4 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','R','R','R','R','R','R','R','R'}, + 'R','C','R','R','R','R','R','R','R','R'}, /*AV1 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','C','R','R','C','R','R','R','R'}, + 'R','C','C','R','R','C','R','R','R','R'}, /*AV2 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','R','R','R','R','R','R','R','R'}, + 'R','C','R','R','R','R','R','R','R','R'}, /*AV3 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','R','C','R','R','R','R','R','R'}, + 'R','C','R','C','R','R','R','R','R','R'}, /*BCON*/{'X','A','A','A','A','S','A','C','C','C', - 'R','C','R','R','R','C','C','C','C','R'}, + 'R','C','R','R','R','C','C','C','C','R'}, }; diff --git a/modules/thai/thai-fc.c b/modules/thai/thai-fc.c index ebb2e97..40ba884 100644 --- a/modules/thai/thai-fc.c +++ b/modules/thai/thai-fc.c @@ -126,7 +126,7 @@ static const int lao_0[128] = { /**/ 0, 0, 0, 0, 0, 0, 0, 0, 0x0020, 0x0e81, 0x0e82, 0, 0x0e84, 0, 0, 0x0e87, 0x0e88, 0, 0x0e8a, 0, 0, 0x0e8d, 0, 0, - 0, 0, 0, 0, 0x0e94, 0x0e95, 0x0e96, 0x0e97, + 0, 0, 0, 0, 0x0e94, 0x0e95, 0x0e96, 0x0e97, /**/ 0, 0x0e99, 0x0e9a, 0x0e9b, 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, /**/ 0, 0x0ea1, 0x0ea2, 0x0ea3, 0, 0x0ea5, 0, 0x0ea7, /**/ 0, 0, 0x0eaa, 0x0eab, 0, 0x0ead, 0x0eae, 0x0eaf, @@ -146,10 +146,10 @@ contain_glyphs(PangoFont *font, const int glyph_map[128]) for (c = 0; c < 0x80; c++) { if (glyph_map[c]) - { + { if (!pango_fc_font_has_char (fc_font, glyph_map[c])) - return 0; - } + return 0; + } } return 1; } @@ -175,13 +175,13 @@ thai_get_font_info (PangoFont *font) /* detect font set by determining availibility of OT ruleset & glyphs */ if (thai_ot_get_ruleset (font)) - font_info->font_set = THAI_FONT_TIS; + font_info->font_set = THAI_FONT_TIS; else if (contain_glyphs(font, tis620_2)) - font_info->font_set = THAI_FONT_TIS_WIN; + font_info->font_set = THAI_FONT_TIS_WIN; else if (contain_glyphs(font, tis620_1)) - font_info->font_set = THAI_FONT_TIS_MAC; + font_info->font_set = THAI_FONT_TIS_MAC; else - font_info->font_set = THAI_FONT_TIS; + font_info->font_set = THAI_FONT_TIS; g_object_set_qdata_full (G_OBJECT (font), info_id, font_info, (GDestroyNotify)g_free); } diff --git a/modules/thai/thai-lang.c b/modules/thai/thai-lang.c index a6fe45c..83d1642 100644 --- a/modules/thai/thai-lang.c +++ b/modules/thai/thai-lang.c @@ -69,11 +69,11 @@ utf8_to_tis (const char *text, int len) static void thai_engine_break (PangoEngineLang *engine, - const char *text, - int len, - PangoAnalysis *analysis, - PangoLogAttr *attrs, - int attrs_len) + const char *text, + int len, + PangoAnalysis *analysis, + PangoLogAttr *attrs, + int attrs_len) { thchar_t *tis_text; @@ -88,11 +88,11 @@ thai_engine_break (PangoEngineLang *engine, /* find line break positions */ brk_n = th_brk (tis_text, brk_pnts, brk_len); for (i = 0; i < brk_n; i++) - { - attrs[brk_pnts[i]].is_line_break = TRUE; - attrs[brk_pnts[i]].is_word_start = TRUE; - attrs[brk_pnts[i]].is_word_end = TRUE; - } + { + attrs[brk_pnts[i]].is_line_break = TRUE; + attrs[brk_pnts[i]].is_word_start = TRUE; + attrs[brk_pnts[i]].is_word_end = TRUE; + } g_free (brk_pnts); g_free (tis_text); @@ -106,7 +106,7 @@ thai_engine_lang_class_init (PangoEngineLangClass *class) } PANGO_ENGINE_LANG_DEFINE_TYPE (ThaiEngineLang, thai_engine_lang, - thai_engine_lang_class_init, NULL); + thai_engine_lang_class_init, NULL); void PANGO_MODULE_ENTRY(init) (GTypeModule *module) diff --git a/modules/thai/thai-ot.c b/modules/thai/thai-ot.c index 66c129c..b686632 100644 --- a/modules/thai/thai-ot.c +++ b/modules/thai/thai-ot.c @@ -47,7 +47,7 @@ maybe_add_gsub_feature (PangoOTRuleset *ruleset, static gint maybe_add_gpos_feature (PangoOTRuleset *ruleset, - PangoOTInfo *info, + PangoOTInfo *info, guint script_index, PangoOTTag feature_tag, gulong property_bit) @@ -85,51 +85,51 @@ thai_ot_get_ruleset (PangoFont *font) static GQuark ruleset_quark = 0; if (!ruleset_quark) - ruleset_quark = g_quark_from_string ("thai-ot-ruleset"); + ruleset_quark = g_quark_from_string ("thai-ot-ruleset"); ruleset = g_object_get_qdata (G_OBJECT (info), ruleset_quark); if (!ruleset) - { - PangoOTTag thai_tag = FT_MAKE_TAG ('t', 'h', 'a', 'i'); - guint script_index; - gint n = 0; + { + PangoOTTag thai_tag = FT_MAKE_TAG ('t', 'h', 'a', 'i'); + guint script_index; + gint n = 0; - ruleset = pango_ot_ruleset_new (info); + ruleset = pango_ot_ruleset_new (info); - if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, - thai_tag, &script_index)) + if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, + thai_tag, &script_index)) { n += maybe_add_gsub_feature (ruleset, info, script_index, - FT_MAKE_TAG ('c','c','m','p'), + FT_MAKE_TAG ('c','c','m','p'), 0xFFFF); n += maybe_add_gsub_feature (ruleset, info, script_index, - FT_MAKE_TAG ('l','i','g','a'), + FT_MAKE_TAG ('l','i','g','a'), 0xFFFF); } - if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, - thai_tag, &script_index)) + if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, + thai_tag, &script_index)) { n += maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('k','e','r','n'), + FT_MAKE_TAG ('k','e','r','n'), 0xFFFF); n += maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('m','a','r','k'), + FT_MAKE_TAG ('m','a','r','k'), 0xFFFF); n += maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('m','k','m','k'), + FT_MAKE_TAG ('m','k','m','k'), 0xFFFF); } if (n > 0) - g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, + g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, (GDestroyNotify)g_object_unref); else { g_object_unref (ruleset); ruleset = NULL; } - } + } } pango_fc_font_unlock_face (fc_font); @@ -158,51 +158,51 @@ lao_ot_get_ruleset (PangoFont *font) static GQuark ruleset_quark = 0; if (!ruleset_quark) - ruleset_quark = g_quark_from_string ("lao-ot-ruleset"); + ruleset_quark = g_quark_from_string ("lao-ot-ruleset"); ruleset = g_object_get_qdata (G_OBJECT (info), ruleset_quark); if (!ruleset) - { - PangoOTTag thai_tag = FT_MAKE_TAG ('l', 'a', 'o', ' '); - guint script_index; - gint n = 0; + { + PangoOTTag thai_tag = FT_MAKE_TAG ('l', 'a', 'o', ' '); + guint script_index; + gint n = 0; - ruleset = pango_ot_ruleset_new (info); + ruleset = pango_ot_ruleset_new (info); - if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, - thai_tag, &script_index)) + if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, + thai_tag, &script_index)) { n += maybe_add_gsub_feature (ruleset, info, script_index, - FT_MAKE_TAG ('c','c','m','p'), + FT_MAKE_TAG ('c','c','m','p'), 0xFFFF); n += maybe_add_gsub_feature (ruleset, info, script_index, - FT_MAKE_TAG ('l','i','g','a'), + FT_MAKE_TAG ('l','i','g','a'), 0xFFFF); } - if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, - thai_tag, &script_index)) + if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, + thai_tag, &script_index)) { n += maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('k','e','r','n'), + FT_MAKE_TAG ('k','e','r','n'), 0xFFFF); n += maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('m','a','r','k'), + FT_MAKE_TAG ('m','a','r','k'), 0xFFFF); n += maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('m','k','m','k'), + FT_MAKE_TAG ('m','k','m','k'), 0xFFFF); } if (n > 0) - g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, + g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, (GDestroyNotify)g_object_unref); else { g_object_unref (ruleset); ruleset = NULL; } - } + } } pango_fc_font_unlock_face (fc_font); @@ -213,7 +213,7 @@ lao_ot_get_ruleset (PangoFont *font) void thai_ot_shape (PangoFont *font, - PangoGlyphString *glyphs) + PangoGlyphString *glyphs) { PangoOTRuleset *th_ruleset; PangoOTRuleset *lo_ruleset; @@ -229,23 +229,23 @@ thai_ot_shape (PangoFont *font, /* prepare ot buffer */ buffer = pango_ot_buffer_new (PANGO_FC_FONT (font)); for (i = 0; i < glyphs->num_glyphs; i++) - { - pango_ot_buffer_add_glyph (buffer, + { + pango_ot_buffer_add_glyph (buffer, glyphs->glyphs[i].glyph, 0, glyphs->log_clusters[i]); - } + } if (th_ruleset != NULL) - { - pango_ot_ruleset_substitute (th_ruleset, buffer); - pango_ot_ruleset_position (th_ruleset, buffer); - } + { + pango_ot_ruleset_substitute (th_ruleset, buffer); + pango_ot_ruleset_position (th_ruleset, buffer); + } if (lo_ruleset != NULL) - { - pango_ot_ruleset_substitute (lo_ruleset, buffer); - pango_ot_ruleset_position (lo_ruleset, buffer); - } + { + pango_ot_ruleset_substitute (lo_ruleset, buffer); + pango_ot_ruleset_position (lo_ruleset, buffer); + } pango_ot_buffer_output (buffer, glyphs); pango_ot_buffer_destroy (buffer); diff --git a/modules/thai/thai-ot.h b/modules/thai/thai-ot.h index de18bcd..21f713c 100644 --- a/modules/thai/thai-ot.h +++ b/modules/thai/thai-ot.h @@ -30,7 +30,7 @@ thai_ot_get_ruleset (PangoFont *font); void thai_ot_shape (PangoFont *font, - PangoGlyphString *glyphs); + PangoGlyphString *glyphs); #endif /* __THAI_OT_H__ */ diff --git a/modules/thai/thai-shaper.c b/modules/thai/thai-shaper.c index df6c72f..6d65a3b 100644 --- a/modules/thai/thai-shaper.c +++ b/modules/thai/thai-shaper.c @@ -164,55 +164,55 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info, switch (num_chrs) { case 1: - if (is_char_type (cluster[0], - BelowVowel|BelowDiac|AboveVowel|AboveDiac|Tone|SaraAm)) + if (is_char_type (cluster[0], + BelowVowel|BelowDiac|AboveVowel|AboveDiac|Tone|SaraAm)) { gint n; glyph_lists[0] = get_null_base_glyph (font_info); n = glyph_lists[0] ? 1 : 0; - glyph_lists[n++] = + glyph_lists[n++] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); return n; - } + } else { glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - return 1; - } - break; + return 1; + } + break; case 2: - if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], SaraAm)) + if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && + is_char_type (cluster[1], SaraAm)) { - glyph_lists[0] = + glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, shaping_table->AmComp[0]); - glyph_lists[2] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); - return 3; - } + glyph_lists[1] = thai_make_glyph_tis (font_info, shaping_table->AmComp[0]); + glyph_lists[2] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); + return 3; + } else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], SaraAm)) + is_char_type (cluster[1], SaraAm)) { glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, + glyph_lists[1] = thai_make_glyph_tis (font_info, shiftleft_tone_ad (shaping_table->AmComp[0], shaping_table)); - glyph_lists[2] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); - return 3; - } + glyph_lists[2] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); + return 3; + } else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], AboveVowel)) + is_char_type (cluster[1], AboveVowel)) { glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); glyph_lists[1] = thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); return 2; - } + } else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], AboveDiac|Tone)) + is_char_type (cluster[1], AboveDiac|Tone)) { glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); @@ -221,16 +221,16 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info, return 2; } else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], AboveVowel)) + is_char_type (cluster[1], AboveVowel)) { glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); glyph_lists[1] = thai_make_glyph_tis (font_info, shiftleft_av (ucs2tis (cluster[1]), shaping_table)); return 2; - } + } else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], AboveDiac|Tone)) + is_char_type (cluster[1], AboveDiac|Tone)) { glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); @@ -239,14 +239,14 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info, return 2; } else if (is_char_type (cluster[0], NoTailCons|UpTailCons) && - is_char_type (cluster[1], BelowVowel|BelowDiac)) + is_char_type (cluster[1], BelowVowel|BelowDiac)) { glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); glyph_lists[1] = thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); return 2; - } + } else if (is_char_type (cluster[0], BotTailCons) && is_char_type (cluster[1], BelowVowel|BelowDiac)) { @@ -258,7 +258,7 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info, return 2; } else if (is_char_type (cluster[0], SpltTailCons) && - is_char_type (cluster[1], BelowVowel|BelowDiac)) + is_char_type (cluster[1], BelowVowel|BelowDiac)) { glyph_lists[0] = thai_make_glyph_tis (font_info, tailcutcons (ucs2tis (cluster[0]), shaping_table)); @@ -277,21 +277,21 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info, thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); return n; } - break; + break; case 3: - if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], Tone) && - is_char_type (cluster[2], SaraAm)) + if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && + is_char_type (cluster[1], Tone) && + is_char_type (cluster[2], SaraAm)) { - glyph_lists[0] = + glyph_lists[0] = thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, shaping_table->AmComp[0]); - glyph_lists[2] = + glyph_lists[1] = thai_make_glyph_tis (font_info, shaping_table->AmComp[0]); + glyph_lists[2] = thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - glyph_lists[3] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); - return 4; - } + glyph_lists[3] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); + return 4; + } else if (is_char_type (cluster[0], UpTailCons) && is_char_type (cluster[1], Tone) && is_char_type (cluster[2], SaraAm)) @@ -379,12 +379,12 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info, break; default: /* e.g. Lao cluster with below cons + upper/lower vowel + tone */ - { - gint i; - for (i = 0; i < num_chrs; i++) - glyph_lists[i] = thai_make_glyph_tis (font_info, ucs2tis (cluster[i])); - return num_chrs; - } + { + gint i; + for (i = 0; i < num_chrs; i++) + glyph_lists[i] = thai_make_glyph_tis (font_info, ucs2tis (cluster[i])); + return num_chrs; + } } return 0; @@ -401,42 +401,42 @@ get_glyphs_list (ThaiFontInfo *font_info, switch (pango_script_for_unichar (cluster[0])) { case PANGO_SCRIPT_THAI: - switch (font_info->font_set) - { - default: - case THAI_FONT_NONE: - for (i=0; i < num_chrs; i++) - glyph_lists[i] = thai_make_unknown_glyph (font_info, cluster[i]); - return num_chrs; - - case THAI_FONT_TIS: + switch (font_info->font_set) + { + default: + case THAI_FONT_NONE: + for (i=0; i < num_chrs; i++) + glyph_lists[i] = thai_make_unknown_glyph (font_info, cluster[i]); + return num_chrs; + + case THAI_FONT_TIS: /* TIS620-0 + Wtt2.0 Extension */ - return get_adjusted_glyphs_list (font_info, cluster, + return get_adjusted_glyphs_list (font_info, cluster, num_chrs, glyph_lists, &tis620_0_shape_table); - case THAI_FONT_TIS_MAC: + case THAI_FONT_TIS_MAC: /* MacIntosh Extension */ - return get_adjusted_glyphs_list (font_info, cluster, + return get_adjusted_glyphs_list (font_info, cluster, num_chrs, glyph_lists, &Mac_shape_table); - case THAI_FONT_TIS_WIN: + case THAI_FONT_TIS_WIN: /* Microsoft Extension */ - return get_adjusted_glyphs_list (font_info, cluster, + return get_adjusted_glyphs_list (font_info, cluster, num_chrs, glyph_lists, &Win_shape_table); - } + } break; case PANGO_SCRIPT_LAO: - return get_adjusted_glyphs_list (font_info, cluster, - num_chrs, glyph_lists, &Lao_shape_table); + return get_adjusted_glyphs_list (font_info, cluster, + num_chrs, glyph_lists, &Lao_shape_table); default: - for (i=0; i < num_chrs; i++) + for (i=0; i < num_chrs; i++) glyph_lists[i] = thai_make_unknown_glyph (font_info, cluster[i]); - return num_chrs; + return num_chrs; } return 0; /* Quiet GCC */ @@ -485,10 +485,10 @@ is_wtt_composible (gunichar cur_wc, gunichar nxt_wc) case 'S': case 'R': case 'X': - return FALSE; + return FALSE; case 'C': - return TRUE; + return TRUE; } g_assert_not_reached (); @@ -511,11 +511,11 @@ get_next_cluster(const char *text, current = g_utf8_get_char (p); cur_script = pango_script_for_unichar (current); if (cluster_script == PANGO_SCRIPT_INVALID_CODE) - cluster_script = cur_script; + cluster_script = cur_script; if (cur_script != cluster_script || - (n_chars > 0 && - !is_wtt_composible (cluster[n_chars - 1], current))) - break; + (n_chars > 0 && + !is_wtt_composible (cluster[n_chars - 1], current))) + break; cluster[n_chars++] = current; } diff --git a/modules/thai/thai-shaper.h b/modules/thai/thai-shaper.h index 3349ed3..ea3c403 100644 --- a/modules/thai/thai-shaper.h +++ b/modules/thai/thai-shaper.h @@ -79,10 +79,10 @@ thai_make_unknown_glyph (ThaiFontInfo *font_info, gunichar uc); void thai_engine_shape (PangoEngineShape *engine, PangoFont *font, - const char *text, - gint length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs); + const char *text, + gint length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs); #endif /* __THAI_SHAPER_H__ */ diff --git a/modules/tibetan/tibetan-fc.c b/modules/tibetan/tibetan-fc.c index 95dd9e5..ff773b0 100644 --- a/modules/tibetan/tibetan-fc.c +++ b/modules/tibetan/tibetan-fc.c @@ -384,35 +384,35 @@ find_syllable (const gunichar *chars, static void maybe_add_GSUB_feature (PangoOTRuleset *ruleset, - PangoOTInfo *info, - guint script_index, - PangoOTTag tag, - gulong property_bit) + PangoOTInfo *info, + guint script_index, + PangoOTTag tag, + gulong property_bit) { guint feature_index; /* 0xffff == default language system */ if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GSUB, - tag, script_index, 0xffff, &feature_index)) + tag, script_index, 0xffff, &feature_index)) pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GSUB, feature_index, - property_bit); + property_bit); } static void maybe_add_GPOS_feature (PangoOTRuleset *ruleset, - PangoOTInfo *info, - guint script_index, - PangoOTTag tag, - gulong property_bit) + PangoOTInfo *info, + guint script_index, + PangoOTTag tag, + gulong property_bit) { guint feature_index; /* 0xffff == default language system */ if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GPOS, - tag, script_index, 0xffff, &feature_index)) + tag, script_index, 0xffff, &feature_index)) pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GPOS, feature_index, - property_bit); + property_bit); } /* Rules found in the Open type font features */ @@ -440,7 +440,7 @@ get_ruleset (FT_Face face) ruleset = pango_ot_ruleset_new (info); if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, - tibetan_tag, &script_index)) + tibetan_tag, &script_index)) { maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('p','r','e','f'), pref); maybe_add_GSUB_feature (ruleset, info, script_index, FT_MAKE_TAG ('b','l','w','f'), blwf); @@ -455,7 +455,7 @@ get_ruleset (FT_Face face) } if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, - tibetan_tag, &script_index)) + tibetan_tag, &script_index)) { maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('d','i','s','t'), dist); maybe_add_GPOS_feature (ruleset, info, script_index, FT_MAKE_TAG ('b','l','w','m'), blwm); @@ -464,7 +464,7 @@ get_ruleset (FT_Face face) } g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, - (GDestroyNotify)g_object_unref); + (GDestroyNotify)g_object_unref); } return ruleset; @@ -483,11 +483,11 @@ get_index (PangoFcFont *fc_font, gunichar wc) static void tibetan_engine_shape (PangoEngineShape *engine, - PangoFont *font, - const char *text, - int length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs) + PangoFont *font, + const char *text, + int length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs) { PangoFcFont *fc_font; FT_Face face; @@ -551,21 +551,21 @@ tibetan_engine_shape (PangoEngineShape *engine, switch (charClass & CF_POS_MASK) { case CF_POS_ABOVE : - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), abvf_p, p - text); - break; + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), abvf_p, p - text); + break; case CF_POS_AFTER : - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), pstf_p, p - text); - break; + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), pstf_p, p - text); + break; case CF_POS_BELOW : - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); - break; + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), blwf_p, p - text); + break; default: - /* default - any other characters */ - pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), default_p, p - text); - break; + /* default - any other characters */ + pango_ot_buffer_add_glyph (buffer, get_index (fc_font, wcs[i]), default_p, p - text); + break; } /* switch */ } @@ -599,7 +599,7 @@ tibetan_engine_fc_class_init (PangoEngineShapeClass *class) } PANGO_ENGINE_SHAPE_DEFINE_TYPE (TibetanEngineFc, tibetan_engine_fc, - tibetan_engine_fc_class_init, NULL) + tibetan_engine_fc_class_init, NULL) void @@ -617,7 +617,7 @@ PANGO_MODULE_ENTRY(exit) (void) void PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) + int *n_engines) { *engines = script_engines; *n_engines = G_N_ELEMENTS (script_engines); diff --git a/pango-view/viewer-main.c b/pango-view/viewer-main.c index 4ec70f0..f3d93df 100644 --- a/pango-view/viewer-main.c +++ b/pango-view/viewer-main.c @@ -104,7 +104,7 @@ main (int argc, title = get_options_string (); if (view->display) - { + { gpointer window = NULL; gpointer state = NULL; @@ -124,7 +124,7 @@ main (int argc, view->destroy_window (instance, window); } else - { + { int fd; FILE *stream; const gchar *display_argv[5] = {"display", "-title", "%s", "-"}; diff --git a/pango-view/viewer-pangocairo.c b/pango-view/viewer-pangocairo.c index 50eae22..10aaccc 100644 --- a/pango-view/viewer-pangocairo.c +++ b/pango-view/viewer-pangocairo.c @@ -99,7 +99,7 @@ typedef struct static gpointer pangocairo_view_create_surface (gpointer instance, - int width, + int width, int height) { CairoViewer *c = (CairoViewer *) instance; @@ -220,7 +220,7 @@ render_callback (PangoLayout *layout, cairo_set_source_rgba (cr, 1.0, 0.5, 0.0, 0.5); iter = pango_layout_get_iter (layout); do - { + { PangoLayoutLine *line = pango_layout_iter_get_line (iter); double width = (double)logical.width / PANGO_SCALE; @@ -241,7 +241,7 @@ render_callback (PangoLayout *layout, cairo_close_path (cr); cairo_fill (cr); cairo_restore (cr); - } + } while (pango_layout_iter_next_line (iter)); pango_layout_iter_free (iter); cairo_restore (cr); diff --git a/pango-view/viewer-render.c b/pango-view/viewer-render.c index 86bf04c..6e8bc4a 100644 --- a/pango-view/viewer-render.c +++ b/pango-view/viewer-render.c @@ -286,7 +286,7 @@ do_output (PangoContext *context, if (supports_matrix) pango_matrix_rotate (&matrix, opt_rotate); else - g_printerr ("The backend does not support rotated text\n"); + g_printerr ("The backend does not support rotated text\n"); } pango_context_set_base_gravity (context, opt_gravity); @@ -623,7 +623,7 @@ parse_options (int argc, char *argv[]) { opt_viewer = *viewers; if (!opt_viewer) - fail ("No viewer backend found"); + fail ("No viewer backend found"); } /* if wrap mode is set then width must be set */ diff --git a/pango-view/viewer-win32.c b/pango-view/viewer-win32.c index 9644993..23a7dac 100644 --- a/pango-view/viewer-win32.c +++ b/pango-view/viewer-win32.c @@ -497,7 +497,7 @@ fill_styles_combo (GtkWidget *combo) for (i = 0; i < n_families; i++) { if (0 == g_strcasecmp(pango_font_family_get_name(families[i]), family_name)) - { + { family = families[i]; break; } diff --git a/pango-view/viewer-x.h b/pango-view/viewer-x.h index e9e965b..28f61f6 100644 --- a/pango-view/viewer-x.h +++ b/pango-view/viewer-x.h @@ -39,14 +39,14 @@ typedef struct extern const PangoViewer x_viewer; void x_view_init (gpointer instance, - const PangoViewer *klass); + const PangoViewer *klass); gpointer x_view_create (const PangoViewer *klass); void x_view_destroy (gpointer instance); gpointer x_view_create_surface (gpointer instance, - int width, + int width, int height); void x_view_destroy_surface (gpointer instance, diff --git a/pango/break.c b/pango/break.c index d3c033d..e159b02 100644 --- a/pango/break.c +++ b/pango/break.c @@ -345,15 +345,15 @@ static const int line_break_indexes[] = { }; #define BREAK_TYPE_SAFE(btype) \ - (btype < G_N_ELEMENTS(line_break_indexes) ? btype : G_UNICODE_BREAK_UNKNOWN) + (btype < G_N_ELEMENTS(line_break_indexes) ? btype : G_UNICODE_BREAK_UNKNOWN) #define BREAK_INDEX(btype) \ - (line_break_indexes[(btype)]) + (line_break_indexes[(btype)]) #define BREAK_ROW(before_type) \ - (line_break_rows[BREAK_INDEX (before_type)]) + (line_break_rows[BREAK_INDEX (before_type)]) #define BREAK_OP(before_type, after_type) \ - (BREAK_ROW (before_type)[BREAK_INDEX (after_type)]) + (BREAK_ROW (before_type)[BREAK_INDEX (after_type)]) #define IN_BREAK_TABLE(btype) \ - (btype < G_N_ELEMENTS(line_break_indexes) && BREAK_INDEX(btype) < INDEX_END_OF_TABLE) + (btype < G_N_ELEMENTS(line_break_indexes) && BREAK_INDEX(btype) < INDEX_END_OF_TABLE) @@ -425,19 +425,19 @@ static const CharJamoProps HangulJamoProps[] = { */ #define VIRAMA_SCRIPT(wc) ((wc) >= 0x0901 && (wc) <= 0x17FF) #define VIRAMA(wc) ((wc) == 0x094D || \ - (wc) == 0x09CD || \ - (wc) == 0x0A4D || \ - (wc) == 0x0ACD || \ - (wc) == 0x0B4D || \ - (wc) == 0x0BCD || \ - (wc) == 0x0C4D || \ - (wc) == 0x0CCD || \ - (wc) == 0x0D4D || \ - (wc) == 0x0DCA || \ - (wc) == 0x0E3A || \ - (wc) == 0x0F84 || \ - (wc) == 0x1039 || \ - (wc) == 0x17D2) + (wc) == 0x09CD || \ + (wc) == 0x0A4D || \ + (wc) == 0x0ACD || \ + (wc) == 0x0B4D || \ + (wc) == 0x0BCD || \ + (wc) == 0x0C4D || \ + (wc) == 0x0CCD || \ + (wc) == 0x0D4D || \ + (wc) == 0x0DCA || \ + (wc) == 0x0E3A || \ + (wc) == 0x0F84 || \ + (wc) == 0x1039 || \ + (wc) == 0x17D2) /* Types of Japanese characters */ #define JAPANESE(wc) ((wc) >= 0x2F00 && (wc) <= 0x30FF) #define KANJI(wc) ((wc) >= 0x2F00 && (wc) <= 0x2FDF) @@ -502,10 +502,10 @@ typedef enum **/ void pango_default_break (const gchar *text, - gint length, - PangoAnalysis *analysis, - PangoLogAttr *attrs, - int attrs_len) + gint length, + PangoAnalysis *analysis, + PangoLogAttr *attrs, + int attrs_len) { /* The rationale for all this is in section 5.15 of the Unicode 3.0 book, * the line breaking stuff is also in TR14 on unicode.org @@ -578,41 +578,41 @@ pango_default_break (const gchar *text, break_type = next_break_type; if (almost_done) - { - /* - * If we have already reached the end of @text g_utf8_next_char() - * may not increment next - */ - next_wc = 0; + { + /* + * If we have already reached the end of @text g_utf8_next_char() + * may not increment next + */ + next_wc = 0; next_break_type = G_UNICODE_BREAK_UNKNOWN; done = TRUE; - } + } else - { - next = g_utf8_next_char (next); + { + next = g_utf8_next_char (next); if ((length >= 0 && next >= text + length) || *next == '\0') - { - /* This is how we fill in the last element (end position) of the - * attr array - assume there's a paragraph separators off the end + { + /* This is how we fill in the last element (end position) of the + * attr array - assume there's a paragraph separators off the end * of @text. - */ + */ next_wc = PARAGRAPH_SEPARATOR; almost_done = TRUE; - } - else + } + else next_wc = g_utf8_get_char (next); next_break_type = g_unichar_break_type (next_wc); - next_break_type = BREAK_TYPE_SAFE (next_break_type); - } + next_break_type = BREAK_TYPE_SAFE (next_break_type); + } type = g_unichar_type (wc); jamo = JAMO_TYPE (break_type); /* Determine wheter this forms a Hangul syllable with prev. */ if (jamo == NO_JAMO) - makes_hangul_syllable = FALSE; + makes_hangul_syllable = FALSE; else { JamoType prev_end = HangulJamoProps[prev_jamo].end ; @@ -631,106 +631,106 @@ pango_default_break (const gchar *text, /* ---- Cursor position breaks (Grapheme breaks) ---- */ if (wc == '\n') - { - /* Break before line feed unless prev char is a CR */ - - if (prev_wc != '\r') - attrs[i].is_cursor_position = TRUE; - else - attrs[i].is_cursor_position = FALSE; - } + { + /* Break before line feed unless prev char is a CR */ + + if (prev_wc != '\r') + attrs[i].is_cursor_position = TRUE; + else + attrs[i].is_cursor_position = FALSE; + } else if (i == 0 || - prev_type == G_UNICODE_CONTROL || - prev_type == G_UNICODE_FORMAT) - { - /* Break at first position (must be special cased, or if the - * first char is say a combining mark there won't be a - * cursor position at the start, which seems wrong to me - * ???? - maybe it makes sense though, who knows) - */ - /* break after all format or control characters */ - attrs[i].is_cursor_position = TRUE; - } + prev_type == G_UNICODE_CONTROL || + prev_type == G_UNICODE_FORMAT) + { + /* Break at first position (must be special cased, or if the + * first char is say a combining mark there won't be a + * cursor position at the start, which seems wrong to me + * ???? - maybe it makes sense though, who knows) + */ + /* break after all format or control characters */ + attrs[i].is_cursor_position = TRUE; + } else - { - switch (type) - { - case G_UNICODE_CONTROL: - case G_UNICODE_FORMAT: - /* Break before all format or control characters */ - attrs[i].is_cursor_position = TRUE; - break; - - case G_UNICODE_COMBINING_MARK: - case G_UNICODE_ENCLOSING_MARK: - case G_UNICODE_NON_SPACING_MARK: - /* Unicode spec includes "Combining marks plus Tibetan - * subjoined characters" as joining chars, but lists the - * Tibetan subjoined characters as combining marks, and - * g_unichar_type() returns NON_SPACING_MARK for the Tibetan - * subjoined characters. So who knows, beats me. - */ - - /* It's a joining character, break only if preceded by - * control or format; we already handled the case where - * it was preceded earlier, so here we know it wasn't, - * don't break - */ - attrs[i].is_cursor_position = FALSE; - break; - - case G_UNICODE_LOWERCASE_LETTER: - case G_UNICODE_MODIFIER_LETTER: - case G_UNICODE_OTHER_LETTER: - case G_UNICODE_TITLECASE_LETTER: - case G_UNICODE_UPPERCASE_LETTER: + { + switch (type) + { + case G_UNICODE_CONTROL: + case G_UNICODE_FORMAT: + /* Break before all format or control characters */ + attrs[i].is_cursor_position = TRUE; + break; + + case G_UNICODE_COMBINING_MARK: + case G_UNICODE_ENCLOSING_MARK: + case G_UNICODE_NON_SPACING_MARK: + /* Unicode spec includes "Combining marks plus Tibetan + * subjoined characters" as joining chars, but lists the + * Tibetan subjoined characters as combining marks, and + * g_unichar_type() returns NON_SPACING_MARK for the Tibetan + * subjoined characters. So who knows, beats me. + */ + + /* It's a joining character, break only if preceded by + * control or format; we already handled the case where + * it was preceded earlier, so here we know it wasn't, + * don't break + */ + attrs[i].is_cursor_position = FALSE; + break; + + case G_UNICODE_LOWERCASE_LETTER: + case G_UNICODE_MODIFIER_LETTER: + case G_UNICODE_OTHER_LETTER: + case G_UNICODE_TITLECASE_LETTER: + case G_UNICODE_UPPERCASE_LETTER: if (makes_hangul_syllable) - attrs[i].is_cursor_position = FALSE; - else - { - /* Handle non-Hangul-syllable non-combining chars */ + attrs[i].is_cursor_position = FALSE; + else + { + /* Handle non-Hangul-syllable non-combining chars */ - /* Break before Jamo if they are in a broken sequence or - * next to non-Jamo; break if preceded by Jamo; don't + /* Break before Jamo if they are in a broken sequence or + * next to non-Jamo; break if preceded by Jamo; don't * break if a letter is preceded by a virama; break in * all other cases. No need to check whether we are or are - * preceded by Jamo explicitly, since a Jamo is not - * a virama, we just break in all cases where we - * aren't a or preceded by a virama. Don't fool with + * preceded by Jamo explicitly, since a Jamo is not + * a virama, we just break in all cases where we + * aren't a or preceded by a virama. Don't fool with * viramas if we aren't part of a script that uses them. - */ - - if (VIRAMA_SCRIPT (wc)) - { - /* Check whether we're preceded by a virama; this - * could use some optimization. - */ - if (VIRAMA (prev_wc)) - attrs[i].is_cursor_position = FALSE; - else - attrs[i].is_cursor_position = TRUE; - } - else - { - attrs[i].is_cursor_position = TRUE; - } - } - break; - - default: - /* Some weirdo char, just break here, why not */ - attrs[i].is_cursor_position = TRUE; - break; - } - } + */ + + if (VIRAMA_SCRIPT (wc)) + { + /* Check whether we're preceded by a virama; this + * could use some optimization. + */ + if (VIRAMA (prev_wc)) + attrs[i].is_cursor_position = FALSE; + else + attrs[i].is_cursor_position = TRUE; + } + else + { + attrs[i].is_cursor_position = TRUE; + } + } + break; + + default: + /* Some weirdo char, just break here, why not */ + attrs[i].is_cursor_position = TRUE; + break; + } + } /* If this is a grapheme boundary, we have to decide if backspace * deletes a character or the whole grapheme cluster */ if (attrs[i].is_cursor_position) - attrs[i].backspace_deletes_character = BACKSPACE_DELETES_CHARACTER (base_character); + attrs[i].backspace_deletes_character = BACKSPACE_DELETES_CHARACTER (base_character); else - attrs[i].backspace_deletes_character = FALSE; + attrs[i].backspace_deletes_character = FALSE; /* ---- Line breaking ---- */ @@ -742,9 +742,9 @@ pango_default_break (const gchar *text, attrs[i].is_mandatory_break = FALSE; if (attrs[i].is_cursor_position) /* If it's not a grapheme boundary, - * it's not a line break either - */ - { + * it's not a line break either + */ + { /* space followed by a combining mark is handled * specially; (rule 7a from TR 14) */ @@ -752,15 +752,15 @@ pango_default_break (const gchar *text, next_break_type == G_UNICODE_BREAK_COMBINING_MARK) break_type = G_UNICODE_BREAK_IDEOGRAPHIC; - /* Unicode doesn't specify char wrap; we wrap around all chars - * except where a line break is prohibited, which means we - * effectively break everywhere except inside runs of spaces. - */ - attrs[i].is_char_break = TRUE; + /* Unicode doesn't specify char wrap; we wrap around all chars + * except where a line break is prohibited, which means we + * effectively break everywhere except inside runs of spaces. + */ + attrs[i].is_char_break = TRUE; /* Make any necessary replacements first */ - switch (prev_break_type) - { + switch (prev_break_type) + { case G_UNICODE_BREAK_HANGUL_L_JAMO: case G_UNICODE_BREAK_HANGUL_V_JAMO: case G_UNICODE_BREAK_HANGUL_T_JAMO: @@ -771,16 +771,16 @@ pango_default_break (const gchar *text, prev_break_type = G_UNICODE_BREAK_IDEOGRAPHIC; break; - case G_UNICODE_BREAK_AMBIGUOUS: + case G_UNICODE_BREAK_AMBIGUOUS: /* FIXME - * we need to resolve the East Asian width - * to decide what to do here + * we need to resolve the East Asian width + * to decide what to do here */ - case G_UNICODE_BREAK_COMPLEX_CONTEXT: + case G_UNICODE_BREAK_COMPLEX_CONTEXT: /* FIXME - * language engines should handle this case... + * language engines should handle this case... */ - case G_UNICODE_BREAK_UNKNOWN: + case G_UNICODE_BREAK_UNKNOWN: /* convert unknown, complex, ambiguous to ALPHABETIC */ prev_break_type = G_UNICODE_BREAK_ALPHABETIC; @@ -790,71 +790,71 @@ pango_default_break (const gchar *text, ; } - switch (prev_break_type) - { - case G_UNICODE_BREAK_MANDATORY: - case G_UNICODE_BREAK_LINE_FEED: - case G_UNICODE_BREAK_NEXT_LINE: - attrs[i].is_line_break = TRUE; - attrs[i].is_mandatory_break = TRUE; - break; - - case G_UNICODE_BREAK_CARRIAGE_RETURN: - if (wc != '\n') - { - attrs[i].is_line_break = TRUE; - attrs[i].is_mandatory_break = TRUE; - } - break; - - case G_UNICODE_BREAK_CONTINGENT: - /* can break after 0xFFFC by default, though we might want - * to eventually have a PangoLayout setting or - * PangoAttribute that disables this, if for some - * application breaking after objects is not desired. - */ - break_op = BREAK_ALLOWED; - break; - - case G_UNICODE_BREAK_SURROGATE: + switch (prev_break_type) + { + case G_UNICODE_BREAK_MANDATORY: + case G_UNICODE_BREAK_LINE_FEED: + case G_UNICODE_BREAK_NEXT_LINE: + attrs[i].is_line_break = TRUE; + attrs[i].is_mandatory_break = TRUE; + break; + + case G_UNICODE_BREAK_CARRIAGE_RETURN: + if (wc != '\n') + { + attrs[i].is_line_break = TRUE; + attrs[i].is_mandatory_break = TRUE; + } + break; + + case G_UNICODE_BREAK_CONTINGENT: + /* can break after 0xFFFC by default, though we might want + * to eventually have a PangoLayout setting or + * PangoAttribute that disables this, if for some + * application breaking after objects is not desired. + */ + break_op = BREAK_ALLOWED; + break; + + case G_UNICODE_BREAK_SURROGATE: g_assert_not_reached (); - break; - - default: - g_assert (IN_BREAK_TABLE (prev_break_type)); - - /* Note that our table assumes that combining marks - * are only applied to alphabetic characters; - * tech report 14 explains how to remove this assumption - * from the code, if anyone ever cares, but it shouldn't - * be a problem. Also this issue sort of goes - * away since we only look for breaks on grapheme - * boundaries. - */ - - switch (break_type) - { - case G_UNICODE_BREAK_MANDATORY: - case G_UNICODE_BREAK_LINE_FEED: - case G_UNICODE_BREAK_CARRIAGE_RETURN: - case G_UNICODE_BREAK_NEXT_LINE: - case G_UNICODE_BREAK_SPACE: - /* These types all "pile up" at the end of lines and - * get elided. - */ - break_op = BREAK_PROHIBITED; - break; - - case G_UNICODE_BREAK_CONTINGENT: - /* break before 0xFFFC by default, eventually - * make this configurable? - */ - break_op = BREAK_ALLOWED; - break; - - case G_UNICODE_BREAK_SURROGATE: + break; + + default: + g_assert (IN_BREAK_TABLE (prev_break_type)); + + /* Note that our table assumes that combining marks + * are only applied to alphabetic characters; + * tech report 14 explains how to remove this assumption + * from the code, if anyone ever cares, but it shouldn't + * be a problem. Also this issue sort of goes + * away since we only look for breaks on grapheme + * boundaries. + */ + + switch (break_type) + { + case G_UNICODE_BREAK_MANDATORY: + case G_UNICODE_BREAK_LINE_FEED: + case G_UNICODE_BREAK_CARRIAGE_RETURN: + case G_UNICODE_BREAK_NEXT_LINE: + case G_UNICODE_BREAK_SPACE: + /* These types all "pile up" at the end of lines and + * get elided. + */ + break_op = BREAK_PROHIBITED; + break; + + case G_UNICODE_BREAK_CONTINGENT: + /* break before 0xFFFC by default, eventually + * make this configurable? + */ + break_op = BREAK_ALLOWED; + break; + + case G_UNICODE_BREAK_SURROGATE: g_assert_not_reached (); - break; + break; /* Hangul additions are from Unicode 4.1 UAX#14 */ case G_UNICODE_BREAK_HANGUL_L_JAMO: @@ -862,9 +862,9 @@ pango_default_break (const gchar *text, case G_UNICODE_BREAK_HANGUL_T_JAMO: case G_UNICODE_BREAK_HANGUL_LV_SYLLABLE: case G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE: - /* treat Jamo as IDEOGRAPHIC from now + /* treat Jamo as IDEOGRAPHIC from now */ - break_type = G_UNICODE_BREAK_IDEOGRAPHIC; + break_type = G_UNICODE_BREAK_IDEOGRAPHIC; if (makes_hangul_syllable) break_op = BREAK_IF_SPACES; @@ -882,55 +882,55 @@ pango_default_break (const gchar *text, * language engines should handle this case... */ case G_UNICODE_BREAK_UNKNOWN: - /* treat unknown, complex, and ambiguous like ALPHABETIC + /* treat unknown, complex, and ambiguous like ALPHABETIC * for now - */ - break_op = BREAK_OP (prev_break_type, G_UNICODE_BREAK_ALPHABETIC); - break; + */ + break_op = BREAK_OP (prev_break_type, G_UNICODE_BREAK_ALPHABETIC); + break; default: g_assert (IN_BREAK_TABLE (break_type)); - break_op = BREAK_OP (prev_break_type, break_type); - break; - } - break; - } - - if (break_op != BREAK_ALREADY_HANDLED) - { - switch (break_op) - { - case BREAK_PROHIBITED: - /* can't break here */ - attrs[i].is_char_break = FALSE; - break; - - case BREAK_IF_SPACES: - /* break if prev char was space */ - if (prev_was_break_space) - attrs[i].is_line_break = TRUE; - break; - - case BREAK_ALLOWED: - attrs[i].is_line_break = TRUE; - break; - - default: - g_assert_not_reached (); - break; - } - } - } + break_op = BREAK_OP (prev_break_type, break_type); + break; + } + break; + } + + if (break_op != BREAK_ALREADY_HANDLED) + { + switch (break_op) + { + case BREAK_PROHIBITED: + /* can't break here */ + attrs[i].is_char_break = FALSE; + break; + + case BREAK_IF_SPACES: + /* break if prev char was space */ + if (prev_was_break_space) + attrs[i].is_line_break = TRUE; + break; + + case BREAK_ALLOWED: + attrs[i].is_line_break = TRUE; + break; + + default: + g_assert_not_reached (); + break; + } + } + } if (break_type != G_UNICODE_BREAK_SPACE) - { - prev_break_type = break_type; - prev_was_break_space = FALSE; + { + prev_break_type = break_type; + prev_was_break_space = FALSE; prev_jamo = jamo; - } + } else - prev_was_break_space = TRUE; + prev_was_break_space = TRUE; /* ---- Word breaks ---- */ @@ -939,100 +939,100 @@ pango_default_break (const gchar *text, attrs[i].is_word_end = FALSE; if (current_word_type != WordNone) - { - /* Check for a word end */ - switch (type) - { - case G_UNICODE_COMBINING_MARK: - case G_UNICODE_ENCLOSING_MARK: - case G_UNICODE_NON_SPACING_MARK: + { + /* Check for a word end */ + switch (type) + { + case G_UNICODE_COMBINING_MARK: + case G_UNICODE_ENCLOSING_MARK: + case G_UNICODE_NON_SPACING_MARK: case G_UNICODE_FORMAT: - /* nothing, we just eat these up as part of the word */ - break; - - case G_UNICODE_LOWERCASE_LETTER: - case G_UNICODE_MODIFIER_LETTER: - case G_UNICODE_OTHER_LETTER: - case G_UNICODE_TITLECASE_LETTER: - case G_UNICODE_UPPERCASE_LETTER: - if (current_word_type == WordLetters) - { - /* Japanese special cases for ending the word */ - if (JAPANESE (last_word_letter) || - JAPANESE (wc)) - { - if ((HIRAGANA (last_word_letter) && - !HIRAGANA (wc)) || - (KATAKANA (last_word_letter) && - !(KATAKANA (wc) || HIRAGANA (wc))) || - (KANJI (last_word_letter) && - !(HIRAGANA (wc) || KANJI (wc))) || - (JAPANESE (last_word_letter) && - !JAPANESE (wc)) || - (!JAPANESE (last_word_letter) && - JAPANESE (wc))) - attrs[i].is_word_end = TRUE; - } - } - else - { - /* end the number word, start the letter word */ - attrs[i].is_word_end = TRUE; - attrs[i].is_word_start = TRUE; - current_word_type = WordLetters; - } - - last_word_letter = wc; - break; - - case G_UNICODE_DECIMAL_NUMBER: - case G_UNICODE_LETTER_NUMBER: - case G_UNICODE_OTHER_NUMBER: - if (current_word_type != WordNumbers) - { - attrs[i].is_word_end = TRUE; - attrs[i].is_word_start = TRUE; - current_word_type = WordNumbers; - } - - last_word_letter = wc; - break; - - default: - /* Punctuation, control/format chars, etc. all end a word. */ - attrs[i].is_word_end = TRUE; + /* nothing, we just eat these up as part of the word */ + break; + + case G_UNICODE_LOWERCASE_LETTER: + case G_UNICODE_MODIFIER_LETTER: + case G_UNICODE_OTHER_LETTER: + case G_UNICODE_TITLECASE_LETTER: + case G_UNICODE_UPPERCASE_LETTER: + if (current_word_type == WordLetters) + { + /* Japanese special cases for ending the word */ + if (JAPANESE (last_word_letter) || + JAPANESE (wc)) + { + if ((HIRAGANA (last_word_letter) && + !HIRAGANA (wc)) || + (KATAKANA (last_word_letter) && + !(KATAKANA (wc) || HIRAGANA (wc))) || + (KANJI (last_word_letter) && + !(HIRAGANA (wc) || KANJI (wc))) || + (JAPANESE (last_word_letter) && + !JAPANESE (wc)) || + (!JAPANESE (last_word_letter) && + JAPANESE (wc))) + attrs[i].is_word_end = TRUE; + } + } + else + { + /* end the number word, start the letter word */ + attrs[i].is_word_end = TRUE; + attrs[i].is_word_start = TRUE; + current_word_type = WordLetters; + } + + last_word_letter = wc; + break; + + case G_UNICODE_DECIMAL_NUMBER: + case G_UNICODE_LETTER_NUMBER: + case G_UNICODE_OTHER_NUMBER: + if (current_word_type != WordNumbers) + { + attrs[i].is_word_end = TRUE; + attrs[i].is_word_start = TRUE; + current_word_type = WordNumbers; + } + + last_word_letter = wc; + break; + + default: + /* Punctuation, control/format chars, etc. all end a word. */ + attrs[i].is_word_end = TRUE; current_word_type = WordNone; - break; - } - } + break; + } + } else - { - /* Check for a word start */ - switch (type) - { - case G_UNICODE_LOWERCASE_LETTER: - case G_UNICODE_MODIFIER_LETTER: - case G_UNICODE_OTHER_LETTER: - case G_UNICODE_TITLECASE_LETTER: - case G_UNICODE_UPPERCASE_LETTER: - current_word_type = WordLetters; - last_word_letter = wc; - attrs[i].is_word_start = TRUE; - break; - - case G_UNICODE_DECIMAL_NUMBER: - case G_UNICODE_LETTER_NUMBER: - case G_UNICODE_OTHER_NUMBER: - current_word_type = WordNumbers; - last_word_letter = wc; - attrs[i].is_word_start = TRUE; - break; - - default: - /* No word here */ - break; - } - } + { + /* Check for a word start */ + switch (type) + { + case G_UNICODE_LOWERCASE_LETTER: + case G_UNICODE_MODIFIER_LETTER: + case G_UNICODE_OTHER_LETTER: + case G_UNICODE_TITLECASE_LETTER: + case G_UNICODE_UPPERCASE_LETTER: + current_word_type = WordLetters; + last_word_letter = wc; + attrs[i].is_word_start = TRUE; + break; + + case G_UNICODE_DECIMAL_NUMBER: + case G_UNICODE_LETTER_NUMBER: + case G_UNICODE_OTHER_NUMBER: + current_word_type = WordNumbers; + last_word_letter = wc; + attrs[i].is_word_start = TRUE; + break; + + default: + /* No word here */ + break; + } + } /* ---- Sentence breaks ---- */ @@ -1050,21 +1050,21 @@ pango_default_break (const gchar *text, */ #define MAYBE_START_NEW_SENTENCE \ - switch (type) \ - { \ - case G_UNICODE_LINE_SEPARATOR: \ - case G_UNICODE_PARAGRAPH_SEPARATOR: \ - case G_UNICODE_CONTROL: \ - case G_UNICODE_FORMAT: \ - case G_UNICODE_SPACE_SEPARATOR: \ - sentence_state = STATE_SENTENCE_OUTSIDE; \ - break; \ - \ - default: \ - sentence_state = STATE_SENTENCE_BODY; \ - attrs[i].is_sentence_start = TRUE; \ - break; \ - } + switch (type) \ + { \ + case G_UNICODE_LINE_SEPARATOR: \ + case G_UNICODE_PARAGRAPH_SEPARATOR: \ + case G_UNICODE_CONTROL: \ + case G_UNICODE_FORMAT: \ + case G_UNICODE_SPACE_SEPARATOR: \ + sentence_state = STATE_SENTENCE_OUTSIDE; \ + break; \ + \ + default: \ + sentence_state = STATE_SENTENCE_BODY; \ + attrs[i].is_sentence_start = TRUE; \ + break; \ + } /* No sentence break at the start of the text */ @@ -1084,374 +1084,374 @@ pango_default_break (const gchar *text, * followed by newline */ switch (prev_type) - { - case G_UNICODE_LINE_SEPARATOR: - case G_UNICODE_PARAGRAPH_SEPARATOR: - case G_UNICODE_CONTROL: - case G_UNICODE_FORMAT: - if (wc == '\r') - { - if (next_wc != '\n') - attrs[i].is_sentence_boundary = TRUE; - } - else - attrs[i].is_sentence_boundary = TRUE; - break; - - default: - break; - } + { + case G_UNICODE_LINE_SEPARATOR: + case G_UNICODE_PARAGRAPH_SEPARATOR: + case G_UNICODE_CONTROL: + case G_UNICODE_FORMAT: + if (wc == '\r') + { + if (next_wc != '\n') + attrs[i].is_sentence_boundary = TRUE; + } + else + attrs[i].is_sentence_boundary = TRUE; + break; + + default: + break; + } /* break before para/line separators except newline following * carriage return */ switch (type) - { - case G_UNICODE_LINE_SEPARATOR: - case G_UNICODE_PARAGRAPH_SEPARATOR: - case G_UNICODE_CONTROL: - case G_UNICODE_FORMAT: - if (wc == '\n') - { - if (prev_wc != '\r') - attrs[i].is_sentence_boundary = TRUE; - } - else - attrs[i].is_sentence_boundary = TRUE; - break; - - default: - break; - } + { + case G_UNICODE_LINE_SEPARATOR: + case G_UNICODE_PARAGRAPH_SEPARATOR: + case G_UNICODE_CONTROL: + case G_UNICODE_FORMAT: + if (wc == '\n') + { + if (prev_wc != '\r') + attrs[i].is_sentence_boundary = TRUE; + } + else + attrs[i].is_sentence_boundary = TRUE; + break; + + default: + break; + } switch (sentence_state) - { - case STATE_SENTENCE_OUTSIDE: - /* Start sentence if we have non-whitespace/format/control */ - switch (type) - { - case G_UNICODE_LINE_SEPARATOR: - case G_UNICODE_PARAGRAPH_SEPARATOR: - case G_UNICODE_CONTROL: - case G_UNICODE_FORMAT: - case G_UNICODE_SPACE_SEPARATOR: - break; - - default: - attrs[i].is_sentence_start = TRUE; - sentence_state = STATE_SENTENCE_BODY; - break; - } - break; - - case STATE_SENTENCE_BODY: - /* If we already broke here due to separators, end the sentence. */ - if (attrs[i].is_sentence_boundary) - { - attrs[i].is_sentence_end = TRUE; - - MAYBE_START_NEW_SENTENCE; - } - else - { - if (wc == '.') - sentence_state = STATE_SENTENCE_DOT; - else if (wc == '?' || wc == '!') - sentence_state = STATE_SENTENCE_TERM; - } - break; - - case STATE_SENTENCE_TERM: - /* End sentence on anything but close punctuation and some - * loosely-specified OTHER_PUNCTUATION such as period, - * comma, etc.; follow Unicode rules for breaks - */ - switch (type) - { - case G_UNICODE_OTHER_PUNCTUATION: - case G_UNICODE_CLOSE_PUNCTUATION: - if (type == G_UNICODE_CLOSE_PUNCTUATION || - wc == '.' || - wc == ',' || - wc == '?' || - wc == '!') - sentence_state = STATE_SENTENCE_POST_TERM_CLOSE; - else - { - attrs[i].is_sentence_end = TRUE; - attrs[i].is_sentence_boundary = TRUE; - - MAYBE_START_NEW_SENTENCE; - } - break; - - case G_UNICODE_SPACE_SEPARATOR: - attrs[i].is_sentence_end = TRUE; - sentence_state = STATE_SENTENCE_POST_TERM_SPACE; - break; - - case G_UNICODE_LINE_SEPARATOR: - case G_UNICODE_PARAGRAPH_SEPARATOR: - attrs[i].is_sentence_end = TRUE; - sentence_state = STATE_SENTENCE_POST_TERM_SEP; - break; - - default: - attrs[i].is_sentence_end = TRUE; - attrs[i].is_sentence_boundary = TRUE; - - MAYBE_START_NEW_SENTENCE; - - break; - } - break; - - case STATE_SENTENCE_POST_TERM_CLOSE: - /* End sentence on anything besides more punctuation; follow - * rules for breaks - */ - switch (type) - { - case G_UNICODE_OTHER_PUNCTUATION: - case G_UNICODE_CLOSE_PUNCTUATION: - if (type == G_UNICODE_CLOSE_PUNCTUATION || - wc == '.' || - wc == ',' || - wc == '?' || - wc == '!') - /* continue in this state */ - ; - else - { - attrs[i].is_sentence_end = TRUE; - attrs[i].is_sentence_boundary = TRUE; - - MAYBE_START_NEW_SENTENCE; - } - break; - - case G_UNICODE_SPACE_SEPARATOR: - attrs[i].is_sentence_end = TRUE; - sentence_state = STATE_SENTENCE_POST_TERM_SPACE; - break; - - case G_UNICODE_LINE_SEPARATOR: - case G_UNICODE_PARAGRAPH_SEPARATOR: - attrs[i].is_sentence_end = TRUE; - /* undo the unconditional break-at-all-line/para-separators - * from above; I'm not sure this is what the Unicode spec - * intends, but it seems right - we get to include - * a single line/para separator in the sentence according - * to their rules - */ - attrs[i].is_sentence_boundary = FALSE; - sentence_state = STATE_SENTENCE_POST_TERM_SEP; - break; - - default: - attrs[i].is_sentence_end = TRUE; - attrs[i].is_sentence_boundary = TRUE; - - MAYBE_START_NEW_SENTENCE; - - break; - } - break; - - case STATE_SENTENCE_POST_TERM_SPACE: - - /* Sentence is definitely already ended; to enter this state - * we had to see a space, which ends the sentence. - */ - - switch (type) - { - case G_UNICODE_SPACE_SEPARATOR: - /* continue in this state */ - break; - - case G_UNICODE_LINE_SEPARATOR: - case G_UNICODE_PARAGRAPH_SEPARATOR: - /* undo the unconditional break-at-all-line/para-separators - * from above; I'm not sure this is what the Unicode spec - * intends, but it seems right - */ - attrs[i].is_sentence_boundary = FALSE; - sentence_state = STATE_SENTENCE_POST_TERM_SEP; - break; - - default: - attrs[i].is_sentence_boundary = TRUE; - - MAYBE_START_NEW_SENTENCE; - - break; - } - break; - - case STATE_SENTENCE_POST_TERM_SEP: - /* Break is forced at this point, unless we're a newline - * after a CR, then we will break after the newline on the - * next iteration. Only a single Sep can be in the - * sentence. - */ - if (!(prev_wc == '\r' && wc == '\n')) - attrs[i].is_sentence_boundary = TRUE; - - MAYBE_START_NEW_SENTENCE; - - break; - - case STATE_SENTENCE_DOT: - switch (type) - { - case G_UNICODE_CLOSE_PUNCTUATION: - sentence_state = STATE_SENTENCE_POST_DOT_CLOSE; - break; - - case G_UNICODE_SPACE_SEPARATOR: - possible_sentence_end = i; - sentence_state = STATE_SENTENCE_POST_DOT_SPACE; - break; - - default: - /* If we broke on a control/format char, end the - * sentence; else this was not a sentence end, since - * we didn't enter the POST_DOT_SPACE state. - */ - if (attrs[i].is_sentence_boundary) - { - attrs[i].is_sentence_end = TRUE; - - MAYBE_START_NEW_SENTENCE; - } - else - sentence_state = STATE_SENTENCE_BODY; - break; - } - break; - - case STATE_SENTENCE_POST_DOT_CLOSE: - switch (type) - { - case G_UNICODE_SPACE_SEPARATOR: - possible_sentence_end = i; - sentence_state = STATE_SENTENCE_POST_DOT_SPACE; - break; - - default: - /* If we broke on a control/format char, end the - * sentence; else this was not a sentence end, since - * we didn't enter the POST_DOT_SPACE state. - */ - if (attrs[i].is_sentence_boundary) - { - attrs[i].is_sentence_end = TRUE; - - MAYBE_START_NEW_SENTENCE; - } - else - sentence_state = STATE_SENTENCE_BODY; - break; - } - break; - - case STATE_SENTENCE_POST_DOT_SPACE: - - possible_sentence_boundary = i; - - switch (type) - { - case G_UNICODE_SPACE_SEPARATOR: - /* remain in current state */ - break; - - case G_UNICODE_OPEN_PUNCTUATION: - sentence_state = STATE_SENTENCE_POST_DOT_OPEN; - break; - - case G_UNICODE_LOWERCASE_LETTER: - /* wasn't a sentence-ending period; so re-enter the sentence - * body - */ - sentence_state = STATE_SENTENCE_BODY; - break; - - default: - /* End the sentence, break, maybe start a new one */ - - g_assert (possible_sentence_end >= 0); - g_assert (possible_sentence_boundary >= 0); - - attrs[possible_sentence_boundary].is_sentence_boundary = TRUE; - attrs[possible_sentence_end].is_sentence_end = TRUE; - - possible_sentence_end = -1; - possible_sentence_boundary = -1; - - MAYBE_START_NEW_SENTENCE; - - break; - } - break; - - case STATE_SENTENCE_POST_DOT_OPEN: - switch (type) - { - case G_UNICODE_OPEN_PUNCTUATION: - /* continue in current state */ - break; - - case G_UNICODE_LOWERCASE_LETTER: - /* wasn't a sentence-ending period; so re-enter the sentence - * body - */ - sentence_state = STATE_SENTENCE_BODY; - break; - - default: - /* End the sentence, break, maybe start a new one */ - - g_assert (possible_sentence_end >= 0); - g_assert (possible_sentence_boundary >= 0); - - attrs[possible_sentence_boundary].is_sentence_boundary = TRUE; - attrs[possible_sentence_end].is_sentence_end = TRUE; - - possible_sentence_end = -1; - possible_sentence_boundary = -1; - - MAYBE_START_NEW_SENTENCE; - - break; - } - break; - - case STATE_SENTENCE_POST_DOT_SEP: - /* Break is forced at this point, unless we're a newline - * after a CR, then we will break after the newline on the - * next iteration. Only a single Sep can be in the - * sentence. - */ - if (!(prev_wc == '\r' && wc == '\n')) - attrs[i].is_sentence_boundary = TRUE; + { + case STATE_SENTENCE_OUTSIDE: + /* Start sentence if we have non-whitespace/format/control */ + switch (type) + { + case G_UNICODE_LINE_SEPARATOR: + case G_UNICODE_PARAGRAPH_SEPARATOR: + case G_UNICODE_CONTROL: + case G_UNICODE_FORMAT: + case G_UNICODE_SPACE_SEPARATOR: + break; - g_assert (possible_sentence_end >= 0); - g_assert (possible_sentence_boundary >= 0); + default: + attrs[i].is_sentence_start = TRUE; + sentence_state = STATE_SENTENCE_BODY; + break; + } + break; - attrs[possible_sentence_end].is_sentence_end = TRUE; + case STATE_SENTENCE_BODY: + /* If we already broke here due to separators, end the sentence. */ + if (attrs[i].is_sentence_boundary) + { + attrs[i].is_sentence_end = TRUE; - possible_sentence_end = -1; - possible_sentence_boundary = -1; + MAYBE_START_NEW_SENTENCE; + } + else + { + if (wc == '.') + sentence_state = STATE_SENTENCE_DOT; + else if (wc == '?' || wc == '!') + sentence_state = STATE_SENTENCE_TERM; + } + break; - MAYBE_START_NEW_SENTENCE; + case STATE_SENTENCE_TERM: + /* End sentence on anything but close punctuation and some + * loosely-specified OTHER_PUNCTUATION such as period, + * comma, etc.; follow Unicode rules for breaks + */ + switch (type) + { + case G_UNICODE_OTHER_PUNCTUATION: + case G_UNICODE_CLOSE_PUNCTUATION: + if (type == G_UNICODE_CLOSE_PUNCTUATION || + wc == '.' || + wc == ',' || + wc == '?' || + wc == '!') + sentence_state = STATE_SENTENCE_POST_TERM_CLOSE; + else + { + attrs[i].is_sentence_end = TRUE; + attrs[i].is_sentence_boundary = TRUE; + + MAYBE_START_NEW_SENTENCE; + } + break; + + case G_UNICODE_SPACE_SEPARATOR: + attrs[i].is_sentence_end = TRUE; + sentence_state = STATE_SENTENCE_POST_TERM_SPACE; + break; + + case G_UNICODE_LINE_SEPARATOR: + case G_UNICODE_PARAGRAPH_SEPARATOR: + attrs[i].is_sentence_end = TRUE; + sentence_state = STATE_SENTENCE_POST_TERM_SEP; + break; + + default: + attrs[i].is_sentence_end = TRUE; + attrs[i].is_sentence_boundary = TRUE; + + MAYBE_START_NEW_SENTENCE; + + break; + } + break; + + case STATE_SENTENCE_POST_TERM_CLOSE: + /* End sentence on anything besides more punctuation; follow + * rules for breaks + */ + switch (type) + { + case G_UNICODE_OTHER_PUNCTUATION: + case G_UNICODE_CLOSE_PUNCTUATION: + if (type == G_UNICODE_CLOSE_PUNCTUATION || + wc == '.' || + wc == ',' || + wc == '?' || + wc == '!') + /* continue in this state */ + ; + else + { + attrs[i].is_sentence_end = TRUE; + attrs[i].is_sentence_boundary = TRUE; + + MAYBE_START_NEW_SENTENCE; + } + break; + + case G_UNICODE_SPACE_SEPARATOR: + attrs[i].is_sentence_end = TRUE; + sentence_state = STATE_SENTENCE_POST_TERM_SPACE; + break; + + case G_UNICODE_LINE_SEPARATOR: + case G_UNICODE_PARAGRAPH_SEPARATOR: + attrs[i].is_sentence_end = TRUE; + /* undo the unconditional break-at-all-line/para-separators + * from above; I'm not sure this is what the Unicode spec + * intends, but it seems right - we get to include + * a single line/para separator in the sentence according + * to their rules + */ + attrs[i].is_sentence_boundary = FALSE; + sentence_state = STATE_SENTENCE_POST_TERM_SEP; + break; + + default: + attrs[i].is_sentence_end = TRUE; + attrs[i].is_sentence_boundary = TRUE; + + MAYBE_START_NEW_SENTENCE; + + break; + } + break; + + case STATE_SENTENCE_POST_TERM_SPACE: + + /* Sentence is definitely already ended; to enter this state + * we had to see a space, which ends the sentence. + */ + + switch (type) + { + case G_UNICODE_SPACE_SEPARATOR: + /* continue in this state */ + break; + + case G_UNICODE_LINE_SEPARATOR: + case G_UNICODE_PARAGRAPH_SEPARATOR: + /* undo the unconditional break-at-all-line/para-separators + * from above; I'm not sure this is what the Unicode spec + * intends, but it seems right + */ + attrs[i].is_sentence_boundary = FALSE; + sentence_state = STATE_SENTENCE_POST_TERM_SEP; + break; + + default: + attrs[i].is_sentence_boundary = TRUE; + + MAYBE_START_NEW_SENTENCE; + + break; + } + break; + + case STATE_SENTENCE_POST_TERM_SEP: + /* Break is forced at this point, unless we're a newline + * after a CR, then we will break after the newline on the + * next iteration. Only a single Sep can be in the + * sentence. + */ + if (!(prev_wc == '\r' && wc == '\n')) + attrs[i].is_sentence_boundary = TRUE; - break; + MAYBE_START_NEW_SENTENCE; - default: - g_assert_not_reached (); - break; - } + break; + + case STATE_SENTENCE_DOT: + switch (type) + { + case G_UNICODE_CLOSE_PUNCTUATION: + sentence_state = STATE_SENTENCE_POST_DOT_CLOSE; + break; + + case G_UNICODE_SPACE_SEPARATOR: + possible_sentence_end = i; + sentence_state = STATE_SENTENCE_POST_DOT_SPACE; + break; + + default: + /* If we broke on a control/format char, end the + * sentence; else this was not a sentence end, since + * we didn't enter the POST_DOT_SPACE state. + */ + if (attrs[i].is_sentence_boundary) + { + attrs[i].is_sentence_end = TRUE; + + MAYBE_START_NEW_SENTENCE; + } + else + sentence_state = STATE_SENTENCE_BODY; + break; + } + break; + + case STATE_SENTENCE_POST_DOT_CLOSE: + switch (type) + { + case G_UNICODE_SPACE_SEPARATOR: + possible_sentence_end = i; + sentence_state = STATE_SENTENCE_POST_DOT_SPACE; + break; + + default: + /* If we broke on a control/format char, end the + * sentence; else this was not a sentence end, since + * we didn't enter the POST_DOT_SPACE state. + */ + if (attrs[i].is_sentence_boundary) + { + attrs[i].is_sentence_end = TRUE; + + MAYBE_START_NEW_SENTENCE; + } + else + sentence_state = STATE_SENTENCE_BODY; + break; + } + break; + + case STATE_SENTENCE_POST_DOT_SPACE: + + possible_sentence_boundary = i; + + switch (type) + { + case G_UNICODE_SPACE_SEPARATOR: + /* remain in current state */ + break; + + case G_UNICODE_OPEN_PUNCTUATION: + sentence_state = STATE_SENTENCE_POST_DOT_OPEN; + break; + + case G_UNICODE_LOWERCASE_LETTER: + /* wasn't a sentence-ending period; so re-enter the sentence + * body + */ + sentence_state = STATE_SENTENCE_BODY; + break; + + default: + /* End the sentence, break, maybe start a new one */ + + g_assert (possible_sentence_end >= 0); + g_assert (possible_sentence_boundary >= 0); + + attrs[possible_sentence_boundary].is_sentence_boundary = TRUE; + attrs[possible_sentence_end].is_sentence_end = TRUE; + + possible_sentence_end = -1; + possible_sentence_boundary = -1; + + MAYBE_START_NEW_SENTENCE; + + break; + } + break; + + case STATE_SENTENCE_POST_DOT_OPEN: + switch (type) + { + case G_UNICODE_OPEN_PUNCTUATION: + /* continue in current state */ + break; + + case G_UNICODE_LOWERCASE_LETTER: + /* wasn't a sentence-ending period; so re-enter the sentence + * body + */ + sentence_state = STATE_SENTENCE_BODY; + break; + + default: + /* End the sentence, break, maybe start a new one */ + + g_assert (possible_sentence_end >= 0); + g_assert (possible_sentence_boundary >= 0); + + attrs[possible_sentence_boundary].is_sentence_boundary = TRUE; + attrs[possible_sentence_end].is_sentence_end = TRUE; + + possible_sentence_end = -1; + possible_sentence_boundary = -1; + + MAYBE_START_NEW_SENTENCE; + + break; + } + break; + + case STATE_SENTENCE_POST_DOT_SEP: + /* Break is forced at this point, unless we're a newline + * after a CR, then we will break after the newline on the + * next iteration. Only a single Sep can be in the + * sentence. + */ + if (!(prev_wc == '\r' && wc == '\n')) + attrs[i].is_sentence_boundary = TRUE; + + g_assert (possible_sentence_end >= 0); + g_assert (possible_sentence_boundary >= 0); + + attrs[possible_sentence_end].is_sentence_end = TRUE; + + possible_sentence_end = -1; + possible_sentence_boundary = -1; + + MAYBE_START_NEW_SENTENCE; + + break; + + default: + g_assert_not_reached (); + break; + } prev_type = type; prev_wc = wc; @@ -1459,18 +1459,18 @@ pango_default_break (const gchar *text, /* wc might not be a valid Unicode base character, but really all we * need to know is the last non-combining character */ if (type != G_UNICODE_COMBINING_MARK && - type != G_UNICODE_ENCLOSING_MARK && - type != G_UNICODE_NON_SPACING_MARK) - base_character = wc; + type != G_UNICODE_ENCLOSING_MARK && + type != G_UNICODE_NON_SPACING_MARK) + base_character = wc; } } static gboolean tailor_break (const gchar *text, - gint length, - PangoAnalysis *analysis, - PangoLogAttr *attrs, - int attrs_len) + gint length, + PangoAnalysis *analysis, + PangoLogAttr *attrs, + int attrs_len) { if (analysis->lang_engine && PANGO_ENGINE_LANG_GET_CLASS (analysis->lang_engine)->script_break) { @@ -1499,10 +1499,10 @@ tailor_break (const gchar *text, */ void pango_break (const gchar *text, - gint length, - PangoAnalysis *analysis, - PangoLogAttr *attrs, - int attrs_len) + gint length, + PangoAnalysis *analysis, + PangoLogAttr *attrs, + int attrs_len) { g_return_if_fail (analysis != NULL); g_return_if_fail (attrs != NULL); @@ -1531,9 +1531,9 @@ pango_break (const gchar *text, **/ void pango_find_paragraph_boundary (const gchar *text, - gint length, - gint *paragraph_delimiter_index, - gint *next_paragraph_start) + gint length, + gint *paragraph_delimiter_index, + gint *next_paragraph_start) { const gchar *p = text; const gchar *end; @@ -1570,29 +1570,29 @@ pango_find_paragraph_boundary (const gchar *text, while (p != end) { if (prev_sep == '\n' || - prev_sep == PARAGRAPH_SEPARATOR_STRING[0]) - { - g_assert (delimiter); - start = p; - break; - } + prev_sep == PARAGRAPH_SEPARATOR_STRING[0]) + { + g_assert (delimiter); + start = p; + break; + } else if (prev_sep == '\r') - { - /* don't break between \r and \n */ - if (*p != '\n') - { - g_assert (delimiter); - start = p; - break; - } - } + { + /* don't break between \r and \n */ + if (*p != '\n') + { + g_assert (delimiter); + start = p; + break; + } + } if (*p == '\n' || - *p == '\r' || - !strncmp(p, PARAGRAPH_SEPARATOR_STRING, + *p == '\r' || + !strncmp(p, PARAGRAPH_SEPARATOR_STRING, strlen(PARAGRAPH_SEPARATOR_STRING))) - { - if (delimiter == NULL) + { + if (delimiter == NULL) delimiter = p; prev_sep = *p; } @@ -1663,11 +1663,11 @@ tailor_segment (const char *range_start, */ void pango_get_log_attrs (const char *text, - int length, - int level, - PangoLanguage *language, - PangoLogAttr *log_attrs, - int attrs_len) + int length, + int level, + PangoLanguage *language, + PangoLogAttr *log_attrs, + int attrs_len) { PangoMap *lang_map; int chars_broken; @@ -1711,15 +1711,15 @@ pango_get_log_attrs (const char *text, g_assert (range_end == run_start); if (range_engine != run_engine) - { - /* Engine has changed; do the tailoring for the current range, - * then start a new range. - */ + { + /* Engine has changed; do the tailoring for the current range, + * then start a new range. + */ chars_broken += tailor_segment (range_start, range_end, range_engine, chars_broken, &analysis, log_attrs); - range_start = run_start; + range_start = run_start; range_engine = run_engine; - } + } range_end = run_end; } pango_script_iter_free (iter); diff --git a/pango/fonts.c b/pango/fonts.c index e34b1df..1304124 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -899,7 +899,7 @@ find_field_any (const char *str, int len, PangoFontDescription *desc) { \ found = TRUE; \ if (desc) \ - desc->mask |= MASK; \ + desc->mask |= MASK; \ } \ } G_STMT_END @@ -949,7 +949,7 @@ parse_size (const char *word, *pango_size = (int)(size * PANGO_SCALE + 0.5); if (size_is_absolute) - *size_is_absolute = end < word + wordlen; + *size_is_absolute = end < word + wordlen; return TRUE; } @@ -988,9 +988,9 @@ pango_font_description_from_string (const char *str) desc = pango_font_description_new (); desc->mask = PANGO_FONT_MASK_STYLE | - PANGO_FONT_MASK_WEIGHT | - PANGO_FONT_MASK_VARIANT | - PANGO_FONT_MASK_STRETCH; + PANGO_FONT_MASK_WEIGHT | + PANGO_FONT_MASK_VARIANT | + PANGO_FONT_MASK_STRETCH; len = strlen (str); last = str + len; @@ -1293,19 +1293,19 @@ pango_font_get_glyph_extents (PangoFont *font, { if (!_pango_warning_history.get_glyph_extents) - { + { _pango_warning_history.get_glyph_extents = TRUE; g_warning (bad_font_warning, "pango_font_get_glyph_extents"); } if (ink_rect) - { + { ink_rect->x = PANGO_SCALE; ink_rect->y = - (PANGO_UNKNOWN_GLYPH_HEIGHT - 1) * PANGO_SCALE; ink_rect->height = (PANGO_UNKNOWN_GLYPH_HEIGHT - 2) * PANGO_SCALE; ink_rect->width = (PANGO_UNKNOWN_GLYPH_WIDTH - 2) * PANGO_SCALE; - } + } if (logical_rect) - { + { logical_rect->x = logical_rect->y = 0; logical_rect->y = - PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE; logical_rect->height = PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE; @@ -1340,7 +1340,7 @@ pango_font_get_metrics (PangoFont *font, { if (!_pango_warning_history.get_metrics) - { + { _pango_warning_history.get_metrics = TRUE; g_warning (bad_font_warning, "pango_font_get_metrics"); } @@ -1367,7 +1367,7 @@ pango_font_get_font_map (PangoFont *font) { if (!_pango_warning_history.get_font_map) - { + { _pango_warning_history.get_font_map = TRUE; g_warning (bad_font_warning, "pango_font_get_font_map"); } @@ -1772,8 +1772,8 @@ pango_font_face_get_face_name (PangoFontFace *face) **/ void pango_font_face_list_sizes (PangoFontFace *face, - int **sizes, - int *n_sizes) + int **sizes, + int *n_sizes) { g_return_if_fail (PANGO_IS_FONT_FACE (face)); g_return_if_fail (sizes == NULL || n_sizes != NULL); diff --git a/pango/glyphstring.c b/pango/glyphstring.c index e079a6e..caff9d7 100644 --- a/pango/glyphstring.c +++ b/pango/glyphstring.c @@ -61,12 +61,12 @@ pango_glyph_string_set_size (PangoGlyphString *string, gint new_len) while (new_len > string->space) { if (string->space == 0) - string->space = 1; + string->space = 1; else - string->space *= 2; + string->space *= 2; if (string->space < 0) - { + { g_warning ("glyph string length overflows maximum integer size, truncated"); new_len = string->space = G_MAXINT - 8; } @@ -133,7 +133,7 @@ pango_glyph_string_free (PangoGlyphString *string) * @glyphs: a #PangoGlyphString * @start: start index * @end: end index (the range is the set of bytes with - indices such that start <= index < end) + indices such that start <= index < end) * @font: a #PangoFont * @ink_rect: rectangle used to store the extents of the glyph string range as drawn * or %NULL to indicate that the result is not needed. @@ -147,11 +147,11 @@ pango_glyph_string_free (PangoGlyphString *string) **/ void pango_glyph_string_extents_range (PangoGlyphString *glyphs, - int start, - int end, - PangoFont *font, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect) + int start, + int end, + PangoFont *font, + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { int x_pos = 0; int i; @@ -263,7 +263,7 @@ pango_glyph_string_extents (PangoGlyphString *glyphs, PangoRectangle *logical_rect) { pango_glyph_string_extents_range (glyphs, 0, glyphs->num_glyphs, - font, ink_rect, logical_rect); + font, ink_rect, logical_rect); } /** diff --git a/pango/modules.c b/pango/modules.c index 4b48af2..5a9d688 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -262,7 +262,7 @@ pango_engine_pair_get_engine (PangoEnginePair *pair) } if (!pair->engine) - { + { /* If a module cannot be used, or doesn't not create an engine * correctly, we print out an error containing module name and id, * but to not flood the terminal with zillions of the message, we diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 00b5d87..0e0e3c4 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -41,15 +41,15 @@ struct _PangoAttrIterator }; static PangoAttribute *pango_attr_color_new (const PangoAttrClass *klass, - guint16 red, - guint16 green, - guint16 blue); + guint16 red, + guint16 green, + guint16 blue); static PangoAttribute *pango_attr_string_new (const PangoAttrClass *klass, - const char *str); + const char *str); static PangoAttribute *pango_attr_int_new (const PangoAttrClass *klass, - int value); + int value); static PangoAttribute *pango_attr_float_new (const PangoAttrClass *klass, - double value); + double value); static PangoAttribute *pango_attr_size_new_internal (int size, gboolean absolute); @@ -248,8 +248,8 @@ pango_attr_color_copy (const PangoAttribute *attr) return pango_attr_color_new (attr->klass, color_attr->color.red, - color_attr->color.green, - color_attr->color.blue); + color_attr->color.green, + color_attr->color.blue); } static void @@ -404,7 +404,7 @@ pango_attr_float_equal (const PangoAttribute *attr1, static PangoAttribute* pango_attr_float_new (const PangoAttrClass *klass, - double value) + double value) { PangoAttrFloat *result = g_slice_new (PangoAttrFloat); result->attr.klass = klass; @@ -1136,7 +1136,7 @@ pango_attr_list_copy (PangoAttrList *list) while (iter != NULL) { new_attrs = g_slist_prepend (new_attrs, - pango_attribute_copy (iter->data)); + pango_attribute_copy (iter->data)); iter = g_slist_next (iter); } @@ -1416,7 +1416,7 @@ pango_attr_list_change (PangoAttrList *list, if (tmp_attr2->start_index >= tmp_attr->start_index) break; - prev2 = tmp_list2; + prev2 = tmp_list2; tmp_list2 = tmp_list2->next; } @@ -1775,7 +1775,7 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator, pango_font_description_merge_static (desc, ((PangoAttrFontDesc *)attr)->desc, FALSE); break; - } + } case PANGO_ATTR_FAMILY: if (!(mask & PANGO_FONT_MASK_FAMILY)) { @@ -1825,7 +1825,7 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator, pango_font_description_set_absolute_size (desc, ((PangoAttrSize *)attr)->size); } break; - case PANGO_ATTR_SCALE: + case PANGO_ATTR_SCALE: if (!have_scale) { have_scale = TRUE; diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h index 85baf72..50c7dd2 100644 --- a/pango/pango-attributes.h +++ b/pango/pango-attributes.h @@ -214,7 +214,7 @@ PangoAttribute *pango_attr_fallback_new (gboolean enable PangoAttribute *pango_attr_letter_spacing_new (int letter_spacing); PangoAttribute *pango_attr_shape_new (const PangoRectangle *ink_rect, - const PangoRectangle *logical_rect); + const PangoRectangle *logical_rect); PangoAttribute *pango_attr_shape_new_with_data (const PangoRectangle *ink_rect, const PangoRectangle *logical_rect, gpointer data, @@ -247,27 +247,27 @@ PangoAttrList *pango_attr_list_filter (PangoAttrList *list, PangoAttrIterator *pango_attr_list_get_iterator (PangoAttrList *list); void pango_attr_iterator_range (PangoAttrIterator *iterator, - gint *start, - gint *end); + gint *start, + gint *end); gboolean pango_attr_iterator_next (PangoAttrIterator *iterator); PangoAttrIterator *pango_attr_iterator_copy (PangoAttrIterator *iterator); void pango_attr_iterator_destroy (PangoAttrIterator *iterator); PangoAttribute * pango_attr_iterator_get (PangoAttrIterator *iterator, - PangoAttrType type); + PangoAttrType type); void pango_attr_iterator_get_font (PangoAttrIterator *iterator, - PangoFontDescription *desc, + PangoFontDescription *desc, PangoLanguage **language, - GSList **extra_attrs); + GSList **extra_attrs); GSList * pango_attr_iterator_get_attrs (PangoAttrIterator *iterator); gboolean pango_parse_markup (const char *markup_text, - int length, - gunichar accel_marker, - PangoAttrList **attr_list, - char **text, - gunichar *accel_char, - GError **error); + int length, + gunichar accel_marker, + PangoAttrList **attr_list, + char **text, + gunichar *accel_char, + GError **error); G_END_DECLS diff --git a/pango/pango-break.h b/pango/pango-break.h index ce9bd85..9711166 100644 --- a/pango/pango-break.h +++ b/pango/pango-break.h @@ -78,19 +78,19 @@ void pango_break (const gchar *text, int length, PangoAnalysis *analysis, PangoLogAttr *attrs, - int attrs_len); + int attrs_len); void pango_find_paragraph_boundary (const gchar *text, - gint length, - gint *paragraph_delimiter_index, - gint *next_paragraph_start); + gint length, + gint *paragraph_delimiter_index, + gint *next_paragraph_start); void pango_get_log_attrs (const char *text, - int length, - int level, - PangoLanguage *language, - PangoLogAttr *log_attrs, - int attrs_len); + int length, + int level, + PangoLanguage *language, + PangoLogAttr *log_attrs, + int attrs_len); #ifdef PANGO_ENABLE_ENGINE @@ -100,10 +100,10 @@ void pango_get_log_attrs (const char *text, * from a language engine override. */ void pango_default_break (const gchar *text, - int length, - PangoAnalysis *analysis, - PangoLogAttr *attrs, - int attrs_len); + int length, + PangoAnalysis *analysis, + PangoLogAttr *attrs, + int attrs_len); #endif /* PANGO_ENABLE_ENGINE */ diff --git a/pango/pango-color.c b/pango/pango-color.c index a2a8853..b469e83 100644 --- a/pango/pango-color.c +++ b/pango/pango-color.c @@ -163,8 +163,8 @@ find_color(const char *name, ColorEntry *found; found = bsearch (name, color_entries, G_N_ELEMENTS (color_entries), - sizeof (ColorEntry), - compare_xcolor_entries); + sizeof (ColorEntry), + compare_xcolor_entries); if (found == NULL) return FALSE; @@ -223,7 +223,7 @@ pango_color_parse (PangoColor *color, spec++; len = strlen (spec); if (len % 3 || len < 3 || len > 12) - return FALSE; + return FALSE; len /= 3; @@ -248,12 +248,12 @@ pango_color_parse (PangoColor *color, color->red = r; color->green = g; color->blue = b; - } + } } else { if (!find_color (spec, color)) - return FALSE; + return FALSE; } return TRUE; } diff --git a/pango/pango-context.c b/pango/pango-context.c index f11ac21..b92f96f 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -538,13 +538,13 @@ advance_attr_iterator_to (PangoAttrIterator *iterator, while (start_index >= end_range) { if (!pango_attr_iterator_next (iterator)) - return FALSE; + return FALSE; pango_attr_iterator_range (iterator, &start_range, &end_range); } if (start_range > start_index) g_warning ("In pango_itemize(), the cached iterator passed in " - "had already moved beyond the start_index"); + "had already moved beyond the start_index"); return TRUE; } @@ -710,7 +710,7 @@ update_embedding_end (ItemizeState *state) static PangoAttribute * find_attribute (GSList *attr_list, - PangoAttrType type) + PangoAttrType type) { GSList *node; @@ -1082,8 +1082,8 @@ get_base_font (ItemizeState *state) { if (!state->base_font) state->base_font = pango_font_map_load_font (state->context->font_map, - state->context, - state->font_desc); + state->context, + state->font_desc); return state->base_font; } @@ -1108,9 +1108,9 @@ get_shaper_and_font (ItemizeState *state, PangoScript script; if (PANGO_GRAVITY_IS_VERTICAL (state->resolved_gravity)) - script = PANGO_SCRIPT_COMMON; + script = PANGO_SCRIPT_COMMON; else - script = state->script; + script = state->script; get_engines (state->context, state->derived_lang, script, &state->exact_engines, &state->fallback_engines); @@ -1134,7 +1134,7 @@ get_shaper_and_font (ItemizeState *state, /* skip caching if fallback disabled (see above) */ if (state->enable_fallback) - shaper_font_cache_insert (state->cache, wc, *shape_engine, *font); + shaper_font_cache_insert (state->cache, wc, *shape_engine, *font); return TRUE; } @@ -1218,12 +1218,12 @@ itemize_state_update_for_new_run (ItemizeState *state) PangoGravity old_gravity = state->resolved_gravity; if (state->font_desc_gravity != PANGO_GRAVITY_AUTO) - { + { state->resolved_gravity = state->font_desc_gravity; state->centered_baseline = PANGO_GRAVITY_IS_VERTICAL (state->resolved_gravity); } else - { + { PangoGravity gravity = state->gravity; PangoGravityHint gravity_hint = state->gravity_hint; @@ -1237,9 +1237,9 @@ itemize_state_update_for_new_run (ItemizeState *state) } if (old_gravity != state->resolved_gravity) - { + { pango_font_description_set_gravity (state->font_desc, state->resolved_gravity); - state->changed |= FONT_CHANGED; + state->changed |= FONT_CHANGED; } } @@ -1336,7 +1336,7 @@ itemize_state_process_run (ItemizeState *state) font = NULL; } else - { + { get_shaper_and_font (state, wc, &shape_engine, &font); } @@ -1385,7 +1385,7 @@ itemize_state_finish (ItemizeState *state) /** * pango_itemize_with_base_dir: * @context: a structure holding information that affects - the itemization process. + the itemization process. * @text: the text to itemize. * @start_index: first byte in @text to process * @length: the number of bytes (not characters) to process @@ -1461,7 +1461,7 @@ itemize_with_font (PangoContext *context, /** * pango_itemize: * @context: a structure holding information that affects - the itemization process. + the itemization process. * @text: the text to itemize. * @start_index: first byte in @text to process * @length: the number of bytes (not characters) to process @@ -1486,10 +1486,10 @@ itemize_with_font (PangoContext *context, GList * pango_itemize (PangoContext *context, const char *text, - int start_index, + int start_index, int length, PangoAttrList *attrs, - PangoAttrIterator *cached_iter) + PangoAttrIterator *cached_iter) { g_return_val_if_fail (context != NULL, NULL); g_return_val_if_fail (start_index >= 0, NULL); diff --git a/pango/pango-coverage.c b/pango/pango-coverage.c index 889de9c..340ccf7 100644 --- a/pango/pango-coverage.c +++ b/pango/pango-coverage.c @@ -201,8 +201,8 @@ pango_coverage_get (PangoCoverage *coverage, **/ void pango_coverage_set (PangoCoverage *coverage, - int index, - PangoCoverageLevel level) + int index, + PangoCoverageLevel level) { int block_index, i; guchar *data; @@ -239,7 +239,7 @@ pango_coverage_set (PangoCoverage *coverage, byte = coverage->blocks[block_index].level | (coverage->blocks[block_index].level << 2) | (coverage->blocks[block_index].level << 4) | - (coverage->blocks[block_index].level << 6); + (coverage->blocks[block_index].level << 6); memset (data, byte, 64); } @@ -259,7 +259,7 @@ pango_coverage_set (PangoCoverage *coverage, **/ void pango_coverage_max (PangoCoverage *coverage, - PangoCoverage *other) + PangoCoverage *other) { int block_index, i; int old_blocks; diff --git a/pango/pango-engine.c b/pango/pango-engine.c index 20dbacd..c846189 100644 --- a/pango/pango-engine.c +++ b/pango/pango-engine.c @@ -97,10 +97,10 @@ typedef PangoEngineShapeClass PangoFallbackEngineClass; static void fallback_engine_shape (PangoEngineShape *engine, PangoFont *font, - const char *text, - gint length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs) + const char *text, + gint length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs) { int n_chars; int i; diff --git a/pango/pango-engine.h b/pango/pango-engine.h index 057a965..c620db9 100644 --- a/pango/pango-engine.h +++ b/pango/pango-engine.h @@ -120,7 +120,7 @@ struct _PangoEngineLangClass int len, PangoAnalysis *analysis, PangoLogAttr *attrs, - int attrs_len); + int attrs_len); }; GType pango_engine_lang_get_type (void) G_GNUC_CONST; @@ -289,7 +289,7 @@ prefix ## _register_type (GTypeModule *module) \ }; \ \ prefix ## _type = g_type_module_register_type (module, parent_type, \ - # name, \ + # name, \ &object_info, 0); \ } @@ -321,7 +321,7 @@ prefix ## _register_type (GTypeModule *module) \ #define PANGO_ENGINE_LANG_DEFINE_TYPE(name, prefix, class_init, instance_init) \ PANGO_ENGINE_DEFINE_TYPE (name, prefix, \ class_init, instance_init, \ - PANGO_TYPE_ENGINE_LANG) + PANGO_TYPE_ENGINE_LANG) /** * PANGO_ENGINE_SHAPE_DEFINE_TYPE: @@ -351,7 +351,7 @@ prefix ## _register_type (GTypeModule *module) \ #define PANGO_ENGINE_SHAPE_DEFINE_TYPE(name, prefix, class_init, instance_init) \ PANGO_ENGINE_DEFINE_TYPE (name, prefix, \ class_init, instance_init, \ - PANGO_TYPE_ENGINE_SHAPE) + PANGO_TYPE_ENGINE_SHAPE) /* Macro used for possibly builtin Pango modules. Not useful * for externally build modules. If we are compiling a module standaline, diff --git a/pango/pango-font.h b/pango/pango-font.h index e9b571b..4b00fb1 100644 --- a/pango/pango-font.h +++ b/pango/pango-font.h @@ -231,8 +231,8 @@ struct _PangoFontFamilyClass /*< public >*/ void (*list_faces) (PangoFontFamily *family, - PangoFontFace ***faces, - int *n_faces); + PangoFontFace ***faces, + int *n_faces); const char * (*get_name) (PangoFontFamily *family); gboolean (*is_monospace) (PangoFontFamily *family); @@ -259,8 +259,8 @@ GType pango_font_face_get_type (void) G_GNUC_CONST; PangoFontDescription *pango_font_face_describe (PangoFontFace *face); G_CONST_RETURN char *pango_font_face_get_face_name (PangoFontFace *face); void pango_font_face_list_sizes (PangoFontFace *face, - int **sizes, - int *n_sizes); + int **sizes, + int *n_sizes); #ifdef PANGO_ENABLE_BACKEND @@ -284,8 +284,8 @@ struct _PangoFontFaceClass const char * (*get_face_name) (PangoFontFace *face); PangoFontDescription * (*describe) (PangoFontFace *face); void (*list_sizes) (PangoFontFace *face, - int **sizes, - int *n_sizes); + int **sizes, + int *n_sizes); /*< private >*/ diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c index c181eb6..e50e440 100644 --- a/pango/pango-fontmap.c +++ b/pango/pango-fontmap.c @@ -181,7 +181,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap, pango_font_description_set_family_static (tmp_desc, "Sans"); if (!warned_fonts || !g_hash_table_lookup (warned_fonts, ctmp1)) - { + { if (!warned_fonts) warned_fonts = g_hash_table_new (g_str_hash, g_str_equal); @@ -191,7 +191,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap, g_warning ("couldn't load font \"%s\", falling back to \"%s\", " "expect ugly output.", ctmp1, ctmp2); g_free (ctmp2); - } + } g_free (ctmp1); pango_font_map_fontset_add_fonts (fontmap, @@ -215,7 +215,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap, pango_font_description_set_stretch (tmp_desc, PANGO_STRETCH_NORMAL); if (!warned_fonts || !g_hash_table_lookup (warned_fonts, ctmp1)) - { + { g_hash_table_insert (warned_fonts, g_strdup (ctmp1), GINT_TO_POINTER (1)); ctmp2 = pango_font_description_to_string (tmp_desc); diff --git a/pango/pango-glyph.h b/pango/pango-glyph.h index 16d9e35..3fb6d94 100644 --- a/pango/pango-glyph.h +++ b/pango/pango-glyph.h @@ -94,11 +94,11 @@ void pango_glyph_string_extents (PangoGlyphString *glyphs, int pango_glyph_string_get_width(PangoGlyphString *glyphs); void pango_glyph_string_extents_range (PangoGlyphString *glyphs, - int start, - int end, - PangoFont *font, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect); + int start, + int end, + PangoFont *font, + PangoRectangle *ink_rect, + PangoRectangle *logical_rect); void pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs, const char *text, diff --git a/pango/pango-gravity.c b/pango/pango-gravity.c index 159ce8a..1b59a50 100644 --- a/pango/pango-gravity.c +++ b/pango/pango-gravity.c @@ -274,12 +274,12 @@ pango_gravity_get_for_script (PangoScript script, default: case PANGO_GRAVITY_HINT_NATURAL: if (props.vert_dir == PANGO_VERTICAL_DIRECTION_NONE) - return PANGO_GRAVITY_SOUTH; + return PANGO_GRAVITY_SOUTH; if ((base_gravity == PANGO_GRAVITY_EAST) ^ (props.vert_dir == PANGO_VERTICAL_DIRECTION_BTT)) - return PANGO_GRAVITY_SOUTH; + return PANGO_GRAVITY_SOUTH; else - return PANGO_GRAVITY_NORTH; + return PANGO_GRAVITY_NORTH; case PANGO_GRAVITY_HINT_STRONG: return base_gravity; @@ -287,8 +287,8 @@ pango_gravity_get_for_script (PangoScript script, case PANGO_GRAVITY_HINT_LINE: if ((base_gravity == PANGO_GRAVITY_EAST) ^ (props.horiz_dir == PANGO_DIRECTION_RTL)) - return PANGO_GRAVITY_SOUTH; + return PANGO_GRAVITY_SOUTH; else - return PANGO_GRAVITY_NORTH; + return PANGO_GRAVITY_NORTH; } } diff --git a/pango/pango-impl-utils.h b/pango/pango-impl-utils.h index 759fdff..ac6a8e5 100644 --- a/pango/pango-impl-utils.h +++ b/pango/pango-impl-utils.h @@ -61,14 +61,14 @@ prefix ## _get_type (void) \ } #define PANGO_DEFINE_TYPE(name, prefix, \ - class_init, instance_init, \ + class_init, instance_init, \ parent_type) \ PANGO_DEFINE_TYPE_FULL (name, prefix, \ class_init, instance_init, \ parent_type, 0) #define PANGO_DEFINE_TYPE_ABSTRACT(name, prefix, \ - class_init, instance_init, \ + class_init, instance_init, \ parent_type) \ PANGO_DEFINE_TYPE_FULL (name, prefix, \ class_init, instance_init, \ diff --git a/pango/pango-item.c b/pango/pango-item.c index 4abe633..177d60d 100644 --- a/pango/pango-item.c +++ b/pango/pango-item.c @@ -104,8 +104,8 @@ pango_item_get_type (void) if (our_type == 0) our_type = g_boxed_type_register_static (I_("PangoItem"), - (GBoxedCopyFunc) pango_item_copy, - (GBoxedFreeFunc) pango_item_free); + (GBoxedCopyFunc) pango_item_copy, + (GBoxedFreeFunc) pango_item_free); return our_type; } @@ -131,8 +131,8 @@ pango_item_get_type (void) **/ PangoItem* pango_item_split (PangoItem *orig, - int split_index, - int split_offset) + int split_index, + int split_offset) { PangoItem *new_item; diff --git a/pango/pango-item.h b/pango/pango-item.h index cdc887e..c07dc67 100644 --- a/pango/pango-item.h +++ b/pango/pango-item.h @@ -62,8 +62,8 @@ PangoItem *pango_item_new (void); PangoItem *pango_item_copy (PangoItem *item); void pango_item_free (PangoItem *item); PangoItem *pango_item_split (PangoItem *orig, - int split_index, - int split_offset); + int split_index, + int split_offset); G_END_DECLS diff --git a/pango/pango-layout.c b/pango/pango-layout.c index afc2fe8..309d6e2 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -140,7 +140,7 @@ struct _PangoLayoutClass #define ITER_IS_INVALID(iter) G_UNLIKELY (check_invalid ((iter), G_STRLOC)) static gboolean check_invalid (PangoLayoutIter *iter, - const char *loc) + const char *loc) { if (iter->line->layout == NULL) { @@ -382,7 +382,7 @@ pango_layout_get_width (PangoLayout *layout) **/ void pango_layout_set_wrap (PangoLayout *layout, - PangoWrapMode wrap) + PangoWrapMode wrap) { g_return_if_fail (PANGO_IS_LAYOUT (layout)); @@ -488,7 +488,7 @@ pango_layout_get_indent (PangoLayout *layout) **/ void pango_layout_set_spacing (PangoLayout *layout, - int spacing) + int spacing) { g_return_if_fail (layout != NULL); @@ -754,7 +754,7 @@ pango_layout_get_alignment (PangoLayout *layout) **/ void pango_layout_set_tabs (PangoLayout *layout, - PangoTabArray *tabs) + PangoTabArray *tabs) { g_return_if_fail (PANGO_IS_LAYOUT (layout)); @@ -799,7 +799,7 @@ pango_layout_get_tabs (PangoLayout *layout) **/ void pango_layout_set_single_paragraph_mode (PangoLayout *layout, - gboolean setting) + gboolean setting) { g_return_if_fail (PANGO_IS_LAYOUT (layout)); @@ -1001,8 +1001,8 @@ pango_layout_get_text (PangoLayout *layout) **/ void pango_layout_set_markup (PangoLayout *layout, - const char *markup, - int length) + const char *markup, + int length) { pango_layout_set_markup_with_accel (layout, markup, length, 0, NULL); } @@ -1031,10 +1031,10 @@ pango_layout_set_markup (PangoLayout *layout, **/ void pango_layout_set_markup_with_accel (PangoLayout *layout, - const char *markup, - int length, - gunichar accel_marker, - gunichar *accel_char) + const char *markup, + int length, + gunichar accel_marker, + gunichar *accel_char) { PangoAttrList *list = NULL; char *text = NULL; @@ -1045,10 +1045,10 @@ pango_layout_set_markup_with_accel (PangoLayout *layout, error = NULL; if (!pango_parse_markup (markup, length, - accel_marker, - &list, &text, - accel_char, - &error)) + accel_marker, + &list, &text, + accel_char, + &error)) { g_warning ("pango_layout_set_markup_with_accel: %s", error->message); g_error_free (error); @@ -1092,22 +1092,22 @@ pango_layout_get_unknown_glyphs_count (PangoLayout *layout) lines_list = layout->lines; while (lines_list) { - line = lines_list->data; - runs_list = line->runs; - - while (runs_list) - { - run = runs_list->data; - - for (i = 0; i < run->glyphs->num_glyphs; i++) - { - if (run->glyphs->glyphs[i].glyph & PANGO_GLYPH_UNKNOWN_FLAG) - count++; - } - - runs_list = runs_list->next; - } - lines_list = lines_list->next; + line = lines_list->data; + runs_list = line->runs; + + while (runs_list) + { + run = runs_list->data; + + for (i = 0; i < run->glyphs->num_glyphs; i++) + { + if (run->glyphs->glyphs[i].glyph & PANGO_GLYPH_UNKNOWN_FLAG) + count++; + } + + runs_list = runs_list->next; + } + lines_list = lines_list->next; } layout->unknown_glyphs_count = count; @@ -1392,7 +1392,7 @@ pango_layout_line_index_to_x (PangoLayoutLine *line, &run->item->analysis, index - run->item->offset, trailing, x_pos); if (x_pos) - *x_pos += width; + *x_pos += width; } return; @@ -1429,7 +1429,7 @@ pango_layout_index_to_line (PangoLayout *layout, PangoLayoutLine *tmp_line = tmp_list->data; if (tmp_line->start_index > index) - break; /* index was in paragraph delimiters */ + break; /* index was in paragraph delimiters */ prev_line = line; line = tmp_line; @@ -1437,7 +1437,7 @@ pango_layout_index_to_line (PangoLayout *layout, i++; if (line->start_index + line->length > index) - break; + break; tmp_list = tmp_list->next; } @@ -1781,34 +1781,34 @@ pango_layout_xy_to_index (PangoLayout *layout, pango_layout_iter_get_line_yrange (iter, &first_y, &last_y); if (y < first_y) - { - if (prev_line && y < (prev_last + (first_y - prev_last) / 2)) - { - found = prev_line; - found_line_x = prev_line_x; - } - else - { - if (prev_line == NULL) - outside = TRUE; /* off the top */ - - found = _pango_layout_iter_get_line (iter); - found_line_x = x - line_logical.x; - } - } + { + if (prev_line && y < (prev_last + (first_y - prev_last) / 2)) + { + found = prev_line; + found_line_x = prev_line_x; + } + else + { + if (prev_line == NULL) + outside = TRUE; /* off the top */ + + found = _pango_layout_iter_get_line (iter); + found_line_x = x - line_logical.x; + } + } else if (y >= first_y && - y < last_y) - { - found = _pango_layout_iter_get_line (iter); - found_line_x = x - line_logical.x; - } + y < last_y) + { + found = _pango_layout_iter_get_line (iter); + found_line_x = x - line_logical.x; + } prev_line = _pango_layout_iter_get_line (iter); prev_last = last_y; prev_line_x = x - line_logical.x; if (found != NULL) - break; + break; } while (pango_layout_iter_next_line (iter)); @@ -1824,8 +1824,8 @@ pango_layout_xy_to_index (PangoLayout *layout, } retval = pango_layout_line_x_to_index (found, - found_line_x, - index, trailing); + found_line_x, + index, trailing); if (outside) retval = FALSE; @@ -2101,9 +2101,9 @@ pango_layout_get_cursor_pos (PangoLayout *layout, { dir1 = layout_line->resolved_dir; if (layout_line->resolved_dir == PANGO_DIRECTION_LTR) - x1_trailing = 0; + x1_trailing = 0; else - x1_trailing = line_rect.width; + x1_trailing = line_rect.width; } else { @@ -2116,9 +2116,9 @@ pango_layout_get_cursor_pos (PangoLayout *layout, if (index >= layout_line->start_index + layout_line->length) { if (layout_line->resolved_dir == PANGO_DIRECTION_LTR) - x2 = line_rect.width; + x2 = line_rect.width; else - x2 = 0; + x2 = 0; } else { @@ -2196,10 +2196,10 @@ get_alignment (PangoLayout *layout, static void get_x_offset (PangoLayout *layout, - PangoLayoutLine *line, - int layout_width, - int line_width, - int *x_offset) + PangoLayoutLine *line, + int layout_width, + int line_width, + int *x_offset) { PangoAlignment alignment = get_alignment (layout, line); @@ -2226,33 +2226,33 @@ get_x_offset (PangoLayout *layout, if (line->is_paragraph_start) { if (layout->indent > 0) - { - if (alignment == PANGO_ALIGN_LEFT) - *x_offset += layout->indent; - else - *x_offset -= layout->indent; - } + { + if (alignment == PANGO_ALIGN_LEFT) + *x_offset += layout->indent; + else + *x_offset -= layout->indent; + } } else { if (layout->indent < 0) - { - if (alignment == PANGO_ALIGN_LEFT) - *x_offset -= layout->indent; - else - *x_offset += layout->indent; - } + { + if (alignment == PANGO_ALIGN_LEFT) + *x_offset -= layout->indent; + else + *x_offset += layout->indent; + } } } static void get_line_extents_layout_coords (PangoLayout *layout, - PangoLayoutLine *line, - int layout_width, - int y_offset, - int *baseline, - PangoRectangle *line_ink_layout, - PangoRectangle *line_logical_layout) + PangoLayoutLine *line, + int layout_width, + int y_offset, + int *baseline, + PangoRectangle *line_ink_layout, + PangoRectangle *line_logical_layout) { int x_offset; /* Line extents in line coords (origin at line baseline) */ @@ -2260,7 +2260,7 @@ get_line_extents_layout_coords (PangoLayout *layout, PangoRectangle line_logical; pango_layout_line_get_extents (line, line_ink_layout ? &line_ink : NULL, - &line_logical); + &line_logical); get_x_offset (layout, line, layout_width, line_logical.width, &x_offset); @@ -2288,9 +2288,9 @@ get_line_extents_layout_coords (PangoLayout *layout, */ static void pango_layout_get_extents_internal (PangoLayout *layout, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect, - GSList **line_extents) + PangoRectangle *ink_rect, + PangoRectangle *logical_rect, + GSList **line_extents) { GSList *line_list; int y_offset = 0; @@ -2368,48 +2368,48 @@ pango_layout_get_extents_internal (PangoLayout *layout, /* This block gets the line extents in layout coords */ { - int baseline; - - get_line_extents_layout_coords (layout, line, - width, y_offset, - &baseline, - ink_rect ? &line_ink_layout : NULL, - &line_logical_layout); - - if (line_extents) - { - Extents *ext = g_slice_new (Extents); - ext->baseline = baseline; - ext->ink_rect = line_ink_layout; - ext->logical_rect = line_logical_layout; - *line_extents = g_slist_prepend (*line_extents, ext); - } + int baseline; + + get_line_extents_layout_coords (layout, line, + width, y_offset, + &baseline, + ink_rect ? &line_ink_layout : NULL, + &line_logical_layout); + + if (line_extents) + { + Extents *ext = g_slice_new (Extents); + ext->baseline = baseline; + ext->ink_rect = line_ink_layout; + ext->logical_rect = line_logical_layout; + *line_extents = g_slist_prepend (*line_extents, ext); + } } if (ink_rect) { - /* Compute the union of the current ink_rect with - * line_ink_layout - */ + /* Compute the union of the current ink_rect with + * line_ink_layout + */ if (line_list == layout->lines) { - *ink_rect = line_ink_layout; + *ink_rect = line_ink_layout; } else { new_pos = MIN (ink_rect->x, line_ink_layout.x); ink_rect->width = - MAX (ink_rect->x + ink_rect->width, - line_ink_layout.x + line_ink_layout.width) - new_pos; + MAX (ink_rect->x + ink_rect->width, + line_ink_layout.x + line_ink_layout.width) - new_pos; ink_rect->x = new_pos; new_pos = MIN (ink_rect->y, line_ink_layout.y); ink_rect->height = - MAX (ink_rect->y + ink_rect->height, - line_ink_layout.y + line_ink_layout.height) - new_pos; + MAX (ink_rect->y + ink_rect->height, + line_ink_layout.y + line_ink_layout.height) - new_pos; ink_rect->y = new_pos; - } + } } if (logical_rect) @@ -2444,9 +2444,9 @@ pango_layout_get_extents_internal (PangoLayout *layout, logical_rect->height += line_logical_layout.height; - /* No space after the last line, of course. */ - if (line_list->next != NULL) - logical_rect->height += layout->spacing; + /* No space after the last line, of course. */ + if (line_list->next != NULL) + logical_rect->height += layout->spacing; } y_offset += line_logical_layout.height + layout->spacing; @@ -2473,7 +2473,7 @@ pango_layout_get_extents_internal (PangoLayout *layout, * @ink_rect: rectangle used to store the extents of the layout as drawn * or %NULL to indicate that the result is not needed. * @logical_rect: rectangle used to store the logical extents of the layout - or %NULL to indicate that the result is not needed. + or %NULL to indicate that the result is not needed. * * Computes the logical and ink extents of @layout. Logical extents * are usually what you want for positioning things. Note that both extents @@ -2829,9 +2829,9 @@ get_tab_pos (PangoLayout *layout, int index) pango_tab_array_get_tab (layout->tabs, index, NULL, &pos); if (in_pixels) - return pos * PANGO_SCALE; + return pos * PANGO_SCALE; else - return pos; + return pos; } if (n_tabs > 0) @@ -2846,9 +2846,9 @@ get_tab_pos (PangoLayout *layout, int index) pango_tab_array_get_tab (layout->tabs, n_tabs - 1, NULL, &last_pos); if (n_tabs > 1) - pango_tab_array_get_tab (layout->tabs, n_tabs - 2, NULL, &next_to_last_pos); + pango_tab_array_get_tab (layout->tabs, n_tabs - 2, NULL, &next_to_last_pos); else - next_to_last_pos = 0; + next_to_last_pos = 0; if (in_pixels) { @@ -3227,7 +3227,7 @@ process_item (PangoLayout *layout, length = g_utf8_offset_to_pointer (layout->text + item->offset, break_num_chars) - (layout->text + item->offset); - new_item = pango_item_split (item, length, break_num_chars); + new_item = pango_item_split (item, length, break_num_chars); insert_run (line, state, new_item, FALSE); @@ -3294,7 +3294,7 @@ line_set_resolved_dir (PangoLayoutLine *line, break; case PANGO_GRAVITY_NORTH: line->resolved_dir = PANGO_DIRECTION_LTR - + PANGO_DIRECTION_RTL + + PANGO_DIRECTION_RTL - line->resolved_dir; break; case PANGO_GRAVITY_EAST: @@ -3389,10 +3389,10 @@ process_line (PangoLayout *layout, layout->is_wrapped = TRUE; goto done; - case BREAK_LINE_SEPARATOR: - state->items = g_list_delete_link (state->items, state->items); - state->start_offset += old_num_chars; - goto done; + case BREAK_LINE_SEPARATOR: + state->items = g_list_delete_link (state->items, state->items); + state->start_offset += old_num_chars; + goto done; } } @@ -3405,9 +3405,9 @@ process_line (PangoLayout *layout, static void get_items_log_attrs (const char *text, - GList *items, - PangoLogAttr *log_attrs, - int para_delimiter_len) + GList *items, + PangoLogAttr *log_attrs, + int para_delimiter_len) { int offset = 0; int index = 0; @@ -3443,7 +3443,7 @@ get_items_log_attrs (const char *text, } pango_break (text + index, tmp_item.length, &tmp_item.analysis, - log_attrs + offset, tmp_item.num_chars + 1); + log_attrs + offset, tmp_item.num_chars + 1); offset += tmp_item.num_chars; index += tmp_item.length; @@ -3581,17 +3581,17 @@ pango_layout_check_lines (PangoLayout *layout) ParaBreakState state; if (layout->single_paragraph) - { - delimiter_index = layout->length; - next_para_index = layout->length; - } + { + delimiter_index = layout->length; + next_para_index = layout->length; + } else - { - pango_find_paragraph_boundary (start, - (layout->text + layout->length) - start, - &delimiter_index, - &next_para_index); - } + { + pango_find_paragraph_boundary (start, + (layout->text + layout->length) - start, + &delimiter_index, + &next_para_index); + } g_assert (next_para_index >= delimiter_index); @@ -3628,37 +3628,37 @@ pango_layout_check_lines (PangoLayout *layout) iter); get_items_log_attrs (start, state.items, - layout->log_attrs + start_offset, - delim_len); + layout->log_attrs + start_offset, + delim_len); if (state.items) { state.first_line = TRUE; state.base_dir = base_dir; state.start_offset = start_offset; - state.line_start_index = start - layout->text; + state.line_start_index = start - layout->text; state.glyphs = NULL; state.log_widths = NULL; while (state.items) - process_line (layout, &state); + process_line (layout, &state); } else - { - PangoLayoutLine *empty_line; + { + PangoLayoutLine *empty_line; - empty_line = pango_layout_line_new (layout); - empty_line->start_index = start - layout->text; + empty_line = pango_layout_line_new (layout); + empty_line->start_index = start - layout->text; empty_line->is_paragraph_start = TRUE; line_set_resolved_dir (empty_line, base_dir); - layout->lines = g_slist_prepend (layout->lines, - empty_line); - } + layout->lines = g_slist_prepend (layout->lines, + empty_line); + } if (!done) - start_offset += g_utf8_strlen (start, (end - start) + delim_len); + start_offset += g_utf8_strlen (start, (end - start) + delim_len); start = end + delim_len; } @@ -3730,8 +3730,8 @@ pango_layout_line_get_type(void) if (our_type == 0) our_type = g_boxed_type_register_static (I_("PangoLayoutLine"), - (GBoxedCopyFunc) pango_layout_line_ref, - (GBoxedFreeFunc) pango_layout_line_unref); + (GBoxedCopyFunc) pango_layout_line_ref, + (GBoxedFreeFunc) pango_layout_line_unref); return our_type; } @@ -4221,8 +4221,8 @@ pango_layout_run_get_width (PangoLayoutRun *run) static void pango_layout_run_get_extents (PangoLayoutRun *run, - PangoRectangle *run_ink, - PangoRectangle *run_logical) + PangoRectangle *run_ink, + PangoRectangle *run_logical) { PangoRectangle logical; ItemProperties properties; @@ -4270,7 +4270,7 @@ pango_layout_run_get_extents (PangoLayoutRun *run, */ if (properties.strikethrough) - { + { if (run_ink->height == 0) { run_ink->height = strikethrough_thickness; @@ -4311,7 +4311,7 @@ pango_layout_run_get_extents (PangoLayoutRun *run, if (properties.rise != 0) { if (run_ink) - run_ink->y -= properties.rise; + run_ink->y -= properties.rise; if (run_logical) run_logical->y -= properties.rise; @@ -4360,7 +4360,7 @@ pango_layout_line_get_extents (PangoLayoutLine *line, } case NOT_CACHED: { - caching = TRUE; + caching = TRUE; if (!ink_rect) ink_rect = &private->ink_rect; if (!logical_rect) @@ -4369,7 +4369,7 @@ pango_layout_line_get_extents (PangoLayoutLine *line, } case LEAKED: { - break; + break; } } @@ -4398,8 +4398,8 @@ pango_layout_line_get_extents (PangoLayoutLine *line, PangoRectangle run_logical; pango_layout_run_get_extents (run, - ink_rect ? &run_ink : NULL, - &run_logical); + ink_rect ? &run_ink : NULL, + &run_logical); if (ink_rect) { @@ -4734,9 +4734,9 @@ pango_layout_get_item_properties (PangoItem *item, properties->strikethrough = ((PangoAttrInt *)attr)->value; break; - case PANGO_ATTR_RISE: + case PANGO_ATTR_RISE: properties->rise = ((PangoAttrInt *)attr)->value; - break; + break; case PANGO_ATTR_LETTER_SPACING: properties->letter_spacing = ((PangoAttrInt *)attr)->value; @@ -4757,7 +4757,7 @@ pango_layout_get_item_properties (PangoItem *item, static int next_cluster_start (PangoGlyphString *gs, - int cluster_start) + int cluster_start) { int i; @@ -4765,7 +4765,7 @@ next_cluster_start (PangoGlyphString *gs, while (i < gs->num_glyphs) { if (gs->glyphs[i].attr.is_cluster_start) - return i; + return i; i++; } @@ -4785,7 +4785,7 @@ cluster_width (PangoGlyphString *gs, while (i < gs->num_glyphs) { if (gs->glyphs[i].attr.is_cluster_start) - break; + break; width += gs->glyphs[i].geometry.width; i++; @@ -4796,7 +4796,7 @@ cluster_width (PangoGlyphString *gs, static inline void offset_y (PangoLayoutIter *iter, - int *y) + int *y) { Extents *line_ext; @@ -5006,9 +5006,9 @@ pango_layout_get_iter (PangoLayout *layout) iter->line_extents = NULL; pango_layout_get_extents_internal (layout, - NULL, - &logical_rect, - &iter->line_extents); + NULL, + &logical_rect, + &iter->line_extents); iter->layout_width = layout->width == -1 ? logical_rect.width : layout->width; iter->line_extents_link = iter->line_extents; @@ -5441,7 +5441,7 @@ pango_layout_iter_next_line (PangoLayoutIter *iter) **/ void pango_layout_iter_get_char_extents (PangoLayoutIter *iter, - PangoRectangle *logical_rect) + PangoRectangle *logical_rect) { PangoRectangle cluster_rect; int x0, x1; @@ -5484,8 +5484,8 @@ pango_layout_iter_get_char_extents (PangoLayoutIter *iter, **/ void pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect) + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { if (ITER_IS_INVALID (iter)) return; @@ -5500,11 +5500,11 @@ pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter, } pango_glyph_string_extents_range (iter->run->glyphs, - iter->cluster_start, - iter->next_cluster_glyph, - iter->run->item->analysis.font, - ink_rect, - logical_rect); + iter->cluster_start, + iter->next_cluster_glyph, + iter->run->item->analysis.font, + ink_rect, + logical_rect); if (ink_rect) { @@ -5532,8 +5532,8 @@ pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter, **/ void pango_layout_iter_get_run_extents (PangoLayoutIter *iter, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect) + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { if (G_UNLIKELY (!ink_rect && !logical_rect)) return; @@ -5564,10 +5564,10 @@ pango_layout_iter_get_run_extents (PangoLayoutIter *iter, pango_layout_iter_get_line_extents (iter, ink_rect, logical_rect); if (ink_rect) - { - ink_rect->x = iter->run_x; - ink_rect->width = 0; - } + { + ink_rect->x = iter->run_x; + ink_rect->width = 0; + } if (logical_rect) { @@ -5593,8 +5593,8 @@ pango_layout_iter_get_run_extents (PangoLayoutIter *iter, **/ void pango_layout_iter_get_line_extents (PangoLayoutIter *iter, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect) + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { Extents *ext; @@ -5606,11 +5606,11 @@ pango_layout_iter_get_line_extents (PangoLayoutIter *iter, if (ink_rect) { get_line_extents_layout_coords (iter->layout, iter->line, - iter->layout_width, - ext->logical_rect.y, - NULL, - ink_rect, - NULL); + iter->layout_width, + ext->logical_rect.y, + NULL, + ink_rect, + NULL); } if (logical_rect) @@ -5634,8 +5634,8 @@ pango_layout_iter_get_line_extents (PangoLayoutIter *iter, **/ void pango_layout_iter_get_line_yrange (PangoLayoutIter *iter, - int *y0, - int *y1) + int *y0, + int *y1) { Extents *ext; int half_spacing; @@ -5656,18 +5656,18 @@ pango_layout_iter_get_line_yrange (PangoLayoutIter *iter, /* No spacing above the first line */ if (iter->line_extents_link == iter->line_extents) - *y0 = ext->logical_rect.y; + *y0 = ext->logical_rect.y; else - *y0 = ext->logical_rect.y - (iter->layout->spacing - half_spacing); + *y0 = ext->logical_rect.y - (iter->layout->spacing - half_spacing); } if (y1) { /* No spacing below the last line */ if (iter->line_extents_link->next == NULL) - *y1 = ext->logical_rect.y + ext->logical_rect.height; + *y1 = ext->logical_rect.y + ext->logical_rect.height; else - *y1 = ext->logical_rect.y + ext->logical_rect.height + half_spacing; + *y1 = ext->logical_rect.y + ext->logical_rect.height + half_spacing; } } @@ -5706,8 +5706,8 @@ pango_layout_iter_get_baseline (PangoLayoutIter *iter) **/ void pango_layout_iter_get_layout_extents (PangoLayoutIter *iter, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect) + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { if (ITER_IS_INVALID (iter)) return; diff --git a/pango/pango-layout.h b/pango/pango-layout.h index 752d624..ff8389e 100644 --- a/pango/pango-layout.h +++ b/pango/pango-layout.h @@ -105,14 +105,14 @@ void pango_layout_set_text (PangoLayout *layout, const char *pango_layout_get_text (PangoLayout *layout); void pango_layout_set_markup (PangoLayout *layout, - const char *markup, - int length); + const char *markup, + int length); void pango_layout_set_markup_with_accel (PangoLayout *layout, - const char *markup, - int length, - gunichar accel_marker, - gunichar *accel_char); + const char *markup, + int length, + gunichar accel_marker, + gunichar *accel_char); void pango_layout_set_font_description (PangoLayout *layout, const PangoFontDescription *desc); @@ -123,7 +123,7 @@ void pango_layout_set_width (PangoLayout *la int width); int pango_layout_get_width (PangoLayout *layout); void pango_layout_set_wrap (PangoLayout *layout, - PangoWrapMode wrap); + PangoWrapMode wrap); PangoWrapMode pango_layout_get_wrap (PangoLayout *layout); gboolean pango_layout_is_wrapped (PangoLayout *layout); void pango_layout_set_indent (PangoLayout *layout, @@ -143,12 +143,12 @@ void pango_layout_set_alignment (PangoLayout *la PangoAlignment pango_layout_get_alignment (PangoLayout *layout); void pango_layout_set_tabs (PangoLayout *layout, - PangoTabArray *tabs); + PangoTabArray *tabs); PangoTabArray* pango_layout_get_tabs (PangoLayout *layout); void pango_layout_set_single_paragraph_mode (PangoLayout *layout, - gboolean setting); + gboolean setting); gboolean pango_layout_get_single_paragraph_mode (PangoLayout *layout); void pango_layout_set_ellipsize (PangoLayout *layout, @@ -168,10 +168,10 @@ void pango_layout_index_to_pos (PangoLayout *layout, int index_, PangoRectangle *pos); void pango_layout_index_to_line_x (PangoLayout *layout, - int index_, - gboolean trailing, - int *line, - int *x_pos); + int index_, + gboolean trailing, + int *line, + int *x_pos); void pango_layout_get_cursor_pos (PangoLayout *layout, int index_, PangoRectangle *strong_pos, @@ -259,25 +259,25 @@ gboolean pango_layout_iter_next_run (PangoLayoutIter *iter); gboolean pango_layout_iter_next_line (PangoLayoutIter *iter); void pango_layout_iter_get_char_extents (PangoLayoutIter *iter, - PangoRectangle *logical_rect); + PangoRectangle *logical_rect); void pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect); + PangoRectangle *ink_rect, + PangoRectangle *logical_rect); void pango_layout_iter_get_run_extents (PangoLayoutIter *iter, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect); + PangoRectangle *ink_rect, + PangoRectangle *logical_rect); void pango_layout_iter_get_line_extents (PangoLayoutIter *iter, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect); + PangoRectangle *ink_rect, + PangoRectangle *logical_rect); /* All the yranges meet, unlike the logical_rect's (i.e. the yranges * assign between-line spacing to the nearest line) */ void pango_layout_iter_get_line_yrange (PangoLayoutIter *iter, - int *y0_, - int *y1_); + int *y0_, + int *y1_); void pango_layout_iter_get_layout_extents (PangoLayoutIter *iter, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect); + PangoRectangle *ink_rect, + PangoRectangle *logical_rect); int pango_layout_iter_get_baseline (PangoLayoutIter *iter); G_END_DECLS diff --git a/pango/pango-markup.c b/pango/pango-markup.c index 077bb3b..3108621 100644 --- a/pango/pango-markup.c +++ b/pango/pango-markup.c @@ -82,78 +82,78 @@ struct _OpenTag }; typedef gboolean (*TagParseFunc) (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean b_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean big_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean span_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean i_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean markup_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean s_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean sub_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean sup_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean small_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean tt_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static gboolean u_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error); + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error); static double scale_factor (int scale_level, double base) @@ -167,21 +167,21 @@ scale_factor (int scale_level, double base) { i = 0; while (i < scale_level) - { - factor *= 1.2; + { + factor *= 1.2; - ++i; - } + ++i; + } } else if (scale_level < 0) { i = scale_level; while (i < 0) - { - factor /= 1.2; + { + factor /= 1.2; - ++i; - } + ++i; + } } return factor; @@ -197,7 +197,7 @@ open_tag_free (OpenTag *ot) static void open_tag_set_absolute_font_size (OpenTag *ot, - int font_size) + int font_size) { ot->base_font_size = font_size; ot->has_base_font_size = TRUE; @@ -207,7 +207,7 @@ open_tag_set_absolute_font_size (OpenTag *ot, static void open_tag_set_absolute_font_scale (OpenTag *ot, - double scale) + double scale) { ot->base_scale_factor = scale; ot->has_base_font_size = FALSE; @@ -264,7 +264,7 @@ markup_data_close_tag (MarkupData *md) /* pop the stack */ ot = md->tag_stack->data; md->tag_stack = g_slist_delete_link (md->tag_stack, - md->tag_stack); + md->tag_stack); /* Adjust end indexes, and push each attr onto the front of the * to_apply list. This means that outermost tags are on the front of @@ -292,22 +292,22 @@ markup_data_close_tag (MarkupData *md) PangoAttribute *a; if (ot->has_base_font_size) - { - /* Create a font using the absolute point size - * as the base size to be scaled from - */ - a = pango_attr_size_new (scale_factor (ot->scale_level, - 1.0) * - ot->base_font_size); - } + { + /* Create a font using the absolute point size + * as the base size to be scaled from + */ + a = pango_attr_size_new (scale_factor (ot->scale_level, + 1.0) * + ot->base_font_size); + } else - { - /* Create a font using the current scale factor - * as the base size to be scaled from - */ - a = pango_attr_scale_new (scale_factor (ot->scale_level, - ot->base_scale_factor)); - } + { + /* Create a font using the current scale factor + * as the base size to be scaled from + */ + a = pango_attr_scale_new (scale_factor (ot->scale_level, + ot->base_scale_factor)); + } a->start_index = ot->start_index; a->end_index = md->index; @@ -321,11 +321,11 @@ markup_data_close_tag (MarkupData *md) static void start_element_handler (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer user_data, + GError **error) { TagParseFunc parse_func = NULL; OpenTag *ot; @@ -334,42 +334,42 @@ start_element_handler (GMarkupParseContext *context, { case 'b': if (strcmp ("b", element_name) == 0) - parse_func = b_parse_func; + parse_func = b_parse_func; else if (strcmp ("big", element_name) == 0) - parse_func = big_parse_func; + parse_func = big_parse_func; break; case 'i': if (strcmp ("i", element_name) == 0) - parse_func = i_parse_func; + parse_func = i_parse_func; break; case 'm': if (strcmp ("markup", element_name) == 0) - parse_func = markup_parse_func; + parse_func = markup_parse_func; break; case 's': if (strcmp ("span", element_name) == 0) - parse_func = span_parse_func; + parse_func = span_parse_func; else if (strcmp ("s", element_name) == 0) - parse_func = s_parse_func; + parse_func = s_parse_func; else if (strcmp ("sub", element_name) == 0) - parse_func = sub_parse_func; + parse_func = sub_parse_func; else if (strcmp ("sup", element_name) == 0) - parse_func = sup_parse_func; + parse_func = sup_parse_func; else if (strcmp ("small", element_name) == 0) - parse_func = small_parse_func; + parse_func = small_parse_func; break; case 't': if (strcmp ("tt", element_name) == 0) - parse_func = tt_parse_func; + parse_func = tt_parse_func; break; case 'u': if (strcmp ("u", element_name) == 0) - parse_func = u_parse_func; + parse_func = u_parse_func; break; } @@ -378,14 +378,14 @@ start_element_handler (GMarkupParseContext *context, gint line_number, char_number; g_markup_parse_context_get_position (context, - &line_number, &char_number); + &line_number, &char_number); g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_UNKNOWN_ELEMENT, - _("Unknown tag '%s' on line %d char %d"), - element_name, - line_number, char_number); + G_MARKUP_ERROR, + G_MARKUP_ERROR_UNKNOWN_ELEMENT, + _("Unknown tag '%s' on line %d char %d"), + element_name, + line_number, char_number); return; } @@ -395,8 +395,8 @@ start_element_handler (GMarkupParseContext *context, /* note ot may be NULL if the user didn't want the attribute list */ if (!(*parse_func) (user_data, ot, - attribute_names, attribute_values, - context, error)) + attribute_names, attribute_values, + context, error)) { /* there's nothing to do; we return an error, and end up * freeing ot off the tag stack later. @@ -406,19 +406,19 @@ start_element_handler (GMarkupParseContext *context, static void end_element_handler (GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, - GError **error) + const gchar *element_name, + gpointer user_data, + GError **error) { markup_data_close_tag (user_data); } static void text_handler (GMarkupParseContext *context, - const gchar *text, - gsize text_len, - gpointer user_data, - GError **error) + const gchar *text, + gsize text_len, + gpointer user_data, + GError **error) { MarkupData *md = user_data; @@ -446,90 +446,90 @@ text_handler (GMarkupParseContext *context, end = text + text_len; while (p != end) - { - gunichar c; - - c = g_utf8_get_char (p); - - if (range_end) - { - if (c == md->accel_marker) - { - /* escaped accel marker; move range_end - * past the accel marker that came before, - * append the whole thing - */ - range_end = g_utf8_next_char (range_end); - g_string_append_len (md->text, - range_start, - range_end - range_start); - md->index += range_end - range_start; - - /* set next range_start, skipping accel marker */ - range_start = g_utf8_next_char (p); - } - else - { - /* Don't append the accel marker (leave range_end - * alone); set the accel char to c; record location for - * underline attribute - */ - if (md->accel_char == 0) - md->accel_char = c; - - g_string_append_len (md->text, - range_start, - range_end - range_start); - md->index += range_end - range_start; - - /* The underline should go underneath the char - * we're setting as the next range_start - */ - uline_index = md->index; - uline_len = g_utf8_next_char (p) - p; - - /* set next range_start to include this char */ - range_start = p; - } - - /* reset range_end */ - range_end = NULL; - } - else if (c == md->accel_marker) - { - range_end = p; - } - - p = g_utf8_next_char (p); - } + { + gunichar c; + + c = g_utf8_get_char (p); + + if (range_end) + { + if (c == md->accel_marker) + { + /* escaped accel marker; move range_end + * past the accel marker that came before, + * append the whole thing + */ + range_end = g_utf8_next_char (range_end); + g_string_append_len (md->text, + range_start, + range_end - range_start); + md->index += range_end - range_start; + + /* set next range_start, skipping accel marker */ + range_start = g_utf8_next_char (p); + } + else + { + /* Don't append the accel marker (leave range_end + * alone); set the accel char to c; record location for + * underline attribute + */ + if (md->accel_char == 0) + md->accel_char = c; + + g_string_append_len (md->text, + range_start, + range_end - range_start); + md->index += range_end - range_start; + + /* The underline should go underneath the char + * we're setting as the next range_start + */ + uline_index = md->index; + uline_len = g_utf8_next_char (p) - p; + + /* set next range_start to include this char */ + range_start = p; + } + + /* reset range_end */ + range_end = NULL; + } + else if (c == md->accel_marker) + { + range_end = p; + } + + p = g_utf8_next_char (p); + } if (range_end) - { - g_string_append_len (md->text, - range_start, - range_end - range_start); - md->index += range_end - range_start; - } + { + g_string_append_len (md->text, + range_start, + range_end - range_start); + md->index += range_end - range_start; + } else - { - g_string_append_len (md->text, - range_start, - end - range_start); - md->index += end - range_start; - } + { + g_string_append_len (md->text, + range_start, + end - range_start); + md->index += end - range_start; + } if (md->attr_list != NULL && uline_index >= 0) - { - /* Add the underline indicating the accelerator */ - PangoAttribute *attr; + { + /* Add the underline indicating the accelerator */ + PangoAttribute *attr; - attr = pango_attr_underline_new (PANGO_UNDERLINE_LOW); + attr = pango_attr_underline_new (PANGO_UNDERLINE_LOW); - attr->start_index = uline_index; - attr->end_index = uline_index + uline_len; + attr->start_index = uline_index; + attr->end_index = uline_index + uline_len; - pango_attr_list_change (md->attr_list, attr); - } + pango_attr_list_change (md->attr_list, attr); + } } } @@ -574,12 +574,12 @@ static const GMarkupParser pango_markup_parser = { **/ gboolean pango_parse_markup (const char *markup_text, - int length, - gunichar accel_marker, - PangoAttrList **attr_list, - char **text, - gunichar *accel_char, - GError **error) + int length, + gunichar accel_marker, + PangoAttrList **attr_list, + char **text, + gunichar *accel_char, + GError **error) { GMarkupParseContext *context = NULL; MarkupData *md = NULL; @@ -614,7 +614,7 @@ pango_parse_markup (const char *markup_text, md->to_apply = NULL; context = g_markup_parse_context_new (&pango_markup_parser, - 0, md, NULL); + 0, md, NULL); if (length < 0) length = strlen (markup_text); @@ -629,23 +629,23 @@ pango_parse_markup (const char *markup_text, if (needs_root) if (!g_markup_parse_context_parse (context, - "", - -1, - error)) + "", + -1, + error)) goto error; if (!g_markup_parse_context_parse (context, - markup_text, - length, - error)) + markup_text, + length, + error)) goto error; if (needs_root) if (!g_markup_parse_context_parse (context, - "", - -1, - error)) + "", + -1, + error)) goto error; if (!g_markup_parse_context_end_parse (context, error)) @@ -660,14 +660,14 @@ pango_parse_markup (const char *markup_text, */ tmp_list = md->to_apply; while (tmp_list != NULL) - { - PangoAttribute *attr = tmp_list->data; + { + PangoAttribute *attr = tmp_list->data; - /* Innermost tags before outermost */ - pango_attr_list_change (md->attr_list, attr); + /* Innermost tags before outermost */ + pango_attr_list_change (md->attr_list, attr); - tmp_list = g_slist_next (tmp_list); - } + tmp_list = g_slist_next (tmp_list); + } g_slist_free (md->to_apply); md->to_apply = NULL; } @@ -709,27 +709,27 @@ pango_parse_markup (const char *markup_text, static void set_bad_attribute (GError **error, - GMarkupParseContext *context, - const char *element_name, - const char *attribute_name) + GMarkupParseContext *context, + const char *element_name, + const char *attribute_name) { gint line_number, char_number; g_markup_parse_context_get_position (context, - &line_number, &char_number); + &line_number, &char_number); g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, - _("Tag '%s' does not support attribute '%s' on line %d char %d"), - element_name, - attribute_name, - line_number, char_number); + G_MARKUP_ERROR, + G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, + _("Tag '%s' does not support attribute '%s' on line %d char %d"), + element_name, + attribute_name, + line_number, char_number); } static void add_attribute (OpenTag *ot, - PangoAttribute *attr) + PangoAttribute *attr) { if (ot == NULL) pango_attribute_destroy (attr); @@ -738,18 +738,18 @@ add_attribute (OpenTag *ot, } #define CHECK_NO_ATTRS(elem) G_STMT_START { \ - if (*names != NULL) { \ - set_bad_attribute (error, context, (elem), *names); \ - return FALSE; \ - } }G_STMT_END + if (*names != NULL) { \ + set_bad_attribute (error, context, (elem), *names); \ + return FALSE; \ + } }G_STMT_END static gboolean b_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("b"); add_attribute (tag, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); @@ -758,11 +758,11 @@ b_parse_func (MarkupData *md, static gboolean big_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("big"); @@ -778,7 +778,7 @@ big_parse_func (MarkupData *md, static gboolean parse_absolute_size (OpenTag *tag, - const char *size) + const char *size) { SizeLevel level = Medium; double factor; @@ -828,13 +828,13 @@ attr_strcmp (gconstpointer pa, cb = *b++; if (ca == cb) - continue; + continue; ca = ca == '_' ? '-' : ca; cb = cb == '_' ? '-' : cb; if (ca != cb) - return cb - ca; + return cb - ca; } ca = *a; @@ -882,9 +882,9 @@ span_parse_boolean (const char *attr_name, strcmp (attr_val, "y") == 0) *val = TRUE; else if (strcmp (attr_val, "false") == 0 || - strcmp (attr_val, "no") == 0 || - strcmp (attr_val, "f") == 0 || - strcmp (attr_val, "n") == 0) + strcmp (attr_val, "no") == 0 || + strcmp (attr_val, "f") == 0 || + strcmp (attr_val, "n") == 0) *val = FALSE; else { @@ -951,11 +951,11 @@ span_parse_enum (const char *attr_name, static gboolean span_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { int line_number, char_number; int i; @@ -981,17 +981,17 @@ span_parse_func (MarkupData *md, const char *gravity_hint = NULL; g_markup_parse_context_get_position (context, - &line_number, &char_number); + &line_number, &char_number); #define CHECK_DUPLICATE(var) G_STMT_START{ \ - if ((var) != NULL) { \ - g_set_error (error, G_MARKUP_ERROR, \ - G_MARKUP_ERROR_INVALID_CONTENT, \ - _("Attribute '%s' occurs twice on tag " \ - "on line %d char %d, may only occur once"), \ - names[i], line_number, char_number); \ - return FALSE; \ - }}G_STMT_END + if ((var) != NULL) { \ + g_set_error (error, G_MARKUP_ERROR, \ + G_MARKUP_ERROR_INVALID_CONTENT, \ + _("Attribute '%s' occurs twice on tag " \ + "on line %d char %d, may only occur once"), \ + names[i], line_number, char_number); \ + return FALSE; \ + }}G_STMT_END #define CHECK_ATTRIBUTE2(var, name) \ if (attr_strcmp (names[i], (name)) == 0) { \ CHECK_DUPLICATE (var); \ @@ -1008,49 +1008,49 @@ span_parse_func (MarkupData *md, switch (names[i][0]) { case 'f': - CHECK_ATTRIBUTE2(family, "face"); - CHECK_ATTRIBUTE (fallback); - CHECK_ATTRIBUTE2(desc, "font_desc"); - CHECK_ATTRIBUTE2(family, "font_family"); - CHECK_ATTRIBUTE (foreground); + CHECK_ATTRIBUTE2(family, "face"); + CHECK_ATTRIBUTE (fallback); + CHECK_ATTRIBUTE2(desc, "font_desc"); + CHECK_ATTRIBUTE2(family, "font_family"); + CHECK_ATTRIBUTE (foreground); break; case 's': - CHECK_ATTRIBUTE (size); - CHECK_ATTRIBUTE (stretch); - CHECK_ATTRIBUTE (strikethrough); - CHECK_ATTRIBUTE (strikethrough_color); - CHECK_ATTRIBUTE (style); + CHECK_ATTRIBUTE (size); + CHECK_ATTRIBUTE (stretch); + CHECK_ATTRIBUTE (strikethrough); + CHECK_ATTRIBUTE (strikethrough_color); + CHECK_ATTRIBUTE (style); break; case 'g': - CHECK_ATTRIBUTE (gravity); - CHECK_ATTRIBUTE (gravity_hint); + CHECK_ATTRIBUTE (gravity); + CHECK_ATTRIBUTE (gravity_hint); break; case 'l': - CHECK_ATTRIBUTE (lang); - CHECK_ATTRIBUTE (letter_spacing); + CHECK_ATTRIBUTE (lang); + CHECK_ATTRIBUTE (letter_spacing); break; case 'u': - CHECK_ATTRIBUTE (underline); - CHECK_ATTRIBUTE (underline_color); + CHECK_ATTRIBUTE (underline); + CHECK_ATTRIBUTE (underline_color); break; default: - CHECK_ATTRIBUTE (background); - CHECK_ATTRIBUTE2(foreground, "color"); - CHECK_ATTRIBUTE (rise); - CHECK_ATTRIBUTE (variant); - CHECK_ATTRIBUTE (weight); + CHECK_ATTRIBUTE (background); + CHECK_ATTRIBUTE2(foreground, "color"); + CHECK_ATTRIBUTE (rise); + CHECK_ATTRIBUTE (variant); + CHECK_ATTRIBUTE (weight); break; } if (!found) - { - g_set_error (error, G_MARKUP_ERROR, - G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, - _("Attribute '%s' is not allowed on the tag " - "on line %d char %d"), - names[i], line_number, char_number); - return FALSE; - } + { + g_set_error (error, G_MARKUP_ERROR, + G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, + _("Attribute '%s' is not allowed on the tag " + "on line %d char %d"), + names[i], line_number, char_number); + return FALSE; + } ++i; } @@ -1062,12 +1062,12 @@ span_parse_func (MarkupData *md, parsed = pango_font_description_from_string (desc); if (parsed) - { - add_attribute (tag, pango_attr_font_desc_new (parsed)); + { + add_attribute (tag, pango_attr_font_desc_new (parsed)); if (tag) open_tag_set_absolute_font_size (tag, pango_font_description_get_size (parsed)); - pango_font_description_free (parsed); - } + pango_font_description_free (parsed); + } } if (G_UNLIKELY (family)) @@ -1078,57 +1078,57 @@ span_parse_func (MarkupData *md, if (G_UNLIKELY (size)) { if (g_ascii_isdigit (*size)) - { - char *end = NULL; - gulong n; - - n = strtoul (size, &end, 10); - - if (*end != '\0' || n < 0 || n > 1000000) - { - g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_INVALID_CONTENT, - _("Value of 'size' attribute on tag on line %d" - "could not be parsed; should be an integer, or a " - "string such as 'small', not '%s'"), - line_number, size); - goto error; - } - - add_attribute (tag, pango_attr_size_new (n)); + { + char *end = NULL; + gulong n; + + n = strtoul (size, &end, 10); + + if (*end != '\0' || n < 0 || n > 1000000) + { + g_set_error (error, + G_MARKUP_ERROR, + G_MARKUP_ERROR_INVALID_CONTENT, + _("Value of 'size' attribute on tag on line %d" + "could not be parsed; should be an integer, or a " + "string such as 'small', not '%s'"), + line_number, size); + goto error; + } + + add_attribute (tag, pango_attr_size_new (n)); if (tag) open_tag_set_absolute_font_size (tag, n); - } + } else if (strcmp (size, "smaller") == 0) - { + { if (tag) { tag->scale_level_delta -= 1; tag->scale_level -= 1; } - } + } else if (strcmp (size, "larger") == 0) - { + { if (tag) { tag->scale_level_delta += 1; tag->scale_level += 1; } - } + } else if (parse_absolute_size (tag, size)) - ; /* nothing */ + ; /* nothing */ else - { - g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_INVALID_CONTENT, - _("Value of 'size' attribute on tag on line %d" - "could not be parsed; should be an integer, or a " - "string such as 'small', not '%s'"), - line_number, size); - goto error; - } + { + g_set_error (error, + G_MARKUP_ERROR, + G_MARKUP_ERROR_INVALID_CONTENT, + _("Value of 'size' attribute on tag on line %d" + "could not be parsed; should be an integer, or a " + "string such as 'small', not '%s'"), + line_number, size); + goto error; + } } if (G_UNLIKELY (style)) @@ -1136,18 +1136,18 @@ span_parse_func (MarkupData *md, PangoStyle pango_style; if (pango_parse_style (style, &pango_style, FALSE)) - add_attribute (tag, pango_attr_style_new (pango_style)); + add_attribute (tag, pango_attr_style_new (pango_style)); else - { - g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_INVALID_CONTENT, - _("'%s' is not a valid value for the 'style' attribute " - "on tag, line %d; valid values are " - "'normal', 'oblique', 'italic'"), - style, line_number); - goto error; - } + { + g_set_error (error, + G_MARKUP_ERROR, + G_MARKUP_ERROR_INVALID_CONTENT, + _("'%s' is not a valid value for the 'style' attribute " + "on tag, line %d; valid values are " + "'normal', 'oblique', 'italic'"), + style, line_number); + goto error; + } } if (G_UNLIKELY (weight)) @@ -1155,19 +1155,19 @@ span_parse_func (MarkupData *md, PangoWeight pango_weight; if (pango_parse_weight (weight, &pango_weight, FALSE)) - add_attribute (tag, - pango_attr_weight_new (pango_weight)); + add_attribute (tag, + pango_attr_weight_new (pango_weight)); else - { - g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_INVALID_CONTENT, - _("'%s' is not a valid value for the 'weight' " - "attribute on tag, line %d; valid " - "values are for example 'light', 'ultrabold' or a number"), - weight, line_number); - goto error; - } + { + g_set_error (error, + G_MARKUP_ERROR, + G_MARKUP_ERROR_INVALID_CONTENT, + _("'%s' is not a valid value for the 'weight' " + "attribute on tag, line %d; valid " + "values are for example 'light', 'ultrabold' or a number"), + weight, line_number); + goto error; + } } if (G_UNLIKELY (variant)) @@ -1175,18 +1175,18 @@ span_parse_func (MarkupData *md, PangoVariant pango_variant; if (pango_parse_variant (variant, &pango_variant, FALSE)) - add_attribute (tag, pango_attr_variant_new (pango_variant)); + add_attribute (tag, pango_attr_variant_new (pango_variant)); else - { - g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_INVALID_CONTENT, - _("'%s' is not a valid value for the 'variant' " - "attribute on tag, line %d; valid values are " - "'normal', 'smallcaps'"), - variant, line_number); - goto error; - } + { + g_set_error (error, + G_MARKUP_ERROR, + G_MARKUP_ERROR_INVALID_CONTENT, + _("'%s' is not a valid value for the 'variant' " + "attribute on tag, line %d; valid values are " + "'normal', 'smallcaps'"), + variant, line_number); + goto error; + } } if (G_UNLIKELY (stretch)) @@ -1194,19 +1194,19 @@ span_parse_func (MarkupData *md, PangoStretch pango_stretch; if (pango_parse_stretch (stretch, &pango_stretch, FALSE)) - add_attribute (tag, pango_attr_stretch_new (pango_stretch)); + add_attribute (tag, pango_attr_stretch_new (pango_stretch)); else - { - g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_INVALID_CONTENT, - _("'%s' is not a valid value for the 'stretch' " - "attribute on tag, line %d; valid " - "values are for example 'condensed', " - "'ultraexpanded', 'normal'"), - stretch, line_number); - goto error; - } + { + g_set_error (error, + G_MARKUP_ERROR, + G_MARKUP_ERROR_INVALID_CONTENT, + _("'%s' is not a valid value for the 'stretch' " + "attribute on tag, line %d; valid " + "values are for example 'condensed', " + "'ultraexpanded', 'normal'"), + stretch, line_number); + goto error; + } } if (G_UNLIKELY (foreground)) @@ -1214,7 +1214,7 @@ span_parse_func (MarkupData *md, PangoColor color; if (!span_parse_color ("foreground", foreground, &color, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_foreground_new (color.red, color.green, color.blue)); } @@ -1224,7 +1224,7 @@ span_parse_func (MarkupData *md, PangoColor color; if (!span_parse_color ("background", background, &color, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_background_new (color.red, color.green, color.blue)); } @@ -1234,7 +1234,7 @@ span_parse_func (MarkupData *md, PangoUnderline ul = PANGO_UNDERLINE_NONE; if (!span_parse_enum ("underline", underline, PANGO_TYPE_UNDERLINE, &ul, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_underline_new (ul)); } @@ -1244,7 +1244,7 @@ span_parse_func (MarkupData *md, PangoColor color; if (!span_parse_color ("underline_color", underline_color, &color, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_underline_color_new (color.red, color.green, color.blue)); } @@ -1254,7 +1254,7 @@ span_parse_func (MarkupData *md, PangoGravity gr = PANGO_GRAVITY_SOUTH; if (!span_parse_enum ("gravity", gravity, PANGO_TYPE_GRAVITY, &gr, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_gravity_new (gr)); } @@ -1264,7 +1264,7 @@ span_parse_func (MarkupData *md, PangoGravityHint hint = PANGO_GRAVITY_HINT_NATURAL; if (!span_parse_enum ("gravity_hint", gravity_hint, PANGO_TYPE_GRAVITY_HINT, &hint, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_gravity_hint_new (hint)); } @@ -1274,7 +1274,7 @@ span_parse_func (MarkupData *md, gboolean b = FALSE; if (!span_parse_boolean ("strikethrough", strikethrough, &b, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_strikethrough_new (b)); } @@ -1284,7 +1284,7 @@ span_parse_func (MarkupData *md, PangoColor color; if (!span_parse_color ("strikethrough_color", strikethrough_color, &color, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_strikethrough_color_new (color.red, color.green, color.blue)); } @@ -1294,7 +1294,7 @@ span_parse_func (MarkupData *md, gboolean b = FALSE; if (!span_parse_boolean ("fallback", fallback, &b, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_fallback_new (b)); } @@ -1304,7 +1304,7 @@ span_parse_func (MarkupData *md, gint n = 0; if (!span_parse_int ("rise", rise, &n, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_rise_new (n)); } @@ -1314,7 +1314,7 @@ span_parse_func (MarkupData *md, gint n = 0; if (!span_parse_int ("letter_spacing", letter_spacing, &n, line_number, error)) - goto error; + goto error; add_attribute (tag, pango_attr_letter_spacing_new (n)); } @@ -1334,11 +1334,11 @@ span_parse_func (MarkupData *md, static gboolean i_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("i"); add_attribute (tag, pango_attr_style_new (PANGO_STYLE_ITALIC)); @@ -1348,11 +1348,11 @@ i_parse_func (MarkupData *md, static gboolean markup_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { /* We don't do anything with this tag at the moment. */ @@ -1361,11 +1361,11 @@ markup_parse_func (MarkupData *md, static gboolean s_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("s"); add_attribute (tag, pango_attr_strikethrough_new (TRUE)); @@ -1377,11 +1377,11 @@ s_parse_func (MarkupData *md, static gboolean sub_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("sub"); @@ -1399,11 +1399,11 @@ sub_parse_func (MarkupData *md, static gboolean sup_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("sup"); @@ -1421,11 +1421,11 @@ sup_parse_func (MarkupData *md, static gboolean small_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("small"); @@ -1441,11 +1441,11 @@ small_parse_func (MarkupData *md, static gboolean tt_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("tt"); @@ -1456,11 +1456,11 @@ tt_parse_func (MarkupData *md, static gboolean u_parse_func (MarkupData *md, - OpenTag *tag, - const gchar **names, - const gchar **values, - GMarkupParseContext *context, - GError **error) + OpenTag *tag, + const gchar **names, + const gchar **values, + GMarkupParseContext *context, + GError **error) { CHECK_NO_ATTRS("u"); add_attribute (tag, pango_attr_underline_new (PANGO_UNDERLINE_SINGLE)); diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c index b2f4dac..5f3ff33 100644 --- a/pango/pango-ot-info.c +++ b/pango/pango-ot-info.c @@ -46,21 +46,21 @@ pango_ot_info_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoOTInfoClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc)pango_ot_info_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoOTInfo), - 0, /* n_preallocs */ + sizeof (PangoOTInfoClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc)pango_ot_info_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoOTInfo), + 0, /* n_preallocs */ NULL, /* init */ NULL, /* value_table */ }; object_type = g_type_register_static (G_TYPE_OBJECT, - I_("PangoOTInfo"), - &object_info, 0); + I_("PangoOTInfo"), + &object_info, 0); } return object_type; diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c index 666dfcf..a54c87e 100644 --- a/pango/pango-ot-ruleset.c +++ b/pango/pango-ot-ruleset.c @@ -48,21 +48,21 @@ pango_ot_ruleset_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoOTRulesetClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc)pango_ot_ruleset_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoOTRuleset), - 0, /* n_preallocs */ - (GInstanceInitFunc)pango_ot_ruleset_init, + sizeof (PangoOTRulesetClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc)pango_ot_ruleset_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoOTRuleset), + 0, /* n_preallocs */ + (GInstanceInitFunc)pango_ot_ruleset_init, NULL /* value_table */ }; object_type = g_type_register_static (G_TYPE_OBJECT, - I_("PangoOTRuleset"), - &object_info, 0); + I_("PangoOTRuleset"), + &object_info, 0); } return object_type; @@ -220,14 +220,14 @@ pango_ot_ruleset_position (PangoOTRuleset *ruleset, continue; if (!gpos) - { + { gpos = pango_ot_info_get_gpos (ruleset->info); if (gpos) HB_GPOS_Clear_Features (gpos); else return; - } + } HB_GPOS_Add_Feature (gpos, rule->feature_index, rule->property_bit); } diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c index 702af77..daa877f 100644 --- a/pango/pango-renderer.c +++ b/pango/pango-renderer.c @@ -393,10 +393,10 @@ get_item_properties (PangoItem *item, *shape_attr = (PangoAttrShape *)attr; break; - case PANGO_ATTR_RISE: - if (rise) - *rise = ((PangoAttrInt *)attr)->value; - break; + case PANGO_ATTR_RISE: + if (rise) + *rise = ((PangoAttrInt *)attr)->value; + break; default: break; @@ -482,7 +482,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, PangoRectangle logical_rect, *logical = NULL; if (run->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE) - logical = &logical_rect; + logical = &logical_rect; pango_renderer_prepare_run (renderer, run); @@ -516,7 +516,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, state.logical_rect_end = x + x_off + glyph_string_width; if (run->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE) - rise += logical_rect.y + logical_rect.height / 2; + rise += logical_rect.y + logical_rect.height / 2; if (renderer->priv->color_set[PANGO_RENDER_PART_BACKGROUND]) diff --git a/pango/pango-script.c b/pango/pango-script.c index 88b2ef6..1ee6305 100644 --- a/pango/pango-script.c +++ b/pango/pango-script.c @@ -364,7 +364,7 @@ pango_script_iter_next (PangoScriptIter *iter) if (iter->paren_sp < start_sp) start_sp = iter->paren_sp; - } + } } else { diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c index f582b23..fbb9037 100644 --- a/pango/pango-tabs.c +++ b/pango/pango-tabs.c @@ -29,11 +29,11 @@ typedef struct _PangoTab PangoTab; struct _PangoTab { gint location; /* Offset in pixels of this tab stop - * from the left margin of the text. - */ + * from the left margin of the text. + */ PangoTabAlign alignment; /* Where the tab stop appears relative - * to the text. - */ + * to the text. + */ }; struct _PangoTabArray @@ -69,7 +69,7 @@ init_tabs (PangoTabArray *array, gint start, gint end) **/ PangoTabArray* pango_tab_array_new (gint initial_size, - gboolean positions_in_pixels) + gboolean positions_in_pixels) { PangoTabArray *array; @@ -115,10 +115,10 @@ pango_tab_array_new (gint initial_size, **/ PangoTabArray * pango_tab_array_new_with_positions (gint size, - gboolean positions_in_pixels, - PangoTabAlign first_alignment, - gint first_position, - ...) + gboolean positions_in_pixels, + PangoTabAlign first_alignment, + gint first_position, + ...) { PangoTabArray *array; va_list args; @@ -163,8 +163,8 @@ pango_tab_array_get_type (void) if (our_type == 0) our_type = g_boxed_type_register_static (I_("PangoTabArray"), - (GBoxedCopyFunc)pango_tab_array_copy, - (GBoxedFreeFunc)pango_tab_array_free); + (GBoxedCopyFunc)pango_tab_array_copy, + (GBoxedFreeFunc)pango_tab_array_free); return our_type; } @@ -235,7 +235,7 @@ pango_tab_array_get_size (PangoTabArray *tab_array) **/ void pango_tab_array_resize (PangoTabArray *tab_array, - gint new_size) + gint new_size) { if (new_size > tab_array->allocated) { @@ -243,10 +243,10 @@ pango_tab_array_resize (PangoTabArray *tab_array, /* Ratchet allocated size up above the index. */ if (tab_array->allocated == 0) - tab_array->allocated = 2; + tab_array->allocated = 2; while (new_size > tab_array->allocated) - tab_array->allocated = tab_array->allocated * 2; + tab_array->allocated = tab_array->allocated * 2; tab_array->tabs = g_renew (PangoTab, tab_array->tabs, tab_array->allocated); @@ -271,9 +271,9 @@ pango_tab_array_resize (PangoTabArray *tab_array, **/ void pango_tab_array_set_tab (PangoTabArray *tab_array, - gint tab_index, - PangoTabAlign alignment, - gint location) + gint tab_index, + PangoTabAlign alignment, + gint location) { g_return_if_fail (tab_array != NULL); g_return_if_fail (tab_index >= 0); @@ -299,9 +299,9 @@ pango_tab_array_set_tab (PangoTabArray *tab_array, **/ void pango_tab_array_get_tab (PangoTabArray *tab_array, - gint tab_index, - PangoTabAlign *alignment, - gint *location) + gint tab_index, + PangoTabAlign *alignment, + gint *location) { g_return_if_fail (tab_array != NULL); g_return_if_fail (tab_index < tab_array->size); @@ -327,8 +327,8 @@ pango_tab_array_get_tab (PangoTabArray *tab_array, **/ void pango_tab_array_get_tabs (PangoTabArray *tab_array, - PangoTabAlign **alignments, - gint **locations) + PangoTabAlign **alignments, + gint **locations) { gint i; @@ -344,9 +344,9 @@ pango_tab_array_get_tabs (PangoTabArray *tab_array, while (i < tab_array->size) { if (alignments) - (*alignments)[i] = tab_array->tabs[i].alignment; + (*alignments)[i] = tab_array->tabs[i].alignment; if (locations) - (*locations)[i] = tab_array->tabs[i].location; + (*locations)[i] = tab_array->tabs[i].location; ++i; } diff --git a/pango/pango-tabs.h b/pango/pango-tabs.h index f60949e..160fff7 100644 --- a/pango/pango-tabs.h +++ b/pango/pango-tabs.h @@ -44,29 +44,29 @@ typedef enum #define PANGO_TYPE_TAB_ARRAY (pango_tab_array_get_type ()) PangoTabArray *pango_tab_array_new (gint initial_size, - gboolean positions_in_pixels); + gboolean positions_in_pixels); PangoTabArray *pango_tab_array_new_with_positions (gint size, - gboolean positions_in_pixels, - PangoTabAlign first_alignment, - gint first_position, - ...); + gboolean positions_in_pixels, + PangoTabAlign first_alignment, + gint first_position, + ...); GType pango_tab_array_get_type (void); PangoTabArray *pango_tab_array_copy (PangoTabArray *src); void pango_tab_array_free (PangoTabArray *tab_array); gint pango_tab_array_get_size (PangoTabArray *tab_array); void pango_tab_array_resize (PangoTabArray *tab_array, - gint new_size); + gint new_size); void pango_tab_array_set_tab (PangoTabArray *tab_array, - gint tab_index, - PangoTabAlign alignment, - gint location); + gint tab_index, + PangoTabAlign alignment, + gint location); void pango_tab_array_get_tab (PangoTabArray *tab_array, - gint tab_index, - PangoTabAlign *alignment, - gint *location); + gint tab_index, + PangoTabAlign *alignment, + gint *location); void pango_tab_array_get_tabs (PangoTabArray *tab_array, - PangoTabAlign **alignments, - gint **locations); + PangoTabAlign **alignments, + gint **locations); gboolean pango_tab_array_get_positions_in_pixels (PangoTabArray *tab_array); diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 0244475..46c18e5 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -133,8 +133,8 @@ pango_version_string (void) **/ const gchar* pango_version_check (int required_major, - int required_minor, - int required_micro) + int required_minor, + int required_micro) { gint pango_effective_micro = 100 * PANGO_VERSION_MINOR + PANGO_VERSION_MICRO; gint required_effective_micro = 100 * required_minor + required_micro; @@ -763,13 +763,13 @@ pango_parse_enum (GType type, if (v) { if (G_LIKELY (value)) - *value = v->value; + *value = v->value; } else { ret = FALSE; if (warn || possible_values) - { + { int i; GString *s = g_string_new (NULL); @@ -777,7 +777,7 @@ pango_parse_enum (GType type, i++ , v = g_enum_get_value (class, i)) { if (i) - g_string_append_c (s, '/'); + g_string_append_c (s, '/'); g_string_append (s, v->value_nick); } @@ -1149,8 +1149,8 @@ pango_language_get_type (void) if (our_type == 0) our_type = g_boxed_type_register_static (I_("PangoLanguage"), - (GBoxedCopyFunc)pango_language_copy, - (GBoxedFreeFunc)pango_language_free); + (GBoxedCopyFunc)pango_language_copy, + (GBoxedFreeFunc)pango_language_free); return our_type; } diff --git a/pango/pango-utils.h b/pango/pango-utils.h index 7756f09..f44f2b5 100644 --- a/pango/pango-utils.h +++ b/pango/pango-utils.h @@ -135,8 +135,8 @@ G_CONST_RETURN char * pango_version_string (void); /* Check that run-time Pango is as new as required */ G_CONST_RETURN char * pango_version_check (int required_major, - int required_minor, - int required_micro); + int required_minor, + int required_micro); G_END_DECLS diff --git a/pango/pangoatsui-fontmap.c b/pango/pangoatsui-fontmap.c index c9bbfe6..0ba5cae 100644 --- a/pango/pangoatsui-fontmap.c +++ b/pango/pangoatsui-fontmap.c @@ -202,20 +202,20 @@ pango_atsui_family_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontFamilyClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_atsui_family_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoATSUIFamily), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_atsui_family_init, + sizeof (PangoFontFamilyClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_atsui_family_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoATSUIFamily), + 0, /* n_preallocs */ + (GInstanceInitFunc) pango_atsui_family_init, }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - I_("PangoATSUIFamily"), - &object_info, 0); + I_("PangoATSUIFamily"), + &object_info, 0); } return object_type; @@ -280,8 +280,8 @@ pango_atsui_face_get_face_name (PangoFontFace *face) static void pango_atsui_face_list_sizes (PangoFontFace *face, - int **sizes, - int *n_sizes) + int **sizes, + int *n_sizes) { *n_sizes = 0; *sizes = NULL; @@ -321,20 +321,20 @@ pango_atsui_face_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontFaceClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_atsui_face_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoATSUIFace), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, + sizeof (PangoFontFaceClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_atsui_face_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoATSUIFace), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - I_("PangoATSUIFace"), - &object_info, 0); + I_("PangoATSUIFace"), + &object_info, 0); } return object_type; @@ -579,7 +579,7 @@ pango_atsui_font_map_load_font (PangoFontMap *fontmap, } if (best_desc == NULL || best_face == NULL) - return NULL; + return NULL; pango_font_description_set_size (best_desc, size); diff --git a/pango/pangocairo-atsuifont.c b/pango/pangocairo-atsuifont.c index ccce9be..72130e4 100644 --- a/pango/pangocairo-atsuifont.c +++ b/pango/pangocairo-atsuifont.c @@ -165,7 +165,7 @@ pango_cairo_atsui_font_get_glyph_extents (PangoFont *font, ink_rect->x = ink_rect->y = ink_rect->width = ink_rect->height = 0; } if (logical_rect) - { + { logical_rect->x = 0; logical_rect->y = - font_extents.ascent * PANGO_SCALE; logical_rect->width = 0; diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c index 6fb61fc..65b9e03 100644 --- a/pango/pangocairo-fcfont.c +++ b/pango/pangocairo-fcfont.c @@ -100,7 +100,7 @@ pango_cairo_fc_font_get_font_face (PangoCairoFont *font) * This means out of memory or a cairo/fontconfig/FreeType bug, */ if (!cffont->font_face) - return NULL; + return NULL; } return cffont->font_face; @@ -118,7 +118,7 @@ pango_cairo_fc_font_get_scaled_font (PangoCairoFont *font) font_face = pango_cairo_fc_font_get_font_face (font); if (!font_face) - return NULL; + return NULL; cffont->scaled_font = cairo_scaled_font_create (font_face, &cffont->font_matrix, @@ -130,7 +130,7 @@ pango_cairo_fc_font_get_scaled_font (PangoCairoFont *font) * or a missing font... */ if (!cffont->scaled_font) - return NULL; + return NULL; } return cffont->scaled_font; @@ -249,7 +249,7 @@ pango_cairo_fc_font_get_metrics (PangoFont *font, } shift = (height - info->metrics->ascent) - info->metrics->descent; if (fcfont->is_hinted) - shift &= ~(PANGO_SCALE - 1); + shift &= ~(PANGO_SCALE - 1); info->metrics->descent += shift; info->metrics->underline_position -= shift; info->metrics->strikethrough_position -= shift; @@ -300,14 +300,14 @@ pango_cairo_fc_font_glyph_extents_cache_init (PangoCairoFcFont *cffont) default: case PANGO_GRAVITY_AUTO: case PANGO_GRAVITY_SOUTH: - cffont->font_extents.y = - pango_units_from_double (font_extents.ascent); + cffont->font_extents.y = - pango_units_from_double (font_extents.ascent); break; case PANGO_GRAVITY_NORTH: - cffont->font_extents.y = - pango_units_from_double (font_extents.descent); + cffont->font_extents.y = - pango_units_from_double (font_extents.descent); break; case PANGO_GRAVITY_EAST: case PANGO_GRAVITY_WEST: - cffont->font_extents.y = - pango_units_from_double ((font_extents.ascent + font_extents.descent) * 0.5); + cffont->font_extents.y = - pango_units_from_double ((font_extents.ascent + font_extents.descent) * 0.5); } cffont->glyph_extents_cache = g_new0 (GlyphExtentsCacheEntry, GLYPH_CACHE_NUM_ENTRIES); diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index 87dccd3..68130e2 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -75,7 +75,7 @@ _pango_cairo_font_install (PangoCairoFont *font, if (G_UNLIKELY (!PANGO_IS_CAIRO_FONT (font))) { if (!_pango_cairo_warning_history.font_install) - { + { _pango_cairo_warning_history.font_install = TRUE; g_warning ("_pango_cairo_font_install called with bad font, expect ugly output"); cairo_set_font_face (cr, NULL); @@ -101,7 +101,7 @@ _pango_cairo_font_get_scaled_font (PangoCairoFont *font) if (G_UNLIKELY (!PANGO_IS_CAIRO_FONT (font))) { if (!_pango_cairo_warning_history.font_get_scaled_font) - { + { _pango_cairo_warning_history.font_get_scaled_font = TRUE; g_warning ("_pango_cairo_font_get_scaled_font called with bad font, expect ugly output"); } @@ -301,9 +301,9 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont) void _pango_cairo_get_glyph_extents_missing (PangoCairoFont *cfont, - PangoGlyph glyph, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect) + PangoGlyph glyph, + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { PangoCairoHexBoxInfo *hbi; gint rows, cols; diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c index 595ff0c..9ec2e68 100644 --- a/pango/pangocairo-render.c +++ b/pango/pangocairo-render.c @@ -235,22 +235,22 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer, PangoGlyphInfo *gi = &glyphs->glyphs[i]; if (gi->glyph != PANGO_GLYPH_EMPTY) - { - double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE; - double cy = gi->geometry.y_offset == 0 ? + { + double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE; + double cy = gi->geometry.y_offset == 0 ? base_y : base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE; - if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG) + if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG) _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy); - else - { - cairo_glyphs[count].index = gi->glyph; - cairo_glyphs[count].x = cx; - cairo_glyphs[count].y = cy; - count++; - } - } + else + { + cairo_glyphs[count].index = gi->glyph; + cairo_glyphs[count].x = cx; + cairo_glyphs[count].y = cy; + count++; + } + } x_position += gi->geometry.width; } @@ -433,7 +433,7 @@ acquire_renderer (gboolean *free_renderer) if (G_LIKELY (G_TRYLOCK (cached_renderer))) { if (G_UNLIKELY (!cached_renderer)) - cached_renderer = g_object_new (PANGO_TYPE_CAIRO_RENDERER, NULL); + cached_renderer = g_object_new (PANGO_TYPE_CAIRO_RENDERER, NULL); renderer = cached_renderer; *free_renderer = FALSE; @@ -651,10 +651,10 @@ pango_cairo_show_layout (cairo_t *cr, **/ void pango_cairo_show_error_underline (cairo_t *cr, - double x, - double y, - double width, - double height) + double x, + double y, + double width, + double height) { g_return_if_fail (cr != NULL); g_return_if_fail ((width >= 0) && (height >= 0)); @@ -745,10 +745,10 @@ pango_cairo_layout_path (cairo_t *cr, **/ void pango_cairo_error_underline_path (cairo_t *cr, - double x, - double y, - double width, - double height) + double x, + double y, + double width, + double height) { g_return_if_fail (cr != NULL); g_return_if_fail ((width >= 0) && (height >= 0)); diff --git a/pango/pangocairo-win32font.c b/pango/pangocairo-win32font.c index 297012d..edfce05 100644 --- a/pango/pangocairo-win32font.c +++ b/pango/pangocairo-win32font.c @@ -288,14 +288,14 @@ max_glyph_width (PangoLayout *layout) PangoLayoutLine *line = l->data; for (r = line->runs; r; r = r->next) - { - PangoGlyphString *glyphs = ((PangoGlyphItem *)r->data)->glyphs; - int i; - - for (i = 0; i < glyphs->num_glyphs; i++) - if (glyphs->glyphs[i].geometry.width > max_width) - max_width = glyphs->glyphs[i].geometry.width; - } + { + PangoGlyphString *glyphs = ((PangoGlyphItem *)r->data)->glyphs; + int i; + + for (i = 0; i < glyphs->num_glyphs; i++) + if (glyphs->glyphs[i].geometry.width > max_width) + max_width = glyphs->glyphs[i].geometry.width; + } } return max_width; diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index d552c48..175c104 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -419,14 +419,14 @@ max_glyph_width (PangoLayout *layout) PangoLayoutLine *line = l->data; for (r = line->runs; r; r = r->next) - { - PangoGlyphString *glyphs = ((PangoGlyphItem *)r->data)->glyphs; - int i; - - for (i = 0; i < glyphs->num_glyphs; i++) - if (glyphs->glyphs[i].geometry.width > max_width) - max_width = glyphs->glyphs[i].geometry.width; - } + { + PangoGlyphString *glyphs = ((PangoGlyphItem *)r->data)->glyphs; + int i; + + for (i = 0; i < glyphs->num_glyphs; i++) + if (glyphs->glyphs[i].geometry.width > max_width) + max_width = glyphs->glyphs[i].geometry.width; + } } return max_width; @@ -470,7 +470,7 @@ pango_fc_font_create_metrics_for_context (PangoFcFont *fcfont, */ static PangoFontMetrics * pango_fc_font_get_metrics (PangoFont *font, - PangoLanguage *language) + PangoLanguage *language) { PangoFcFont *fcfont = PANGO_FC_FONT (font); PangoFcMetricsInfo *info = NULL; /* Quiet gcc */ @@ -529,7 +529,7 @@ pango_fc_font_real_has_char (PangoFcFont *font, FcCharSet *charset; if (FcPatternGetCharSet (font->font_pattern, - FC_CHARSET, 0, &charset) != FcResultMatch) + FC_CHARSET, 0, &charset) != FcResultMatch) return FALSE; return FcCharSetHasChar (charset, wc); @@ -562,7 +562,7 @@ pango_fc_font_real_get_glyph (PangoFcFont *font, face = PANGO_FC_FONT_LOCK_FACE (font); index = FcFreeTypeCharIndex (face, wc); if (index > (FT_UInt)face->num_glyphs) - index = 0; + index = 0; entry->ch = wc; entry->glyph = index; diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index f1f3a56..de73ecf 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -177,7 +177,7 @@ pango_fc_font_map_init (PangoFcFontMap *fcfontmap) registered_modules = TRUE; for (i = 0; _pango_included_fc_modules[i].list; i++) - pango_module_register (&_pango_included_fc_modules[i]); + pango_module_register (&_pango_included_fc_modules[i]); } priv->n_families = -1; @@ -614,7 +614,7 @@ _pango_fc_font_map_remove (PangoFcFontMap *fcfontmap, static PangoFcFamily * create_family (PangoFcFontMap *fcfontmap, const char *family_name, - int spacing) + int spacing) { PangoFcFamily *family = g_object_new (PANGO_FC_TYPE_FAMILY, NULL); family->fontmap = fcfontmap; @@ -683,22 +683,22 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap, { FcChar8 *s; FcResult res; - int spacing; + int spacing; res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **) &s); g_assert (res == FcResultMatch); - res = FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &spacing); - g_assert (res == FcResultMatch || res == FcResultNoMatch); - if (res == FcResultNoMatch) - spacing = FC_PROPORTIONAL; + res = FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &spacing); + g_assert (res == FcResultMatch || res == FcResultNoMatch); + if (res == FcResultNoMatch) + spacing = FC_PROPORTIONAL; if (!is_alias_family (s) && !g_hash_table_lookup (temp_family_hash, s)) - { - PangoFcFamily *temp_family = create_family (fcfontmap, (gchar *)s, spacing); - g_hash_table_insert (temp_family_hash, g_strdup (s), s); - priv->families[count++] = temp_family; - } + { + PangoFcFamily *temp_family = create_family (fcfontmap, (gchar *)s, spacing); + g_hash_table_insert (temp_family_hash, g_strdup (s), s); + priv->families[count++] = temp_family; + } } FcFontSetDestroy (fontset); @@ -1723,7 +1723,7 @@ pango_fc_face_get_face_name (PangoFontFace *face) static int compare_ints (gconstpointer ap, - gconstpointer bp) + gconstpointer bp) { int a = *(int *)ap; int b = *(int *)bp; @@ -1738,8 +1738,8 @@ compare_ints (gconstpointer ap, static void pango_fc_face_list_sizes (PangoFontFace *face, - int **sizes, - int *n_sizes) + int **sizes, + int *n_sizes) { PangoFcFace *fcface = PANGO_FC_FACE (face); FcPattern *pattern; @@ -1764,37 +1764,37 @@ pango_fc_face_list_sizes (PangoFontFace *face, size_array = g_array_new (FALSE, FALSE, sizeof (int)); for (i = 0; i < fontset->nfont; i++) - { - if (FcPatternGetDouble (fontset->fonts[i], FC_PIXEL_SIZE, 0, &size) == FcResultMatch) - { - if (dpi < 0) + { + if (FcPatternGetDouble (fontset->fonts[i], FC_PIXEL_SIZE, 0, &size) == FcResultMatch) + { + if (dpi < 0) dpi = pango_fc_font_map_get_resolution (fcface->family->fontmap, NULL); - size_i = (int) (PANGO_SCALE * size * 72.0 / dpi); - g_array_append_val (size_array, size_i); - } - } + size_i = (int) (PANGO_SCALE * size * 72.0 / dpi); + g_array_append_val (size_array, size_i); + } + } g_array_sort (size_array, compare_ints); if (size_array->len == 0) - { - *n_sizes = 0; - if (sizes) - *sizes = NULL; - g_array_free (size_array, TRUE); - } + { + *n_sizes = 0; + if (sizes) + *sizes = NULL; + g_array_free (size_array, TRUE); + } else - { - *n_sizes = size_array->len; - if (sizes) - { - *sizes = (int *) size_array->data; - g_array_free (size_array, FALSE); - } - else - g_array_free (size_array, TRUE); - } + { + *n_sizes = size_array->len; + if (sizes) + { + *sizes = (int *) size_array->data; + g_array_free (size_array, FALSE); + } + else + g_array_free (size_array, TRUE); + } FcFontSetDestroy (fontset); } @@ -1802,7 +1802,7 @@ pango_fc_face_list_sizes (PangoFontFace *face, { *n_sizes = 0; if (sizes) - *sizes = NULL; + *sizes = NULL; } FcPatternDestroy (pattern); @@ -1816,9 +1816,9 @@ pango_fc_family_is_monospace (PangoFontFamily *family) return fcfamily->spacing == FC_MONO || #ifdef FC_DUAL - fcfamily->spacing == FC_DUAL || + fcfamily->spacing == FC_DUAL || #endif - fcfamily->spacing == FC_CHARCELL; + fcfamily->spacing == FC_CHARCELL; } static void @@ -1838,21 +1838,21 @@ pango_fc_face_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontFaceClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_fc_face_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFcFace), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, + sizeof (PangoFontFaceClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_fc_face_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoFcFace), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - I_("PangoFcFace"), - &object_info, 0); + I_("PangoFcFace"), + &object_info, 0); } return object_type; @@ -1937,11 +1937,11 @@ pango_fc_family_list_faces (PangoFontFamily *family, slant = FC_SLANT_ROMAN; if (FcPatternGetString (fontset->fonts[i], FC_STYLE, 0, &font_style) != FcResultMatch) - font_style = NULL; + font_style = NULL; if (weight <= FC_WEIGHT_MEDIUM) { - if (slant == FC_SLANT_ROMAN) + if (slant == FC_SLANT_ROMAN) { has_face[REGULAR] = TRUE; style = "Regular"; @@ -1954,7 +1954,7 @@ pango_fc_family_list_faces (PangoFontFamily *family, } else { - if (slant == FC_SLANT_ROMAN) + if (slant == FC_SLANT_ROMAN) { has_face[BOLD] = TRUE; style = "Bold"; @@ -1967,7 +1967,7 @@ pango_fc_family_list_faces (PangoFontFamily *family, } if (!font_style) - font_style = style; + font_style = style; faces[num++] = create_face (fcfamily, font_style, FALSE); } @@ -2029,21 +2029,21 @@ pango_fc_family_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontFamilyClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_fc_family_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoFcFamily), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_fc_family_init, + sizeof (PangoFontFamilyClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_fc_family_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoFcFamily), + 0, /* n_preallocs */ + (GInstanceInitFunc) pango_fc_family_init, NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - I_("PangoFcFamily"), - &object_info, 0); + I_("PangoFcFamily"), + &object_info, 0); } return object_type; diff --git a/pango/pangofc-fontmap.h b/pango/pangofc-fontmap.h index 0fa7ab5..50c5988 100644 --- a/pango/pangofc-fontmap.h +++ b/pango/pangofc-fontmap.h @@ -107,10 +107,10 @@ struct _PangoFcFontMapClass /*< public >*/ /* Deprecated in favor of context_substitute */ void (*default_substitute) (PangoFcFontMap *fontmap, - FcPattern *pattern); + FcPattern *pattern); /* Deprecated in favor of create_font */ PangoFcFont *(*new_font) (PangoFcFontMap *fontmap, - FcPattern *pattern); + FcPattern *pattern); double (*get_resolution) (PangoFcFontMap *fcfontmap, PangoContext *context); @@ -129,11 +129,11 @@ struct _PangoFcFontMapClass void (*context_substitute) (PangoFcFontMap *fontmap, PangoContext *context, - FcPattern *pattern); + FcPattern *pattern); PangoFcFont *(*create_font) (PangoFcFontMap *fontmap, PangoContext *context, const PangoFontDescription *desc, - FcPattern *pattern); + FcPattern *pattern); /*< private >*/ /* Padding for future expansion */ diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c index 0a7b172..ef052ef 100644 --- a/pango/pangoft2-render.c +++ b/pango/pangoft2-render.c @@ -233,7 +233,7 @@ pango_ft2_renderer_draw_glyph (PangoRenderer *renderer, { glyph = pango_ft2_get_unknown_glyph (font); if (glyph == PANGO_GLYPH_EMPTY) - { + { /* No unknown glyph found for the font, draw a box */ /* Since we only draw an empty box for FT2 renderer, diff --git a/pango/pangoft2.c b/pango/pangoft2.c index d6833e0..5430c32 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -178,7 +178,7 @@ pango_ft2_font_get_face (PangoFont *font) if (G_UNLIKELY (!PANGO_FT2_IS_FONT (font))) { if (!_pango_ft2_warning_history.get_face) - { + { _pango_ft2_warning_history.get_face = TRUE; g_warning ("pango_ft2_font_get_face called with bad font, expect ugly output"); } @@ -193,29 +193,29 @@ pango_ft2_font_get_face (PangoFont *font) /* disable antialiasing if requested */ if (FcPatternGetBool (pattern, - FC_ANTIALIAS, 0, &antialias) != FcResultMatch) + FC_ANTIALIAS, 0, &antialias) != FcResultMatch) antialias = FcTrue; if (antialias) - ft2font->load_flags |= FT_LOAD_NO_BITMAP; + ft2font->load_flags |= FT_LOAD_NO_BITMAP; else ft2font->load_flags |= FT_LOAD_TARGET_MONO; /* disable hinting if requested */ if (FcPatternGetBool (pattern, - FC_HINTING, 0, &hinting) != FcResultMatch) + FC_HINTING, 0, &hinting) != FcResultMatch) hinting = FcTrue; if (!hinting) - ft2font->load_flags |= FT_LOAD_NO_HINTING; + ft2font->load_flags |= FT_LOAD_NO_HINTING; /* force autohinting if requested */ if (FcPatternGetBool (pattern, - FC_AUTOHINT, 0, &autohint) != FcResultMatch) + FC_AUTOHINT, 0, &autohint) != FcResultMatch) autohint = FcFalse; if (autohint) - ft2font->load_flags |= FT_LOAD_FORCE_AUTOHINT; + ft2font->load_flags |= FT_LOAD_FORCE_AUTOHINT; if (FcPatternGetString (pattern, FC_FILE, 0, &filename) != FcResultMatch) goto bail0; @@ -320,7 +320,7 @@ pango_ft2_font_get_glyph_extents (PangoFont *font, { glyph = pango_ft2_get_unknown_glyph (font); if (glyph == PANGO_GLYPH_EMPTY) - { + { /* No unknown glyph found for the font, draw a box */ PangoFontMetrics *metrics = pango_font_get_metrics (font, NULL); @@ -530,7 +530,7 @@ _pango_ft2_ft_strerror (FT_Error error) static char *default_msg = NULL; if (!default_msg) - default_msg = g_malloc (60); + default_msg = g_malloc (60); g_sprintf (default_msg, "Unknown FreeType2 error %#x", error); return default_msg; diff --git a/pango/pangoft2.h b/pango/pangoft2.h index ffa50ca..cd285af 100644 --- a/pango/pangoft2.h +++ b/pango/pangoft2.h @@ -41,7 +41,7 @@ G_BEGIN_DECLS typedef struct _PangoFT2FontMap PangoFT2FontMap; typedef void (*PangoFT2SubstituteFunc) (FcPattern *pattern, - gpointer data); + gpointer data); /* Calls for applications */ diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index 554ee71..05a5146 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -67,8 +67,8 @@ GType pango_win32_family_get_type (void); GType pango_win32_face_get_type (void); static void pango_win32_face_list_sizes (PangoFontFace *face, - int **sizes, - int *n_sizes); + int **sizes, + int *n_sizes); static void pango_win32_font_map_finalize (GObject *object); static PangoFont *pango_win32_font_map_load_font (PangoFontMap *fontmap, @@ -178,7 +178,7 @@ pango_win32_enum_proc (LOGFONT *lfp, static gboolean first_match (gpointer key, - gpointer value, + gpointer value, gpointer user_data) { LOGFONT *lfp = (LOGFONT *)key; @@ -198,8 +198,8 @@ typedef struct _ItalicHelper static void ensure_italic (gpointer key, - gpointer value, - gpointer user_data) + gpointer value, + gpointer user_data) { ItalicHelper *helper = (ItalicHelper *)user_data; /* PangoWin32Family *win32family = (PangoWin32Family *)value; */ @@ -210,16 +210,16 @@ ensure_italic (gpointer key, GSList *list = sip->logfonts; while (list) - { + { LOGFONT *lfp = (LOGFONT *)list->data; - if (!lfp->lfItalic) - { + if (!lfp->lfItalic) + { /* we have a non italic variant, look if there is an italic */ LOGFONT logfont = *lfp; logfont.lfItalic = 1; sip = (PangoWin32SizeInfo *)g_hash_table_find (helper->fontmap->size_infos, first_match, &logfont); if (!sip) - { + { /* remember the non italic variant to be added later as italic */ helper->list = g_slist_append (helper->list, lfp); } @@ -400,20 +400,20 @@ pango_win32_family_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontFamilyClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_win32_family_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoWin32Family), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, + sizeof (PangoFontFamilyClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_win32_family_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoWin32Family), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - I_("PangoWin32Family"), - &object_info, 0); + I_("PangoWin32Family"), + &object_info, 0); } return object_type; @@ -518,7 +518,7 @@ pango_win32_font_map_load_font (PangoFontMap *fontmap, result = PANGO_WIN32_FONT_MAP_GET_CLASS (win32fontmap)->find_font (win32fontmap, context, best_match, description); - /* TODO: Handle the case that result == NULL. */ + /* TODO: Handle the case that result == NULL. */ else PING(("no best match!")); } @@ -1024,8 +1024,8 @@ pango_win32_face_class_init (PangoFontFaceClass *class) static void pango_win32_face_list_sizes (PangoFontFace *face, - int **sizes, - int *n_sizes) + int **sizes, + int *n_sizes) { /* * for scalable fonts it's simple, and currently we only have such @@ -1044,20 +1044,20 @@ pango_win32_face_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontFaceClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_win32_face_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoWin32Face), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, + sizeof (PangoFontFaceClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_win32_face_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoWin32Face), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - I_("PangoWin32Face"), - &object_info, 0); + I_("PangoWin32Face"), + &object_info, 0); } return object_type; diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 26ca290..b34182a 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -442,7 +442,7 @@ pango_win32_render_transformed (HDC hdc, xForm.eDx = matrix->x0; xForm.eDy = matrix->y0; if (!SetWorldTransform (hdc, &xForm)) - g_warning ("GetWorldTransform() failed"); + g_warning ("GetWorldTransform() failed"); } pango_win32_render (hdc, font, glyphs, x/PANGO_SCALE, y/PANGO_SCALE); @@ -538,14 +538,14 @@ max_glyph_width (PangoLayout *layout) PangoLayoutLine *line = l->data; for (r = line->runs; r; r = r->next) - { - PangoGlyphString *glyphs = ((PangoGlyphItem *)r->data)->glyphs; - int i; - - for (i = 0; i < glyphs->num_glyphs; i++) - if (glyphs->glyphs[i].geometry.width > max_width) - max_width = glyphs->glyphs[i].geometry.width; - } + { + PangoGlyphString *glyphs = ((PangoGlyphItem *)r->data)->glyphs; + int i; + + for (i = 0; i < glyphs->num_glyphs; i++) + if (glyphs->glyphs[i].geometry.width > max_width) + max_width = glyphs->glyphs[i].geometry.width; + } } return max_width; @@ -984,27 +984,27 @@ pango_win32_render_layout_line (HDC hdc, Polyline (hdc, points, 2); break; case PANGO_UNDERLINE_ERROR: - { - int point_x; - int counter = 0; + { + int point_x; + int counter = 0; int end_x = x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width); - for (point_x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1; - point_x <= end_x; - point_x += 2) - { + for (point_x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1; + point_x <= end_x; + point_x += 2) + { points[0].x = point_x; points[1].x = MAX (point_x + 1, end_x); - if (counter) - points[0].y = points[1].y = y + 2; - else - points[0].y = points[1].y = y + 3; + if (counter) + points[0].y = points[1].y = y + 2; + else + points[0].y = points[1].y = y + 3; Polyline (hdc, points, 2); - counter = (counter + 1) % 2; - } - } + counter = (counter + 1) % 2; + } + } break; case PANGO_UNDERLINE_LOW: points[0].x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1; @@ -1058,9 +1058,9 @@ pango_win32_render_layout (HDC hdc, baseline = pango_layout_iter_get_baseline (iter); pango_win32_render_layout_line (hdc, - line, - x + PANGO_PIXELS (logical_rect.x), - y + PANGO_PIXELS (baseline)); + line, + x + PANGO_PIXELS (logical_rect.x), + y + PANGO_PIXELS (baseline)); } while (pango_layout_iter_next_line (iter)); @@ -1167,7 +1167,7 @@ get_format_4_cmap (HDC hdc) struct format_4_cmap *table; /* FIXME: Could look here at the CRC for the font in the DC - and return a cached copy if the same */ + and return a cached copy if the same */ offset = get_cmap_offset (hdc, UNICODE_ENCODING_ID); if (offset == 0) diff --git a/pango/pangowin32.h b/pango/pangowin32.h index 64f0ed1..5831393 100644 --- a/pango/pangowin32.h +++ b/pango/pangowin32.h @@ -58,11 +58,11 @@ void pango_win32_render_layout (HDC hdc, int y); void pango_win32_render_transformed (HDC hdc, - const PangoMatrix *matrix, - PangoFont *font, - PangoGlyphString *glyphs, - int x, - int y); + const PangoMatrix *matrix, + PangoFont *font, + PangoGlyphString *glyphs, + int x, + int y); #ifdef PANGO_ENABLE_ENGINE @@ -96,7 +96,7 @@ PangoWin32FontCache *pango_win32_font_cache_new (void); void pango_win32_font_cache_free (PangoWin32FontCache *cache); HFONT pango_win32_font_cache_load (PangoWin32FontCache *cache, - const LOGFONT *logfont); + const LOGFONT *logfont); void pango_win32_font_cache_unload (PangoWin32FontCache *cache, HFONT hfont); diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index 360f680..e4efb05 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -182,21 +182,21 @@ pango_x_font_map_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontMapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_x_font_map_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXFontMap), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_x_font_map_init, + sizeof (PangoFontMapClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_x_font_map_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoXFontMap), + 0, /* n_preallocs */ + (GInstanceInitFunc) pango_x_font_map_init, NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_MAP, - I_("PangoXFontMap"), - &object_info, 0); + I_("PangoXFontMap"), + &object_info, 0); } return object_type; @@ -1494,21 +1494,21 @@ pango_x_face_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontFaceClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_x_face_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXFace), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, + sizeof (PangoFontFaceClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_x_face_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoXFace), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - I_("PangoXFace"), - &object_info, 0); + I_("PangoXFace"), + &object_info, 0); } return object_type; @@ -1653,21 +1653,21 @@ pango_x_family_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoFontFamilyClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_x_family_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXFamily), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, + sizeof (PangoFontFamilyClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_x_family_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoXFamily), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - I_("PangoXFamily"), - &object_info, 0); + I_("PangoXFamily"), + &object_info, 0); } return object_type; diff --git a/pango/pangox-private.h b/pango/pangox-private.h index 2ce8f58..4f4e909 100644 --- a/pango/pangox-private.h +++ b/pango/pangox-private.h @@ -115,8 +115,8 @@ void pango_x_fontmap_cache_remove (PangoFontMap *fontmap, PangoXFont *xfont); Atom pango_x_fontmap_atom_from_name (PangoFontMap *fontmap, - const char *atomname); + const char *atomname); const char *pango_x_fontmap_name_from_atom (PangoFontMap *fontmap, - Atom atom); + Atom atom); #endif /* __PANGOX_PRIVATE_H__ */ diff --git a/pango/pangox.c b/pango/pangox.c index a99b9d8..8f58c86 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -180,7 +180,7 @@ pango_x_get_context (Display *display) registered_modules = TRUE; for (i = 0; _pango_included_x_modules[i].list; i++) - pango_module_register (&_pango_included_x_modules[i]); + pango_module_register (&_pango_included_x_modules[i]); } result = pango_context_new (); @@ -189,8 +189,8 @@ pango_x_get_context (Display *display) info->get_gc_func = NULL; info->free_gc_func = NULL; g_object_set_qdata_full (G_OBJECT (result), - g_quark_from_static_string ("pango-x-info"), - info, (GDestroyNotify)g_free); + g_quark_from_static_string ("pango-x-info"), + info, (GDestroyNotify)g_free); pango_context_set_font_map (result, pango_x_font_map_for_display (display)); @@ -216,7 +216,7 @@ pango_x_context_set_funcs (PangoContext *context, g_return_if_fail (context != NULL); info = g_object_get_qdata (G_OBJECT (context), - g_quark_from_static_string ("pango-x-info")); + g_quark_from_static_string ("pango-x-info")); info->get_gc_func = get_gc_func; info->free_gc_func = free_gc_func; @@ -231,21 +231,21 @@ pango_x_font_get_type (void) { const GTypeInfo object_info = { - sizeof (PangoXFontClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_x_font_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXFont), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_x_font_init, + sizeof (PangoXFontClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) pango_x_font_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PangoXFont), + 0, /* n_preallocs */ + (GInstanceInitFunc) pango_x_font_init, NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT, - I_("PangoXFont"), - &object_info, 0); + I_("PangoXFont"), + &object_info, 0); } return object_type; @@ -444,10 +444,10 @@ pango_x_render (Display *display, goto unknown_glyph; } else { PangoFontMetrics *metrics; - int x1, y1, x2, y2; /* rectangle the character should go inside. */ - int baseline; + int x1, y1, x2, y2; /* rectangle the character should go inside. */ + int baseline; int stroke_thick; - gunichar wc; + gunichar wc; unknown_glyph: FLUSH; @@ -471,7 +471,7 @@ pango_x_render (Display *display, x1 = glyph_x; x2 = x1 + PANGO_PIXELS (glyphs->glyphs[i].geometry.width); - baseline = glyph_y; + baseline = glyph_y; stroke_thick = MAX ((int) (0.5 + 0.075 * (y2 - y1)), 1); if (glyph & PANGO_GLYPH_UNKNOWN_FLAG) @@ -479,16 +479,16 @@ pango_x_render (Display *display, else wc = 0; - switch (wc) - { - case '\n': - case '\r': - case 0x2028: /* Line separator */ - case 0x2029: /* Paragraph separator */ - { - /* Draw a carriage-return thingy */ - PangoRectangle up_stroke; - PangoRectangle across_stroke; + switch (wc) + { + case '\n': + case '\r': + case 0x2028: /* Line separator */ + case 0x2029: /* Paragraph separator */ + { + /* Draw a carriage-return thingy */ + PangoRectangle up_stroke; + PangoRectangle across_stroke; int hborder = (x2 - x1) * 0.1; int arrow_height = 0.25 * (y2 - y1); @@ -504,37 +504,37 @@ pango_x_render (Display *display, for (arrow_x = x1 + hborder; arrow_x < x1 + hborder + arrow_width; arrow_x++) { - XDrawLine (display, d, gc, - arrow_x, + XDrawLine (display, d, gc, + arrow_x, baseline - stroke_thick + (stroke_thick - tmp_height) / 2, - arrow_x, + arrow_x, baseline - stroke_thick + (stroke_thick - tmp_height) / 2 + tmp_height - 1); if ((arrow_x - x1 - hborder) % 2 == 1) tmp_height += 2; } - across_stroke.x = arrow_x; - across_stroke.width = x2 - hborder - arrow_x - stroke_thick; - across_stroke.y = baseline - stroke_thick; - across_stroke.height = stroke_thick; + across_stroke.x = arrow_x; + across_stroke.width = x2 - hborder - arrow_x - stroke_thick; + across_stroke.y = baseline - stroke_thick; + across_stroke.height = stroke_thick; - XFillRectangle (display, d, gc, - across_stroke.x, across_stroke.y, - across_stroke.width, across_stroke.height); + XFillRectangle (display, d, gc, + across_stroke.x, across_stroke.y, + across_stroke.width, across_stroke.height); up_stroke.x = across_stroke.x + across_stroke.width; up_stroke.width = stroke_thick; up_stroke.y = y1 + top_border; up_stroke.height = baseline - up_stroke.y; - XFillRectangle (display, d, gc, - up_stroke.x, up_stroke.y, - up_stroke.width, up_stroke.height); - } - break; + XFillRectangle (display, d, gc, + up_stroke.x, up_stroke.y, + up_stroke.width, up_stroke.height); + } + break; - default: + default: { /* Perhaps we should draw the box-with-numbers as in the * Xft backend, though we have no guarantee of having @@ -571,7 +571,7 @@ pango_x_render (Display *display, } pango_font_metrics_unref (metrics); - } + } next_glyph: x_off += glyphs->glyphs[i].geometry.width; @@ -625,18 +625,18 @@ pango_x_font_get_glyph_extents (PangoFont *font, if (glyph & PANGO_GLYPH_UNKNOWN_FLAG) wc = glyph & (~PANGO_GLYPH_UNKNOWN_FLAG); else - wc = 0; + wc = 0; switch (wc) - { - case '\n': - case '\r': - case 0x2028: /* Line separator */ - case 0x2029: /* Paragraph separator */ - { + { + case '\n': + case '\r': + case 0x2028: /* Line separator */ + case 0x2029: /* Paragraph separator */ + { #define MAGIC_FACTOR 1.2 - /* carriage-return thingy */ + /* carriage-return thingy */ width_factor = MAGIC_FACTOR; break; } @@ -650,7 +650,7 @@ pango_x_font_get_glyph_extents (PangoFont *font, metrics = pango_font_get_metrics (font, NULL); if (metrics) - { + { w = metrics->approximate_char_width * width_factor; w = PANGO_SCALE * PANGO_PIXELS (w); @@ -683,8 +683,8 @@ pango_x_font_get_glyph_extents (PangoFont *font, static gboolean get_int_prop (Atom atom, - XFontStruct *fs, - int *val) + XFontStruct *fs, + int *val) { int i; @@ -694,10 +694,10 @@ get_int_prop (Atom atom, while (i < fs->n_properties) { if (fs->properties[i].name == atom) - { - *val = fs->properties[i].card32; - return TRUE; - } + { + *val = fs->properties[i].card32; + return TRUE; + } ++i; } @@ -779,7 +779,7 @@ itemize_string_foreach (PangoFont *font, last_shaper = shaper; last_level = embedding_levels[i]; i++; - } + } } pango_glyph_string_free (glyph_str); @@ -801,7 +801,7 @@ get_font_metrics_from_subfonts (PangoFont *font, Atom avg_width_atom; avg_width_atom = pango_x_fontmap_atom_from_name (xfont->fontmap, - "AVERAGE_WIDTH"); + "AVERAGE_WIDTH"); metrics->ascent = 0; metrics->descent = 0; @@ -813,7 +813,7 @@ get_font_metrics_from_subfonts (PangoFont *font, if (subfont) { XFontStruct *fs = pango_x_get_font_struct (font, subfont); - gint avg_width = 0; + gint avg_width = 0; if (fs) { @@ -1486,7 +1486,7 @@ pango_x_render_layout_line (Display *display, PangoContext *context = pango_layout_get_context (line->layout); PangoXContextInfo *info = g_object_get_qdata (G_OBJECT (context), - g_quark_from_static_string ("pango-x-info")); + g_quark_from_static_string ("pango-x-info")); int x_off = 0; @@ -1548,14 +1548,14 @@ pango_x_render_layout_line (Display *display, x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE, y + 2); break; case PANGO_UNDERLINE_ERROR: - { - int point_x; - int counter = 0; + { + int point_x; + int counter = 0; int end_x = x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE; - for (point_x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1; - point_x <= end_x; - point_x += 2) + for (point_x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1; + point_x <= end_x; + point_x += 2) { if (counter) XDrawLine (display, drawable, gc, @@ -1566,7 +1566,7 @@ pango_x_render_layout_line (Display *display, counter = (counter + 1) % 2; } - } + } break; case PANGO_UNDERLINE_LOW: XDrawLine (display, drawable, fg_gc, @@ -1620,9 +1620,9 @@ pango_x_render_layout (Display *display, baseline = pango_layout_iter_get_baseline (iter); pango_x_render_layout_line (display, drawable, gc, - line, - x + PANGO_PIXELS (logical_rect.x), - y + PANGO_PIXELS (baseline)); + line, + x + PANGO_PIXELS (logical_rect.x), + y + PANGO_PIXELS (baseline)); } while (pango_layout_iter_next_line (iter)); @@ -1696,10 +1696,10 @@ pango_x_get_item_properties (PangoItem *item, */ gboolean pango_x_apply_ligatures (PangoFont *font, - PangoXSubfont subfont_id, - gunichar **glyphs, - int *n_glyphs, - int **clusters) + PangoXSubfont subfont_id, + gunichar **glyphs, + int *n_glyphs, + int **clusters) { return FALSE; } @@ -1718,9 +1718,9 @@ pango_x_apply_ligatures (PangoFont *font, */ gboolean pango_x_find_first_subfont (PangoFont *font, - char **charsets, + char **charsets, int n_charsets, - PangoXSubfont *rfont) + PangoXSubfont *rfont) { int n_subfonts; gboolean result = FALSE; @@ -1732,7 +1732,7 @@ pango_x_find_first_subfont (PangoFont *font, g_return_val_if_fail (rfont, 0); n_subfonts = pango_x_list_subfonts (font, charsets, n_charsets, - &subfonts, &subfont_charsets); + &subfonts, &subfont_charsets); if (n_subfonts > 0) { @@ -1758,9 +1758,9 @@ pango_x_find_first_subfont (PangoFont *font, */ void pango_x_fallback_shape (PangoFont *font, - PangoGlyphString *glyphs, - const char *text, - int n_chars) + PangoGlyphString *glyphs, + const char *text, + int n_chars) { PangoGlyph unknown_glyph = pango_x_get_unknown_glyph (font); PangoRectangle logical_rect; @@ -1803,7 +1803,7 @@ pango_x_fallback_shape (PangoFont *font, */ PangoGlyph pango_x_font_get_unknown_glyph (PangoFont *font, - gunichar wc) + gunichar wc) { return PANGO_GET_UNKNOWN_GLYPH (wc); } diff --git a/pango/pangox.h b/pango/pangox.h index c11e1fa..dc41b61 100644 --- a/pango/pangox.h +++ b/pango/pangox.h @@ -109,20 +109,20 @@ char *pango_x_font_subfont_xlfd (PangoFont *font, gboolean pango_x_find_first_subfont (PangoFont *font, - char **charsets, + char **charsets, int n_charsets, - PangoXSubfont *rfont); + PangoXSubfont *rfont); void pango_x_fallback_shape (PangoFont *font, - PangoGlyphString *glyphs, - const char *text, - int n_chars); + PangoGlyphString *glyphs, + const char *text, + int n_chars); gboolean pango_x_apply_ligatures (PangoFont *font, - PangoXSubfont subfont, - gunichar **glyphs, - int *n_glyphs, - int **clusters); + PangoXSubfont subfont, + gunichar **glyphs, + int *n_glyphs, + int **clusters); #endif /* PANGO_DISABLE_DEPRECATED */ diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c index b5063d6..9fd22d5 100644 --- a/pango/pangoxft-font.c +++ b/pango/pangoxft-font.c @@ -154,7 +154,7 @@ _pango_xft_font_get_mini_font (PangoXftFont *xfont) xfont->mini_font = pango_font_map_load_font (fcfont->fontmap, context, desc); if (!xfont->mini_font) - return NULL; + return NULL; pango_font_description_free (desc); g_object_unref (context); @@ -363,9 +363,9 @@ load_fallback_font (PangoXftFont *xfont) size = pango_font_description_get_size (fcfont->description) / PANGO_SCALE; xft_font = XftFontOpen (display, screen, - FC_FAMILY, FcTypeString, "sans", + FC_FAMILY, FcTypeString, "sans", size_is_absolute ? FC_PIXEL_SIZE : FC_SIZE, FcTypeDouble, size, - NULL); + NULL); if (!xft_font) { @@ -471,7 +471,7 @@ pango_xft_font_get_font (PangoFont *font) if (G_UNLIKELY (!PANGO_XFT_IS_FONT (font))) { if (!_pango_xft_warning_history.get_font) - { + { _pango_xft_warning_history.get_font = TRUE; g_warning ("pango_xft_font_get_font called with bad font, expect ugly output"); } diff --git a/pango/pangoxft-render.c b/pango/pangoxft-render.c index 22cf71c..82333e2 100644 --- a/pango/pangoxft-render.c +++ b/pango/pangoxft-render.c @@ -417,7 +417,7 @@ pango_xft_renderer_draw_glyphs (PangoRenderer *renderer, _pango_xft_renderer_draw_box_glyph (renderer, gi, glyph_x, glyph_y); } - x_off += gi->geometry.width; + x_off += gi->geometry.width; } return; } diff --git a/pango/pangoxft.h b/pango/pangoxft.h index 52c1d49..53387a5 100644 --- a/pango/pangoxft.h +++ b/pango/pangoxft.h @@ -44,7 +44,7 @@ typedef struct _PangoXftFontMap PangoXftFontMap; typedef struct _PangoXftFont PangoXftFont; typedef void (*PangoXftSubstituteFunc) (FcPattern *pattern, - gpointer data); + gpointer data); /* Calls for applications */ diff --git a/pango/shape.c b/pango/shape.c index 8bf5c36..8e535ac 100644 --- a/pango/shape.c +++ b/pango/shape.c @@ -39,9 +39,9 @@ */ void pango_shape (const gchar *text, - gint length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs) + gint length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs) { int i; int last_cluster; @@ -52,7 +52,7 @@ pango_shape (const gchar *text, text, length, analysis, glyphs); if (G_UNLIKELY (glyphs->num_glyphs == 0)) - { + { /* If a font has been correctly chosen, but no glyphs are output, * there's probably something wrong with the shaper. Trying to be * informative, we print out the font description, but to not @@ -87,13 +87,13 @@ pango_shape (const gchar *text, { if (!PANGO_IS_ENGINE_SHAPE (analysis->shape_engine) && !_pango_warning_history.shape_shape_engine) - { + { _pango_warning_history.shape_shape_engine = TRUE; g_warning ("pango_shape called with bad shape_engine, expect ugly output"); } if (!PANGO_IS_FONT (analysis->font) && !_pango_warning_history.shape_font) - { + { _pango_warning_history.shape_font = TRUE; g_warning ("pango_shape called with bad font, expect ugly output"); } diff --git a/tests/dump-boundaries.c b/tests/dump-boundaries.c index 9d6aefa..9c890d2 100644 --- a/tests/dump-boundaries.c +++ b/tests/dump-boundaries.c @@ -61,11 +61,11 @@ dump_text (const char *text) attrs = g_new0 (PangoLogAttr, len + 1); pango_get_log_attrs (text, - -1, - 0, - pango_language_from_string ("C"), - attrs, - len + 1); + -1, + 0, + pango_language_from_string ("C"), + attrs, + len + 1); ucs4 = g_utf8_to_ucs4 (text, -1, NULL, NULL, NULL); @@ -78,27 +78,27 @@ dump_text (const char *text) g_unichar_to_utf8 (ucs4[i], buf); if (*buf == '\n') - loc = g_strdup ("\\n"); + loc = g_strdup ("\\n"); else if (*buf == '\r') - loc = g_strdup ("\\r"); + loc = g_strdup ("\\r"); else - loc = g_locale_from_utf8 (buf, -1, NULL, NULL, NULL); + loc = g_locale_from_utf8 (buf, -1, NULL, NULL, NULL); g_print (CHFORMAT " (%s):\t line_break = %d mandatory_break = %d char_break = %d\n" - " \t\t white = %d cursor_position = %d\n" - " \t\t word_start = %d word_end = %d\n" - " \t\t sentence_boundary = %d sentence_start = %d sentence_end = %d\n", - ucs4[i], loc ? loc : "?", - attrs[i].is_line_break, - attrs[i].is_mandatory_break, - attrs[i].is_char_break, - attrs[i].is_white, - attrs[i].is_cursor_position, - attrs[i].is_word_start, - attrs[i].is_word_end, - attrs[i].is_sentence_boundary, - attrs[i].is_sentence_start, - attrs[i].is_sentence_end); + " \t\t white = %d cursor_position = %d\n" + " \t\t word_start = %d word_end = %d\n" + " \t\t sentence_boundary = %d sentence_start = %d sentence_end = %d\n", + ucs4[i], loc ? loc : "?", + attrs[i].is_line_break, + attrs[i].is_mandatory_break, + attrs[i].is_char_break, + attrs[i].is_white, + attrs[i].is_cursor_position, + attrs[i].is_word_start, + attrs[i].is_word_end, + attrs[i].is_sentence_boundary, + attrs[i].is_sentence_start, + attrs[i].is_sentence_end); g_free (loc); diff --git a/tests/testboundaries.c b/tests/testboundaries.c index 45177b0..30a9f31 100644 --- a/tests/testboundaries.c +++ b/tests/testboundaries.c @@ -41,19 +41,19 @@ */ #define VIRAMA_SCRIPT(wc) ((wc) >= 0x0901 && (wc) <= 0x17FF) #define VIRAMA(wc) ((wc) == 0x094D || \ - (wc) == 0x09CD || \ - (wc) == 0x0A4D || \ - (wc) == 0x0ACD || \ - (wc) == 0x0B4D || \ - (wc) == 0x0BCD || \ - (wc) == 0x0C4D || \ - (wc) == 0x0CCD || \ - (wc) == 0x0D4D || \ - (wc) == 0x0DCA || \ - (wc) == 0x0E3A || \ - (wc) == 0x0F84 || \ - (wc) == 0x1039 || \ - (wc) == 0x17D2) + (wc) == 0x09CD || \ + (wc) == 0x0A4D || \ + (wc) == 0x0ACD || \ + (wc) == 0x0B4D || \ + (wc) == 0x0BCD || \ + (wc) == 0x0C4D || \ + (wc) == 0x0CCD || \ + (wc) == 0x0D4D || \ + (wc) == 0x0DCA || \ + (wc) == 0x0E3A || \ + (wc) == 0x0F84 || \ + (wc) == 0x1039 || \ + (wc) == 0x17D2) /* Types of Japanese characters */ #define JAPANESE(wc) ((wc) >= 0x2F00 && (wc) <= 0x30FF) #define KANJI(wc) ((wc) >= 0x2F00 && (wc) <= 0x2FDF) @@ -88,21 +88,21 @@ static void fail (const char *format, ...) } typedef void (* CharForeachFunc) (gunichar wc, - gunichar prev_wc, - gunichar next_wc, - GUnicodeType type, - GUnicodeType prev_type, - GUnicodeType next_type, - PangoLogAttr *attr, - PangoLogAttr *prev_attr, - PangoLogAttr *next_attr, - gpointer data); + gunichar prev_wc, + gunichar next_wc, + GUnicodeType type, + GUnicodeType prev_type, + GUnicodeType next_type, + PangoLogAttr *attr, + PangoLogAttr *prev_attr, + PangoLogAttr *next_attr, + gpointer data); static void log_attr_foreach (const char *text, - PangoLogAttr *attrs, - CharForeachFunc func, - gpointer data) + PangoLogAttr *attrs, + CharForeachFunc func, + gpointer data) { const gchar *next = text; gint length = strlen (text); @@ -142,45 +142,45 @@ log_attr_foreach (const char *text, line_end = next; if (next >= end) - next_wc = 0; + next_wc = 0; else - next_wc = g_utf8_get_char (next); + next_wc = g_utf8_get_char (next); if (next_wc) - next_type = g_unichar_type (next_wc); + next_type = g_unichar_type (next_wc); (* func) (wc, prev_wc, next_wc, - type, prev_type, next_type, - &attrs[i], - i != 0 ? &attrs[i-1] : NULL, - next_wc != 0 ? &attrs[i+1] : NULL, - data); + type, prev_type, next_type, + &attrs[i], + i != 0 ? &attrs[i-1] : NULL, + next_wc != 0 ? &attrs[i+1] : NULL, + data); prev_type = type; prev_wc = wc; ++i; ++offset; if (wc == '\n') - { - ++line; - offset = 0; - line_start = next; - line_end = next; - } + { + ++line; + offset = 0; + line_start = next; + line_end = next; + } } } static void check_line_char (gunichar wc, - gunichar prev_wc, - gunichar next_wc, - GUnicodeType type, - GUnicodeType prev_type, - GUnicodeType next_type, - PangoLogAttr *attr, - PangoLogAttr *prev_attr, - PangoLogAttr *next_attr, - gpointer data) + gunichar prev_wc, + gunichar next_wc, + GUnicodeType type, + GUnicodeType prev_type, + GUnicodeType next_type, + PangoLogAttr *attr, + PangoLogAttr *prev_attr, + PangoLogAttr *next_attr, + gpointer data) { GUnicodeBreakType break_type; GUnicodeBreakType prev_break_type; @@ -194,13 +194,13 @@ check_line_char (gunichar wc, if (wc == '\n') { if (prev_wc == '\r') - { - if (attr->is_line_break) - fail ("line break between \\r and \\n"); - } + { + if (attr->is_line_break) + fail ("line break between \\r and \\n"); + } if (next_attr && !next_attr->is_line_break) - fail ("no line break after \\n"); + fail ("no line break after \\n"); } if (attr->is_line_break && prev_wc == 0) @@ -209,9 +209,9 @@ check_line_char (gunichar wc, if (break_type == G_UNICODE_BREAK_SPACE) { if (attr->is_line_break && prev_attr != NULL && - !attr->is_mandatory_break && + !attr->is_mandatory_break && !(next_wc && g_unichar_break_type (next_wc) == G_UNICODE_BREAK_COMBINING_MARK)) - fail ("can't break lines before a space unless a mandatory break char precedes it or a combining mark follows; prev char was " CHFORMAT, prev_wc); + fail ("can't break lines before a space unless a mandatory break char precedes it or a combining mark follows; prev char was " CHFORMAT, prev_wc); } if (attr->is_mandatory_break && !attr->is_line_break) @@ -245,14 +245,14 @@ check_line_char (gunichar wc, static void check_line_invariants (const char *text, - PangoLogAttr *attrs) + PangoLogAttr *attrs) { log_attr_foreach (text, attrs, check_line_char, NULL); } static void check_word_invariants (const char *text, - PangoLogAttr *attrs) + PangoLogAttr *attrs) { @@ -260,7 +260,7 @@ check_word_invariants (const char *text, static void check_sentence_invariants (const char *text, - PangoLogAttr *attrs) + PangoLogAttr *attrs) { @@ -268,17 +268,17 @@ check_sentence_invariants (const char *text, static void check_grapheme_invariants (const char *text, - PangoLogAttr *attrs) + PangoLogAttr *attrs) { } static void print_sentences (const char *text, - PangoLogAttr *attrs); + PangoLogAttr *attrs); static void print_sentences (const char *text, - PangoLogAttr *attrs) + PangoLogAttr *attrs) { const char *p; const char *last; @@ -290,12 +290,12 @@ print_sentences (const char *text, while (*p) { if (attrs[i].is_sentence_boundary) - { - char *s = g_strndup (last, p - last); - printf ("%s\n", s); - g_free (s); - last = p; - } + { + char *s = g_strndup (last, p - last); + printf ("%s\n", s); + g_free (s); + last = p; + } p = g_utf8_next_char (p); ++i; @@ -315,11 +315,11 @@ check_invariants (const char *text) attrs = g_new0 (PangoLogAttr, len + 1); pango_get_log_attrs (text, - -1, - 0, - pango_language_from_string ("C"), - attrs, - len + 1); + -1, + 0, + pango_language_from_string ("C"), + attrs, + len + 1); check_line_invariants (text, attrs); check_sentence_invariants (text, attrs); diff --git a/tests/testscript.c b/tests/testscript.c index d2ecaa8..8e788f7 100644 --- a/tests/testscript.c +++ b/tests/testscript.c @@ -67,9 +67,9 @@ if (stmt) { } \ else \ { \ - g_warning ("%s:%d (%s): assertion '%s' failed", \ + g_warning ("%s:%d (%s): assertion '%s' failed", \ __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, #stmt); \ - exit (1); \ + exit (1); \ } \ } G_STMT_END