summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2000-08-20 17:49:10 +0000
committerTor Lillqvist <tml@src.gnome.org>2000-08-20 17:49:10 +0000
commit1c7f0ddea0ef2f9471a1dd87cebee30443524bd6 (patch)
tree836180c7cde3c70686d3ab07340c7007143709a9 /examples
parentb7b78c25c9d3e5d803c471366802f007cd07be04 (diff)
downloadpango-1c7f0ddea0ef2f9471a1dd87cebee30443524bd6.tar.gz
examples/viewer-ft2.c Replace division or multiplication with 1000 (which
2000-08-20 Tor Lillqvist <tml@iki.fi> * examples/viewer-ft2.c * examples/viewer-win32.c: Replace division or multiplication with 1000 (which was the old PANGO_SCALE value) to use PANGO_SCALE and PANGO_PIXELS instead.
Diffstat (limited to 'examples')
-rw-r--r--examples/viewer-ft2.c18
-rw-r--r--examples/viewer-win32.c18
2 files changed, 20 insertions, 16 deletions
diff --git a/examples/viewer-ft2.c b/examples/viewer-ft2.c
index a6cbfa55..e077c525 100644
--- a/examples/viewer-ft2.c
+++ b/examples/viewer-ft2.c
@@ -164,7 +164,9 @@ xy_to_cp (int width,
if (height + para->height >= y)
{
- gboolean result = pango_layout_xy_to_index (para->layout, x * 1000, (y - height) * 1000,
+ gboolean result = pango_layout_xy_to_index (para->layout,
+ x * PANGO_SCALE,
+ (y - height) * PANGO_SCALE,
index, NULL);
if (result && para_return)
*para_return = para;
@@ -203,10 +205,10 @@ char_bounds (Paragraph *para,
pango_layout_index_to_pos (cur_para->layout, index, &pos);
- rect->x = MIN (pos.x, pos.x + pos.width) / 1000;
- rect->width = ABS (pos.width) / 1000;
- rect->y = height + pos.y / 1000;
- rect->height = pos.height / 1000;
+ rect->x = PANGO_PIXELS (MIN (pos.x, pos.x + pos.width));
+ rect->width = PANGO_PIXELS (ABS (pos.width));
+ rect->y = height + PANGO_PIXELS (pos.y);
+ rect->height = PANGO_PIXELS (pos.height);
return;
}
@@ -271,10 +273,10 @@ size_allocate (GtkWidget *layout,
pango_layout_set_alignment (para->layout,
base_dir == PANGO_DIRECTION_LTR ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
- pango_layout_set_width (para->layout, layout->allocation.width * 1000);
+ pango_layout_set_width (para->layout, layout->allocation.width * PANGO_SCALE);
pango_layout_get_extents (para->layout, NULL, &logical_rect);
- para->height = logical_rect.height / 1000;
+ para->height = PANGO_PIXELS (logical_rect.height);
height += para->height;
}
@@ -641,7 +643,7 @@ make_font_selector (void)
gtk_box_pack_start (GTK_BOX (hbox), util_hbox, FALSE, FALSE, 0);
adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin_button));
- adj->value = font_description.size / 1000.;
+ adj->value = PANGO_PIXELS (font_description.size);
adj->lower = 0;
adj->upper = 1024;
adj->step_increment = 1;
diff --git a/examples/viewer-win32.c b/examples/viewer-win32.c
index 62086513..cbfb8033 100644
--- a/examples/viewer-win32.c
+++ b/examples/viewer-win32.c
@@ -160,7 +160,9 @@ xy_to_cp (int width, int x, int y, Paragraph **para_return, int *index)
if (height + para->height >= y)
{
- gboolean result = pango_layout_xy_to_index (para->layout, x * 1000, (y - height) * 1000,
+ gboolean result = pango_layout_xy_to_index (para->layout,
+ x * PANGO_SCALE,
+ (y - height) * PANGO_SCALE,
index, NULL);
if (result && para_return)
*para_return = para;
@@ -196,10 +198,10 @@ char_bounds (Paragraph *para, int index, int width, PangoRectangle *rect)
pango_layout_index_to_pos (cur_para->layout, index, &pos);
- rect->x = MIN (pos.x, pos.x + pos.width) / 1000;
- rect->width = ABS (pos.width) / 1000;
- rect->y = height + pos.y / 1000;
- rect->height = pos.height / 1000;
+ rect->x = PANGO_PIXELS (MIN (pos.x, pos.x + pos.width));
+ rect->width = PANGO_PIXELS (ABS (pos.width));
+ rect->y = height + PANGO_PIXELS (pos.y);
+ rect->height = PANGO_PIXELS (pos.height);
}
height += cur_para->height;
@@ -259,10 +261,10 @@ size_allocate (GtkWidget *layout, GtkAllocation *allocation)
pango_layout_set_alignment (para->layout,
base_dir == PANGO_DIRECTION_LTR ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
- pango_layout_set_width (para->layout, layout->allocation.width * 1000);
+ pango_layout_set_width (para->layout, layout->allocation.width * PANGO_SCALE);
pango_layout_get_extents (para->layout, NULL, &logical_rect);
- para->height = logical_rect.height / 1000;
+ para->height = PANGO_PIXELS (logical_rect.height);
height += para->height;
}
@@ -598,7 +600,7 @@ make_font_selector (void)
gtk_box_pack_start (GTK_BOX (hbox), util_hbox, FALSE, FALSE, 0);
adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin_button));
- adj->value = font_description.size / 1000.;
+ adj->value = PANGO_PIXELS (font_description.size);
adj->lower = 0;
adj->upper = 1024;
adj->step_increment = 1;