Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
63c0ef4a
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
大约 1 年 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
63c0ef4a
编写于
7月 21, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix decompose() implementations to work with non-starter non-composables
Add tests.
上级
5d90a342
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
15 deletion
+26
-15
src/hb-glib.cc
src/hb-glib.cc
+5
-5
src/hb-icu.cc
src/hb-icu.cc
+13
-7
test/test-unicode.c
test/test-unicode.c
+8
-3
未找到文件。
src/hb-glib.cc
浏览文件 @
63c0ef4a
...
...
@@ -296,16 +296,16 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
*
b
=
0
;
ret
=
*
a
!=
ab
;
}
else
if
(
len
==
2
)
{
*
a
=
g_utf8_get_char
(
normalized
);
*
b
=
g_utf8_get_char
(
g_utf8_next_char
(
normalized
));
/* Here's the ugly part: if ab decomposes to a single character and
* that character decomposes again, we have to detect that and undo
* the second part :-(. */
gchar
*
recomposed
=
g_utf8_normalize
(
normalized
,
-
1
,
G_NORMALIZE_NFC
);
if
(
g_utf8_get_char
(
recomposed
)
!=
ab
)
{
*
a
=
g_utf8_get_char
(
recomposed
);
hb_codepoint_t
c
=
g_utf8_get_char
(
recomposed
);
if
(
c
!=
ab
&&
c
!=
*
a
)
{
*
a
=
c
;
*
b
=
0
;
}
else
{
*
a
=
g_utf8_get_char
(
normalized
);
*
b
=
g_utf8_get_char
(
g_utf8_next_char
(
normalized
));
}
g_free
(
recomposed
);
ret
=
TRUE
;
...
...
src/hb-icu.cc
浏览文件 @
63c0ef4a
...
...
@@ -214,6 +214,10 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_bool_t
ret
,
err
;
UErrorCode
icu_err
;
/* This function is a monster! Maybe it wasn't a good idea adding a
* pairwise decompose API... */
/* Watchout for the dragons. Err, watchout for macros changing len. */
len
=
0
;
err
=
FALSE
;
U16_APPEND
(
utf16
,
len
,
ARRAY_LENGTH
(
utf16
),
ab
,
err
);
...
...
@@ -232,21 +236,23 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
*
b
=
0
;
ret
=
*
a
!=
ab
;
}
else
if
(
len
==
2
)
{
len
=
0
;
U16_NEXT_UNSAFE
(
normalized
,
len
,
*
a
);
U16_NEXT_UNSAFE
(
normalized
,
len
,
*
b
);
/* Here's the ugly part: if ab decomposes to a single character and
* that character decomposes again, we have to detect that and undo
* the second part :-(. */
UChar
recomposed
[
20
];
icu_err
=
U_ZERO_ERROR
;
len
=
unorm_normalize
(
normalized
,
len
,
UNORM_NFC
,
0
,
recomposed
,
ARRAY_LENGTH
(
recomposed
),
&
icu_err
);
unorm_normalize
(
normalized
,
len
,
UNORM_NFC
,
0
,
recomposed
,
ARRAY_LENGTH
(
recomposed
),
&
icu_err
);
if
(
icu_err
)
return
FALSE
;
U16_GET_UNSAFE
(
recomposed
,
0
,
*
a
);
if
(
*
a
!=
ab
)
{
hb_codepoint_t
c
;
U16_GET_UNSAFE
(
recomposed
,
0
,
c
);
if
(
c
!=
*
a
&&
c
!=
ab
)
{
*
a
=
c
;
*
b
=
0
;
}
else
{
len
=
0
;
U16_NEXT_UNSAFE
(
normalized
,
len
,
*
a
);
U16_GET_UNSAFE
(
normalized
,
len
,
*
b
);
}
ret
=
TRUE
;
}
else
{
...
...
test/test-unicode.c
浏览文件 @
63c0ef4a
...
...
@@ -800,6 +800,10 @@ test_unicode_normalization (gconstpointer user_data)
g_assert
(
!
hb_unicode_compose
(
uf
,
0x2126
,
0
,
&
ab
)
&&
ab
==
0
);
g_assert
(
!
hb_unicode_compose
(
uf
,
0x03A9
,
0
,
&
ab
)
&&
ab
==
0
);
/* Non-starter pairs should not compose */
g_assert
(
!
hb_unicode_compose
(
uf
,
0x0308
,
0x0301
,
&
ab
)
&&
ab
==
0
);
/* !0x0344 */
g_assert
(
!
hb_unicode_compose
(
uf
,
0x0F71
,
0x0F72
,
&
ab
)
&&
ab
==
0
);
/* !0x0F73 */
/* Pairs */
g_assert
(
hb_unicode_compose
(
uf
,
0x0041
,
0x030A
,
&
ab
)
&&
ab
==
0x00C5
);
g_assert
(
hb_unicode_compose
(
uf
,
0x006F
,
0x0302
,
&
ab
)
&&
ab
==
0x00F4
);
...
...
@@ -822,12 +826,13 @@ test_unicode_normalization (gconstpointer user_data)
g_assert
(
!
hb_unicode_decompose
(
uf
,
0xFB01
,
&
a
,
&
b
)
&&
a
==
0xFB01
&&
b
==
0
);
/* Singletons */
g_assert
(
hb_unicode_decompose
(
uf
,
0x212B
,
&
a
,
&
b
));
g_assert_cmphex
(
a
,
==
,
0x00C5
);
g_assert_cmphex
(
b
,
==
,
0
);
g_assert
(
hb_unicode_decompose
(
uf
,
0x212B
,
&
a
,
&
b
)
&&
a
==
0x00C5
&&
b
==
0
);
g_assert
(
hb_unicode_decompose
(
uf
,
0x2126
,
&
a
,
&
b
)
&&
a
==
0x03A9
&&
b
==
0
);
/* Non-starter pairs decompose, but not compose */
g_assert
(
hb_unicode_decompose
(
uf
,
0x0344
,
&
a
,
&
b
)
&&
a
==
0x0308
&&
b
==
0x0301
);
g_assert
(
hb_unicode_decompose
(
uf
,
0x0F73
,
&
a
,
&
b
)
&&
a
==
0x0F71
&&
b
==
0x0F72
);
/* Pairs */
g_assert
(
hb_unicode_decompose
(
uf
,
0x00C5
,
&
a
,
&
b
)
&&
a
==
0x0041
&&
b
==
0x030A
);
g_assert
(
hb_unicode_decompose
(
uf
,
0x00F4
,
&
a
,
&
b
)
&&
a
==
0x006F
&&
b
==
0x0302
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录