summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-03-01 17:15:18 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-03-01 17:15:18 +0000
commita67f95fab9d47a86a2b4e84c48e31af1e7f44f5b (patch)
tree58022b702e081d2e6561b433fa9dd61c047198d2
parentdd0df5d218b03ee0f16ed4310dc81225810e3503 (diff)
downloadpango-a67f95fab9d47a86a2b4e84c48e31af1e7f44f5b.tar.gz
Fix problem with positions at the ends of lines (#63328, reported by Dov
Fri Mar 1 12:11:50 2002 Owen Taylor <otaylor@redhat.com> * pango/pango-layout.c (pango_layout_line_get_vis2log_map): Fix problem with positions at the ends of lines (#63328, reported by Dov Grobgeld.)
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.pre-1-010
-rw-r--r--ChangeLog.pre-1-1010
-rw-r--r--ChangeLog.pre-1-210
-rw-r--r--ChangeLog.pre-1-410
-rw-r--r--ChangeLog.pre-1-610
-rw-r--r--ChangeLog.pre-1-810
-rw-r--r--pango/pango-layout.c55
8 files changed, 99 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 2fcf3fc1..d07819bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Mar 1 12:11:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (pango_layout_line_get_vis2log_map):
+ Fix problem with positions at the ends of lines
+ (#63328, reported by Dov Grobgeld.)
+
+2002-02-28 Sven Neumann <sven@gimp.org>
+
+ * configure.in: align --help output.
+
2002-02-28 Alex Larsson <alexl@redhat.com>
* pango/pangoft2.c (pango_ft2_font_get_face):
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index 2fcf3fc1..d07819bd 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,13 @@
+Fri Mar 1 12:11:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (pango_layout_line_get_vis2log_map):
+ Fix problem with positions at the ends of lines
+ (#63328, reported by Dov Grobgeld.)
+
+2002-02-28 Sven Neumann <sven@gimp.org>
+
+ * configure.in: align --help output.
+
2002-02-28 Alex Larsson <alexl@redhat.com>
* pango/pangoft2.c (pango_ft2_font_get_face):
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 2fcf3fc1..d07819bd 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,13 @@
+Fri Mar 1 12:11:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (pango_layout_line_get_vis2log_map):
+ Fix problem with positions at the ends of lines
+ (#63328, reported by Dov Grobgeld.)
+
+2002-02-28 Sven Neumann <sven@gimp.org>
+
+ * configure.in: align --help output.
+
2002-02-28 Alex Larsson <alexl@redhat.com>
* pango/pangoft2.c (pango_ft2_font_get_face):
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 2fcf3fc1..d07819bd 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,13 @@
+Fri Mar 1 12:11:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (pango_layout_line_get_vis2log_map):
+ Fix problem with positions at the ends of lines
+ (#63328, reported by Dov Grobgeld.)
+
+2002-02-28 Sven Neumann <sven@gimp.org>
+
+ * configure.in: align --help output.
+
2002-02-28 Alex Larsson <alexl@redhat.com>
* pango/pangoft2.c (pango_ft2_font_get_face):
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 2fcf3fc1..d07819bd 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,13 @@
+Fri Mar 1 12:11:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (pango_layout_line_get_vis2log_map):
+ Fix problem with positions at the ends of lines
+ (#63328, reported by Dov Grobgeld.)
+
+2002-02-28 Sven Neumann <sven@gimp.org>
+
+ * configure.in: align --help output.
+
2002-02-28 Alex Larsson <alexl@redhat.com>
* pango/pangoft2.c (pango_ft2_font_get_face):
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 2fcf3fc1..d07819bd 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,13 @@
+Fri Mar 1 12:11:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (pango_layout_line_get_vis2log_map):
+ Fix problem with positions at the ends of lines
+ (#63328, reported by Dov Grobgeld.)
+
+2002-02-28 Sven Neumann <sven@gimp.org>
+
+ * configure.in: align --help output.
+
2002-02-28 Alex Larsson <alexl@redhat.com>
* pango/pangoft2.c (pango_ft2_font_get_face):
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 2fcf3fc1..d07819bd 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,13 @@
+Fri Mar 1 12:11:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (pango_layout_line_get_vis2log_map):
+ Fix problem with positions at the ends of lines
+ (#63328, reported by Dov Grobgeld.)
+
+2002-02-28 Sven Neumann <sven@gimp.org>
+
+ * configure.in: align --help output.
+
2002-02-28 Alex Larsson <alexl@redhat.com>
* pango/pangoft2.c (pango_ft2_font_get_face):
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index cfeea281..026d77e0 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -1543,11 +1543,12 @@ pango_layout_line_get_vis2log_map (PangoLayoutLine *line,
{
PangoLayout *layout = line->layout;
PangoDirection base_dir = pango_context_get_base_dir (layout->context);
- PangoDirection prev_dir = base_dir;
+ PangoDirection prev_dir;
+ PangoDirection cursor_dir;
GSList *tmp_list;
gchar *start, *end;
int *result;
- int pos = 0;
+ int pos;
int n_chars;
pango_layout_line_get_range (line, &start, &end);
@@ -1556,19 +1557,17 @@ pango_layout_line_get_vis2log_map (PangoLayoutLine *line,
result = g_new (int, n_chars + 1);
if (strong)
- {
- if (base_dir == PANGO_DIRECTION_LTR)
- {
- result[0] = 0;
- result[n_chars] = end - start;
- }
- else
- {
- result[0] = end - start;
- result[n_chars] = 0;
- }
- }
-
+ cursor_dir = base_dir;
+ else
+ cursor_dir = (base_dir == PANGO_DIRECTION_LTR) ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR;
+
+ /* Handle the first visual position
+ */
+ if (base_dir == cursor_dir)
+ result[0] = base_dir == PANGO_DIRECTION_LTR ? 0 : end - start;
+
+ prev_dir = base_dir;
+ pos = 0;
tmp_list = line->runs;
while (tmp_list)
{
@@ -1578,29 +1577,29 @@ pango_layout_line_get_vis2log_map (PangoLayoutLine *line,
char *p = layout->text + run->item->offset;
int i;
+ /* pos is the visual position at the start of the run */
+ /* p is the logical byte index at the start of the run */
+
if (run_dir == PANGO_DIRECTION_LTR)
{
- if ((strong && base_dir == run_dir) ||
- (!strong && base_dir != run_dir) ||
+ if ((cursor_dir == PANGO_DIRECTION_LTR) ||
(prev_dir == run_dir))
result[pos] = p - start;
-
+
p = g_utf8_next_char (p);
-
+
for (i = 1; i < run_n_chars; i++)
{
result[pos + i] = p - start;
p = g_utf8_next_char (p);
}
-
- if ((strong && base_dir == run_dir) ||
- (!strong && base_dir != run_dir))
+
+ if (cursor_dir == PANGO_DIRECTION_LTR)
result[pos + run_n_chars] = p - start;
}
else
{
- if ((strong && base_dir == run_dir) ||
- (!strong && base_dir != run_dir))
+ if (cursor_dir == PANGO_DIRECTION_RTL)
result[pos + run_n_chars] = p - start;
p = g_utf8_next_char (p);
@@ -1611,8 +1610,7 @@ pango_layout_line_get_vis2log_map (PangoLayoutLine *line,
p = g_utf8_next_char (p);
}
- if ((strong && base_dir == run_dir) ||
- (!strong && base_dir != run_dir) ||
+ if ((cursor_dir == PANGO_DIRECTION_RTL) ||
(prev_dir == run_dir))
result[pos] = p - start;
}
@@ -1622,6 +1620,11 @@ pango_layout_line_get_vis2log_map (PangoLayoutLine *line,
tmp_list = tmp_list->next;
}
+ /* And the last visual position
+ */
+ if ((cursor_dir == base_dir) || (prev_dir == base_dir))
+ result[pos] = base_dir == PANGO_DIRECTION_LTR ? end - start : 0;
+
return result;
}