GNOME Bugzilla – Bug 171439
pango_layout_xy_to_index trailing argument wrong if text is only numbers (not strong ltr)
Last modified: 2005-07-25 17:33:42 UTC
Will attach test case. Symptom is that in a pango-enabled mozilla build if you click in a text area that only contains numbers after all the text the cursor will be positioned at the beginning of the string, not the end. Cause is that the line direction on number-only text is set to WEAK_LTR not LTR. The PangoContext generated by xft is WEAK_LTR by default and that's passed all the way down to the line layout default direction in pango_layout_check_lines().
Created attachment 39172 [details] test case This is a simple test case that demonstrates the problem. Trailing should be '1' not '0'.
Oh, if you can think of a work around for this I would appreciate it. There's a lot of pango installs out there. Maybe setting the context direction to LTR instead of leaving it as WEAK_LTR might work?
Created attachment 39351 [details] [review] Fix in pango. Well, I must confess I'm a bit lost in how things work in pango, since itemize_state_init throws away the resolved dir got back from pango_log2vis_get_embedding_levels. Anyway, attached patch indeed fixes your problem, and is a valid changed, but to me smells like a much bigger patch is needed eventually. Would you please check what happens if the neutral paragraph is not the only paragraph in the layout, before and after the patch.
I don't think there is anything big needed.... resolved_dir has to do with the paragraph-level resolution algorithm that Dov added a release or two ago. What I think is needed is that in the two places where layout->resolved_dir are set ... weak_ltr/weak_rtl should be converted to ltr/rtl. (Neutral probably also needs to be converted to a real direction; probably the direction of the layout's context.)
2005-07-25 Owen Taylor <otaylor@redhat.com> * pango/pango-layout.c (line_set_resolved_dir): Always set line->resolved_dir to one of LTR or RTL. (#171439, Reported by Chris Blizzard)