Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
62d1e085
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看板
提交
62d1e085
编写于
9月 23, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prefer decomposed form if font has GPOS mark feature
Fixes
https://github.com/harfbuzz/harfbuzz/issues/653
上级
d7f21777
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
72 addition
and
63 deletion
+72
-63
src/hb-ot-shape-complex-hebrew.cc
src/hb-ot-shape-complex-hebrew.cc
+1
-1
src/hb-ot-shape-normalize.cc
src/hb-ot-shape-normalize.cc
+67
-59
src/hb-ot-shape-normalize.hh
src/hb-ot-shape-normalize.hh
+4
-3
未找到文件。
src/hb-ot-shape-complex-hebrew.cc
浏览文件 @
62d1e085
...
...
@@ -70,7 +70,7 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c,
bool
found
=
(
bool
)
c
->
unicode
->
compose
(
a
,
b
,
ab
);
if
(
!
found
&&
!
c
->
plan
->
has_mark
)
if
(
!
found
)
{
/* Special-case Hebrew presentation forms that are excluded from
* standard normalization, but wanted for old fonts. */
...
...
src/hb-ot-shape-normalize.cc
浏览文件 @
62d1e085
...
...
@@ -294,6 +294,14 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
_hb_buffer_assert_unicode_vars
(
buffer
);
hb_ot_shape_normalization_mode_t
mode
=
plan
->
shaper
->
normalization_preference
;
if
(
mode
==
HB_OT_SHAPE_NORMALIZATION_MODE_AUTO
)
{
if
(
plan
->
has_mark
)
mode
=
HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED
;
else
mode
=
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
;
}
const
hb_ot_shape_normalize_context_t
c
=
{
plan
,
buffer
,
...
...
@@ -358,65 +366,6 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
i
=
end
;
}
if
(
mode
==
HB_OT_SHAPE_NORMALIZATION_MODE_NONE
||
mode
==
HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED
)
return
;
/* Third round, recompose */
/* As noted in the comment earlier, we don't try to combine
* ccc=0 chars with their previous Starter. */
buffer
->
clear_output
();
count
=
buffer
->
len
;
unsigned
int
starter
=
0
;
buffer
->
next_glyph
();
while
(
buffer
->
idx
<
count
&&
buffer
->
successful
)
{
hb_codepoint_t
composed
,
glyph
;
if
(
/* We don't try to compose a non-mark character with it's preceding starter.
* This is both an optimization to avoid trying to compose every two neighboring
* glyphs in most scripts AND a desired feature for Hangul. Apparently Hangul
* fonts are not designed to mix-and-match pre-composed syllables and Jamo. */
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
_hb_glyph_info_get_general_category
(
&
buffer
->
cur
())))
{
if
(
/* If there's anything between the starter and this char, they should have CCC
* smaller than this character's. */
(
starter
==
buffer
->
out_len
-
1
||
info_cc
(
buffer
->
prev
())
<
info_cc
(
buffer
->
cur
()))
&&
/* And compose. */
c
.
compose
(
&
c
,
buffer
->
out_info
[
starter
].
codepoint
,
buffer
->
cur
().
codepoint
,
&
composed
)
&&
/* And the font has glyph for the composite. */
font
->
get_nominal_glyph
(
composed
,
&
glyph
))
{
/* Composes. */
buffer
->
next_glyph
();
/* Copy to out-buffer. */
if
(
unlikely
(
!
buffer
->
successful
))
return
;
buffer
->
merge_out_clusters
(
starter
,
buffer
->
out_len
);
buffer
->
out_len
--
;
/* Remove the second composable. */
/* Modify starter and carry on. */
buffer
->
out_info
[
starter
].
codepoint
=
composed
;
buffer
->
out_info
[
starter
].
glyph_index
()
=
glyph
;
_hb_glyph_info_set_unicode_props
(
&
buffer
->
out_info
[
starter
],
buffer
);
continue
;
}
}
/* Blocked, or doesn't compose. */
buffer
->
next_glyph
();
if
(
info_cc
(
buffer
->
prev
())
==
0
)
starter
=
buffer
->
out_len
-
1
;
}
buffer
->
swap_buffers
();
if
(
buffer
->
scratch_flags
&
HB_BUFFER_SCRATCH_FLAG_HAS_CGJ
)
{
/* For all CGJ, check if it prevented any reordering at all.
...
...
@@ -430,4 +379,63 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
_hb_glyph_info_unhide
(
&
buffer
->
info
[
i
]);
}
}
/* Third round, recompose */
if
(
mode
==
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
||
mode
==
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT
)
return
;
{
/* As noted in the comment earlier, we don't try to combine
* ccc=0 chars with their previous Starter. */
buffer
->
clear_output
();
count
=
buffer
->
len
;
unsigned
int
starter
=
0
;
buffer
->
next_glyph
();
while
(
buffer
->
idx
<
count
&&
buffer
->
successful
)
{
hb_codepoint_t
composed
,
glyph
;
if
(
/* We don't try to compose a non-mark character with it's preceding starter.
* This is both an optimization to avoid trying to compose every two neighboring
* glyphs in most scripts AND a desired feature for Hangul. Apparently Hangul
* fonts are not designed to mix-and-match pre-composed syllables and Jamo. */
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
_hb_glyph_info_get_general_category
(
&
buffer
->
cur
())))
{
if
(
/* If there's anything between the starter and this char, they should have CCC
* smaller than this character's. */
(
starter
==
buffer
->
out_len
-
1
||
info_cc
(
buffer
->
prev
())
<
info_cc
(
buffer
->
cur
()))
&&
/* And compose. */
c
.
compose
(
&
c
,
buffer
->
out_info
[
starter
].
codepoint
,
buffer
->
cur
().
codepoint
,
&
composed
)
&&
/* And the font has glyph for the composite. */
font
->
get_nominal_glyph
(
composed
,
&
glyph
))
{
/* Composes. */
buffer
->
next_glyph
();
/* Copy to out-buffer. */
if
(
unlikely
(
!
buffer
->
successful
))
return
;
buffer
->
merge_out_clusters
(
starter
,
buffer
->
out_len
);
buffer
->
out_len
--
;
/* Remove the second composable. */
/* Modify starter and carry on. */
buffer
->
out_info
[
starter
].
codepoint
=
composed
;
buffer
->
out_info
[
starter
].
glyph_index
()
=
glyph
;
_hb_glyph_info_set_unicode_props
(
&
buffer
->
out_info
[
starter
],
buffer
);
continue
;
}
}
/* Blocked, or doesn't compose. */
buffer
->
next_glyph
();
if
(
info_cc
(
buffer
->
prev
())
==
0
)
starter
=
buffer
->
out_len
-
1
;
}
buffer
->
swap_buffers
();
}
}
src/hb-ot-shape-normalize.hh
浏览文件 @
62d1e085
...
...
@@ -38,10 +38,11 @@ struct hb_ot_shape_plan_t;
enum
hb_ot_shape_normalization_mode_t
{
HB_OT_SHAPE_NORMALIZATION_MODE_NONE
,
HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED
,
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
,
/*
n
ever composes base-to-base */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT
,
/*
a
lways fully decomposes and then recompose back */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
,
/*
N
ever composes base-to-base */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT
,
/*
A
lways fully decomposes and then recompose back */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT
=
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
HB_OT_SHAPE_NORMALIZATION_MODE_AUTO
,
/* Choose decomposed if GPOS mark feature available, compose otherwise. */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT
=
HB_OT_SHAPE_NORMALIZATION_MODE_AUTO
};
HB_INTERNAL
void
_hb_ot_shape_normalize
(
const
hb_ot_shape_plan_t
*
shaper
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录