From f0cae8454909f93713c747d41de5a8a5b8c6a057 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 14 Nov 2005 07:22:31 +0000 Subject: Include string.h, needed for memset. 2005-11-14 Behdad Esfahbod * pango/mini-fribidi/fribidi.c): Include string.h, needed for memset. * pango/mini-fribidi/fribidi.c (fribidi_analyse_string_utf8): Handle short-circuiting of the case when there are ltr letters, no rtl strongs, and base dir is weak rtl. Pointed out by Owen Taylor. --- pango/mini-fribidi/fribidi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'pango') diff --git a/pango/mini-fribidi/fribidi.c b/pango/mini-fribidi/fribidi.c index dfe9411a..4d9c0b98 100644 --- a/pango/mini-fribidi/fribidi.c +++ b/pango/mini-fribidi/fribidi.c @@ -22,6 +22,7 @@ */ #include +#include #ifdef HAVE_CONFIG_H #include @@ -547,10 +548,16 @@ fribidi_analyse_string_utf8 ( /* input */ type_rl_list = run_length_encode_types_utf8 (str, bytelen, len, &ored_types, &anded_strongs); - /* If there's absolutely nothing with a hint of rtl, then all resolved - * levels will be ltr (even). short-circuit. + /* The case that all resolved levels will be ltr. + * First, all strongs should be ltr, and one of the following: + * + * o *pbase_dir doesn't have an rtl taste. + * o there are letters, and *pbase_dir is weak. */ - if (!FRIBIDI_IS_RTL (*pbase_dir | ored_types)) + if (!FRIBIDI_IS_RTL (ored_types) && + (!FRIBIDI_IS_RTL (*pbase_dir) || + (FRIBIDI_IS_WEAK (*pbase_dir) && FRIBIDI_IS_LETTER (ored_types)) + )) { /* all ltr */ free_rl_list (type_rl_list); -- cgit v1.2.1