Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4ff0d2d9
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
4ff0d2d9
编写于
7月 22, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Decomposition works now!
上级
468e9cb2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
42 deletion
+70
-42
src/hb-ot-shape-normalize.cc
src/hb-ot-shape-normalize.cc
+68
-41
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+2
-1
未找到文件。
src/hb-ot-shape-normalize.cc
浏览文件 @
4ff0d2d9
...
@@ -66,65 +66,74 @@ HB_BEGIN_DECLS
...
@@ -66,65 +66,74 @@ HB_BEGIN_DECLS
static
bool
static
bool
decompose
(
hb_ot_shape_context_t
*
c
,
decompose
(
hb_ot_shape_context_t
*
c
,
bool
recompose
,
bool
shortest
,
hb_codepoint_t
ab
)
hb_codepoint_t
ab
)
{
{
hb_codepoint_t
a
,
b
,
glyph
;
hb_codepoint_t
a
,
b
,
glyph
;
bool
has_this
=
hb_font_get_glyph
(
c
->
font
,
ab
,
0
,
&
glyph
);
/* If recomposing and the single char is supported by the font, we're good. */
if
(
!
hb_unicode_decompose
(
c
->
buffer
->
unicode
,
ab
,
&
a
,
&
b
)
||
if
(
recompose
&&
has_this
)
!
hb_font_get_glyph
(
c
->
font
,
b
,
0
,
&
glyph
))
return
TRUE
;
return
FALSE
;
if
(
hb_unicode_decompose
(
c
->
buffer
->
unicode
,
ab
,
&
a
,
&
b
)
&&
hb_font_get_glyph
(
c
->
font
,
b
,
0
,
&
glyph
)
&&
decompose
(
c
,
recompose
,
a
))
{
/* Successfully decomposed. */
if
(
recompose
)
{
/* XXX handle singleton decompositions */
/* Try composing b with base if not blocked */
bool
has_a
=
hb_font_get_glyph
(
c
->
font
,
a
,
0
,
&
glyph
);
if
(
shortest
&&
has_a
)
{
/* Output a and b */
c
->
buffer
->
output_glyph
(
a
);
c
->
buffer
->
output_glyph
(
b
);
return
TRUE
;
}
}
if
(
decompose
(
c
,
shortest
,
a
))
{
c
->
buffer
->
output_glyph
(
b
);
return
TRUE
;
}
if
(
has_a
)
{
c
->
buffer
->
output_glyph
(
a
);
c
->
buffer
->
output_glyph
(
b
);
return
TRUE
;
return
TRUE
;
}
}
return
has_this
;
return
FALSE
;
}
}
static
bool
static
void
decompose_single_char_cluster
(
hb_ot_shape_context_t
*
c
,
decompose_current_glyph
(
hb_ot_shape_context_t
*
c
,
bool
recompose
,
bool
shortest
)
unsigned
int
i
)
{
{
// c->buffer->copy ();
if
(
decompose
(
c
,
shortest
,
c
->
buffer
->
info
[
c
->
buffer
->
idx
].
codepoint
))
// bool ret = decompose (c, recompose, c->buffer->info[i].codepoint);
c
->
buffer
->
skip_glyph
();
// c->buffer->skip ();
else
// return ret;
c
->
buffer
->
next_glyph
();
return
FALSE
;
}
}
static
void
static
void
handle_single_char_cluster
(
hb_ot_shape_context_t
*
c
,
decompose_single_char_cluster
(
hb_ot_shape_context_t
*
c
,
bool
recompose
,
bool
will_recompose
)
unsigned
int
i
)
{
{
/* Decompose */
hb_codepoint_t
glyph
;
decompose_single_char_cluster
(
c
,
recompose
,
i
);
/* If recomposing and font supports this, we're good to go */
if
(
will_recompose
&&
hb_font_get_glyph
(
c
->
font
,
c
->
buffer
->
info
[
c
->
buffer
->
idx
].
codepoint
,
0
,
&
glyph
))
{
c
->
buffer
->
next_glyph
();
return
;
}
decompose_current_glyph
(
c
,
will_recompose
);
}
}
static
void
static
void
handle_multi_char_cluster
(
hb_ot_shape_context_t
*
c
,
decompose_multi_char_cluster
(
hb_ot_shape_context_t
*
c
,
bool
recompose
,
unsigned
int
end
)
unsigned
int
start
,
unsigned
int
end
)
{
{
/* TODO Currently if there's a variation-selector we give-up, it's just too hard. */
/* TODO Currently if there's a variation-selector we give-up, it's just too hard. */
for
(
unsigned
int
i
=
start
;
i
<
end
;
i
++
)
for
(
unsigned
int
i
=
c
->
buffer
->
idx
;
i
<
end
;
i
++
)
if
(
unlikely
(
is_variation_selector
(
c
->
buffer
->
info
[
i
].
codepoint
)))
if
(
unlikely
(
is_variation_selector
(
c
->
buffer
->
info
[
i
].
codepoint
)))
return
;
return
;
while
(
c
->
buffer
->
idx
<
end
)
decompose_current_glyph
(
c
,
FALSE
);
}
}
void
void
...
@@ -132,27 +141,45 @@ _hb_ot_shape_normalize (hb_ot_shape_context_t *c)
...
@@ -132,27 +141,45 @@ _hb_ot_shape_normalize (hb_ot_shape_context_t *c)
{
{
hb_buffer_t
*
buffer
=
c
->
buffer
;
hb_buffer_t
*
buffer
=
c
->
buffer
;
bool
recompose
=
!
hb_ot_shape_complex_prefer_decomposed
(
c
->
plan
->
shaper
);
bool
recompose
=
!
hb_ot_shape_complex_prefer_decomposed
(
c
->
plan
->
shaper
);
bool
has_multichar_clusters
=
FALSE
;
buffer
->
clear_output
();
buffer
->
clear_output
();
/* First round, decompose */
unsigned
int
count
=
buffer
->
len
;
unsigned
int
count
=
buffer
->
len
;
for
(
buffer
->
idx
=
0
;
buffer
->
idx
<
count
;)
for
(
buffer
->
idx
=
0
;
buffer
->
idx
<
count
;)
{
{
unsigned
int
end
;
unsigned
int
end
;
for
(
end
=
buffer
->
idx
+
1
;
end
<
count
;
end
++
)
for
(
end
=
buffer
->
idx
+
1
;
end
<
count
;
end
++
)
if
(
buffer
->
info
[
buffer
->
idx
].
cluster
!=
buffer
->
info
[
end
].
cluster
)
if
(
buffer
->
info
[
buffer
->
idx
].
cluster
!=
buffer
->
info
[
end
].
cluster
)
break
;
break
;
if
(
buffer
->
idx
+
1
==
end
)
if
(
buffer
->
idx
+
1
==
end
)
handle_single_char_cluster
(
c
,
recompose
,
buffer
->
idx
);
decompose_single_char_cluster
(
c
,
recompose
);
else
else
{
handle_multi_char_cluster
(
c
,
recompose
,
buffer
->
idx
,
end
);
decompose_multi_char_cluster
(
c
,
end
);
while
(
buffer
->
idx
<
end
)
has_multichar_clusters
=
TRUE
;
c
->
buffer
->
next_glyph
();
}
}
}
buffer
->
swap_buffers
();
buffer
->
swap_buffers
();
/* Technically speaking, two characters with ccc=0 may combine. But all
* those cases are in languages that the indic module handles (which expects
* decomposed), or in Hangul jamo, which again, we want decomposed anyway.
* So we don't bother combining across cluster boundaries. */
if
(
!
has_multichar_clusters
)
return
;
/* Done! */
/* Second round, reorder (inplace) */
/* Third round, recompose */
if
(
recompose
)
{
}
}
}
HB_END_DECLS
HB_END_DECLS
src/hb-ot-shape.cc
浏览文件 @
4ff0d2d9
...
@@ -208,7 +208,6 @@ hb_ensure_native_direction (hb_buffer_t *buffer)
...
@@ -208,7 +208,6 @@ hb_ensure_native_direction (hb_buffer_t *buffer)
if
((
HB_DIRECTION_IS_HORIZONTAL
(
direction
)
&&
direction
!=
hb_script_get_horizontal_direction
(
buffer
->
props
.
script
))
||
if
((
HB_DIRECTION_IS_HORIZONTAL
(
direction
)
&&
direction
!=
hb_script_get_horizontal_direction
(
buffer
->
props
.
script
))
||
(
HB_DIRECTION_IS_VERTICAL
(
direction
)
&&
direction
!=
HB_DIRECTION_TTB
))
(
HB_DIRECTION_IS_VERTICAL
(
direction
)
&&
direction
!=
HB_DIRECTION_TTB
))
{
{
hb_form_clusters
(
buffer
);
hb_buffer_reverse_clusters
(
buffer
);
hb_buffer_reverse_clusters
(
buffer
);
buffer
->
props
.
direction
=
HB_DIRECTION_REVERSE
(
buffer
->
props
.
direction
);
buffer
->
props
.
direction
=
HB_DIRECTION_REVERSE
(
buffer
->
props
.
direction
);
}
}
...
@@ -358,6 +357,8 @@ hb_ot_shape_execute_internal (hb_ot_shape_context_t *c)
...
@@ -358,6 +357,8 @@ hb_ot_shape_execute_internal (hb_ot_shape_context_t *c)
hb_set_unicode_props
(
c
->
buffer
);
/* BUFFER: Set general_category and combining_class in var1 */
hb_set_unicode_props
(
c
->
buffer
);
/* BUFFER: Set general_category and combining_class in var1 */
hb_form_clusters
(
c
->
buffer
);
hb_ensure_native_direction
(
c
->
buffer
);
hb_ensure_native_direction
(
c
->
buffer
);
_hb_ot_shape_normalize
(
c
);
_hb_ot_shape_normalize
(
c
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录