summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-01-16 20:20:35 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-01-16 20:20:35 +0000
commita0225fbf560de93c7b41acf9dbf01c9d99173af9 (patch)
treebb8f58010c8801a27545728393253b6c4722c6c4 /examples
parent0ee36da9691c2311d2134fd61f222ea3bed5827e (diff)
downloadpango-a0225fbf560de93c7b41acf9dbf01c9d99173af9.tar.gz
*.c, *.h: Replace preceding sequences of 8 spaces with tabs.
2007-01-16 Behdad Esfahbod <behdad@gnome.org> *.c, *.h: Replace preceding sequences of 8 spaces with tabs. svn path=/trunk/; revision=2165
Diffstat (limited to 'examples')
-rw-r--r--examples/cairotwisted.c26
-rw-r--r--examples/pangowin32tobmp.c180
2 files changed, 103 insertions, 103 deletions
diff --git a/examples/cairotwisted.c b/examples/cairotwisted.c
index 586f44da..33d634c9 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 bd80172b..19ef392d 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. */