usp10: Update the line breaking algorithm to Unicode 6.2.0.

This commit is contained in:
Alexandre Julliard 2013-07-22 11:08:18 +02:00
parent 4be0f88e8d
commit 2c5c2b5546
1 changed files with 32 additions and 7 deletions

View File

@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);
extern const unsigned short wine_linebreak_table[];
enum breaking_types { b_BK=1, b_CR, b_LF, b_CM, b_SG, b_GL, b_CB, b_SP, b_ZW, b_NL, b_WJ, b_JL, b_JV, b_JT, b_H2, b_H3, b_XX, b_OP, b_CL, b_CP, b_QU, b_NS, b_EX, b_SY, b_IS, b_PR, b_PO, b_NU, b_AL, b_ID, b_IN, b_HY, b_BB, b_BA, b_SA, b_AI, b_B2};
enum breaking_types { b_BK=1, b_CR, b_LF, b_CM, b_SG, b_GL, b_CB, b_SP, b_ZW, b_NL, b_WJ, b_JL, b_JV, b_JT, b_H2, b_H3, b_XX, b_OP, b_CL, b_CP, b_QU, b_NS, b_EX, b_SY, b_IS, b_PR, b_PO, b_NU, b_AL, b_ID, b_IN, b_HY, b_BB, b_BA, b_SA, b_AI, b_B2, b_HL, b_CJ, b_RI};
enum breaking_class {b_r=1, b_s, b_x};
@ -111,6 +111,8 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
case b_SG:
case b_XX:
break_class[i] = b_AL;
case b_CJ:
break_class[i] = b_NS;
}
}
@ -283,6 +285,16 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
if (i < count-1)
else_break(&break_before[i+1],b_x);
break;
/* LB21a */
case b_HL:
if (i < count-2)
switch (break_class[i+1])
{
case b_HY:
case b_BA:
else_break(&break_before[i+2], b_x);
}
break;
/* LB22 */
case b_IN:
if (i > 0)
@ -290,6 +302,7 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
switch (break_class[i-1])
{
case b_AL:
case b_HL:
case b_ID:
case b_IN:
case b_NU:
@ -304,12 +317,16 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
/* LB23 */
if ((break_class[i] == b_ID && break_class[i+1] == b_PO) ||
(break_class[i] == b_AL && break_class[i+1] == b_NU) ||
(break_class[i] == b_NU && break_class[i+1] == b_AL))
(break_class[i] == b_HL && break_class[i+1] == b_NU) ||
(break_class[i] == b_NU && break_class[i+1] == b_AL) ||
(break_class[i] == b_NU && break_class[i+1] == b_HL))
else_break(&break_before[i+1],b_x);
/* LB24 */
if ((break_class[i] == b_PR && break_class[i+1] == b_ID) ||
(break_class[i] == b_PR && break_class[i+1] == b_AL) ||
(break_class[i] == b_PO && break_class[i+1] == b_AL))
(break_class[i] == b_PR && break_class[i+1] == b_HL) ||
(break_class[i] == b_PO && break_class[i+1] == b_AL) ||
(break_class[i] == b_PO && break_class[i+1] == b_HL))
else_break(&break_before[i+1],b_x);
/* LB25 */
@ -373,19 +390,27 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
}
/* LB28 */
if (break_class[i] == b_AL && break_class[i+1] == b_AL)
if ((break_class[i] == b_AL && break_class[i+1] == b_AL) ||
(break_class[i] == b_AL && break_class[i+1] == b_HL) ||
(break_class[i] == b_HL && break_class[i+1] == b_AL) ||
(break_class[i] == b_HL && break_class[i+1] == b_HL))
else_break(&break_before[i+1],b_x);
/* LB29 */
if (break_class[i] == b_IS && break_class[i+1] == b_AL)
if ((break_class[i] == b_IS && break_class[i+1] == b_AL) ||
(break_class[i] == b_IS && break_class[i+1] == b_HL))
else_break(&break_before[i+1],b_x);
/* LB30 */
if ((break_class[i] == b_AL || break_class[i] == b_NU) &&
if ((break_class[i] == b_AL || break_class[i] == b_HL || break_class[i] == b_NU) &&
break_class[i+1] == b_OP)
else_break(&break_before[i+1],b_x);
if (break_class[i] == b_CP &&
(break_class[i+1] == b_AL || break_class[i] == b_NU))
(break_class[i+1] == b_AL || break_class[i] == b_HL || break_class[i] == b_NU))
else_break(&break_before[i+1],b_x);
/* LB30a */
if (break_class[i] == b_RI && break_class[i+1] == b_RI)
else_break(&break_before[i+1],b_x);
}
}