[pango/wip/khaled/fribidi: 2/2] Move code to the outer scoop
- From: Khaled Hosny <khaledh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/wip/khaled/fribidi: 2/2] Move code to the outer scoop
- Date: Tue, 14 Nov 2017 21:00:20 +0000 (UTC)
commit 6777d509a25fbe8586d572f8e607cda9fc33891d
Author: Khaled Hosny <khaledhosny eglug org>
Date: Tue Nov 14 22:57:36 2017 +0200
Move code to the outer scoop
pango/pango-bidi-type.c | 68 ++++++++++++++++++++++------------------------
1 files changed, 33 insertions(+), 35 deletions(-)
---
diff --git a/pango/pango-bidi-type.c b/pango/pango-bidi-type.c
index 532613d..d1cbaf2 100644
--- a/pango/pango-bidi-type.c
+++ b/pango/pango-bidi-type.c
@@ -126,6 +126,13 @@ pango_log2vis_get_embedding_levels (const gchar *text,
{
FriBidiParType fribidi_base_dir;
guint8 *embedding_levels_list;
+ glong n_chars, i;
+ FriBidiCharType *types;
+#ifdef USE_FRIBIDI_EX_API
+ FriBidiBracketType *brackets;
+#endif
+ FriBidiLevel max_level;
+ const char *p;
switch (*pbase_dir)
{
@@ -147,55 +154,46 @@ pango_log2vis_get_embedding_levels (const gchar *text,
break;
}
- {
- glong n_chars, i;
- FriBidiCharType *types;
-#ifdef USE_FRIBIDI_EX_API
- FriBidiBracketType *brackets;
-#endif
- FriBidiLevel max_level;
- const char *p;
-
- if (length < 0)
- length = strlen (text);
+ if (length < 0)
+ length = strlen (text);
- n_chars = g_utf8_strlen (text, length);
+ n_chars = g_utf8_strlen (text, length);
- types = g_new (FriBidiCharType, n_chars);
+ types = g_new (FriBidiCharType, n_chars);
#ifdef USE_FRIBIDI_EX_API
- brackets = g_new (FriBidiBracketType, n_chars);
+ brackets = g_new (FriBidiBracketType, n_chars);
#endif
- embedding_levels_list = g_new (guint8, n_chars);
+ embedding_levels_list = g_new (guint8, n_chars);
- for (i = 0, p = text; p < text + length; p = g_utf8_next_char(p), i++)
- {
- gunichar ch = g_utf8_get_char (p);
- types[i] = fribidi_get_bidi_type (ch);
+ for (i = 0, p = text; p < text + length; p = g_utf8_next_char(p), i++)
+ {
+ gunichar ch = g_utf8_get_char (p);
+ types[i] = fribidi_get_bidi_type (ch);
#ifdef USE_FRIBIDI_EX_API
- if (types[i] != FRIBIDI_TYPE_ON)
- brackets[i] = FRIBIDI_NO_BRACKET;
- else
- brackets[i] = fribidi_get_bracket (ch);
+ if (types[i] != FRIBIDI_TYPE_ON)
+ brackets[i] = FRIBIDI_NO_BRACKET;
+ else
+ brackets[i] = fribidi_get_bracket (ch);
#endif
- }
+ }
#ifdef USE_FRIBIDI_EX_API
- max_level = fribidi_get_par_embedding_levels_ex (types, brackets, n_chars,
- &fribidi_base_dir,
- (FriBidiLevel*)embedding_levels_list);
+ max_level = fribidi_get_par_embedding_levels_ex (types, brackets, n_chars,
+ &fribidi_base_dir,
+ (FriBidiLevel*)embedding_levels_list);
#else
- max_level = fribidi_get_par_embedding_levels (types, n_chars,
- &fribidi_base_dir,
- (FriBidiLevel*)embedding_levels_list);
+ max_level = fribidi_get_par_embedding_levels (types, n_chars,
+ &fribidi_base_dir,
+ (FriBidiLevel*)embedding_levels_list);
#endif
- if (max_level == 0)
- {
- /* fribidi_get_par_embedding_levels failed, what should we do here? */
- }
- g_free (types);
+ if (max_level == 0)
+ {
+ /* fribidi_get_par_embedding_levels failed, what should we do here? */
}
+ g_free (types);
+
*pbase_dir = (fribidi_base_dir == FRIBIDI_PAR_LTR) ? PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL;
return embedding_levels_list;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]