GNOME Bugzilla – Bug 355435
Invalid calls to pango_map_get_engine()
Last modified: 2006-09-11 21:06:18 UTC
The prototype for pango_map_get_engine() is: PangoEngine * pango_map_get_engine (PangoMap *map, PangoScript script); But the calls to this function in pango_get_log_attrs() are: range_engine = (PangoEngineLang*) pango_map_get_engine (lang_map, g_utf8_get_char (text)); and: analysis.lang_engine = (PangoEngineLang*) pango_map_get_engine (lang_map, g_utf8_get_char (pos)); where the second argument is passed as a gunichar, instead of PangoScript as actually required. As a result, the default engine, rather than the engine for the text itself, seems to always be used in random places, such as the handling of word movements in GtkTextView. For example, when installing pango-libthai language engine [1], which provides Pango attributes at Thai word boundaries, this code prevents proper caret movements by word from working (because the libthai engine is never called). By a brief grep on source codes, this kind of error also appears in pangofc-font.c, pangowin32.c and pangox.c. But I have not verified the effects of such cases. [1] http://libthai.sourceforge.net/
Created attachment 72552 [details] [review] Proposed patch
Disaster! We should add an assertion in the function.
2006-09-11 Behdad Esfahbod <behdad@gnome.org> Bug 355435 – Invalid calls to pango_map_get_engine() Patch from Theppitak Karoonboonyanan * pango/break.c (pango_get_log_attrs): * pango/pango-renderer.c (add_underline): * pango/pangofc-font.c (pango_fc_font_find_shaper): * pango/pangowin32.c (pango_win32_font_find_shaper): * pango/pangox.c (pango_x_font_find_shaper): Pass a PangoScript to pango_map_get_engine, not a gunichar!