Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
eba312c8
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,发现更多精彩内容 >>
提交
eba312c8
编写于
11月 16, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Plumbing to get shape plan and font into complex decompose function
So we can handle Sinhala split matras smartly... Coming soon.
上级
3f82f8ff
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
61 addition
and
55 deletion
+61
-55
src/hb-ot-shape-complex-default.cc
src/hb-ot-shape-complex-default.cc
+3
-3
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+7
-7
src/hb-ot-shape-complex-private.hh
src/hb-ot-shape-complex-private.hh
+8
-8
src/hb-ot-shape-normalize-private.hh
src/hb-ot-shape-normalize-private.hh
+20
-2
src/hb-ot-shape-normalize.cc
src/hb-ot-shape-normalize.cc
+22
-34
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+1
-1
未找到文件。
src/hb-ot-shape-complex-default.cc
浏览文件 @
eba312c8
...
@@ -83,8 +83,8 @@ normalization_preference_default (const hb_segment_properties_t *props)
...
@@ -83,8 +83,8 @@ normalization_preference_default (const hb_segment_properties_t *props)
return
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
;
return
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
;
}
}
static
hb_bool_t
static
bool
compose_default
(
hb_unicode_funcs_t
*
unicode
,
compose_default
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
a
,
hb_codepoint_t
a
,
hb_codepoint_t
b
,
hb_codepoint_t
b
,
hb_codepoint_t
*
ab
)
hb_codepoint_t
*
ab
)
...
@@ -123,7 +123,7 @@ compose_default (hb_unicode_funcs_t *unicode,
...
@@ -123,7 +123,7 @@ compose_default (hb_unicode_funcs_t *unicode,
0xFB4A
// TAV
0xFB4A
// TAV
};
};
hb_bool_t
found
=
unicode
->
compose
(
a
,
b
,
ab
);
bool
found
=
c
->
unicode
->
compose
(
a
,
b
,
ab
);
if
(
!
found
&&
(
b
&
~
0x7F
)
==
0x0580
)
{
if
(
!
found
&&
(
b
&
~
0x7F
)
==
0x0580
)
{
// special-case Hebrew presentation forms that are excluded from
// special-case Hebrew presentation forms that are excluded from
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
eba312c8
...
@@ -1278,8 +1278,8 @@ normalization_preference_indic (const hb_segment_properties_t *props)
...
@@ -1278,8 +1278,8 @@ normalization_preference_indic (const hb_segment_properties_t *props)
return
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT
;
return
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT
;
}
}
static
hb_bool_t
static
bool
decompose_indic
(
hb_unicode_funcs_t
*
unicode
,
decompose_indic
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
ab
,
hb_codepoint_t
ab
,
hb_codepoint_t
*
a
,
hb_codepoint_t
*
a
,
hb_codepoint_t
*
b
)
hb_codepoint_t
*
b
)
...
@@ -1328,23 +1328,23 @@ decompose_indic (hb_unicode_funcs_t *unicode,
...
@@ -1328,23 +1328,23 @@ decompose_indic (hb_unicode_funcs_t *unicode,
case
0x0DDE
:
*
a
=
0x0DD9
;
*
b
=
0x0DDE
;
return
true
;
case
0x0DDE
:
*
a
=
0x0DD9
;
*
b
=
0x0DDE
;
return
true
;
}
}
return
unicode
->
decompose
(
ab
,
a
,
b
);
return
c
->
unicode
->
decompose
(
ab
,
a
,
b
);
}
}
static
hb_bool_t
static
bool
compose_indic
(
hb_unicode_funcs_t
*
unicode
,
compose_indic
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
a
,
hb_codepoint_t
a
,
hb_codepoint_t
b
,
hb_codepoint_t
b
,
hb_codepoint_t
*
ab
)
hb_codepoint_t
*
ab
)
{
{
/* Avoid recomposing split matras. */
/* Avoid recomposing split matras. */
if
(
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
unicode
->
general_category
(
a
)))
if
(
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
c
->
unicode
->
general_category
(
a
)))
return
false
;
return
false
;
/* Composition-exclusion exceptions that we want to recompose. */
/* Composition-exclusion exceptions that we want to recompose. */
if
(
a
==
0x09AF
&&
b
==
0x09BC
)
{
*
ab
=
0x09DF
;
return
true
;
}
if
(
a
==
0x09AF
&&
b
==
0x09BC
)
{
*
ab
=
0x09DF
;
return
true
;
}
return
unicode
->
compose
(
a
,
b
,
ab
);
return
c
->
unicode
->
compose
(
a
,
b
,
ab
);
}
}
...
...
src/hb-ot-shape-complex-private.hh
浏览文件 @
eba312c8
...
@@ -106,7 +106,7 @@ struct hb_ot_complex_shaper_t
...
@@ -106,7 +106,7 @@ struct hb_ot_complex_shaper_t
* Called during shape()'s normalization.
* Called during shape()'s normalization.
* May be NULL.
* May be NULL.
*/
*/
hb_bool_t
(
*
decompose
)
(
hb_unicode_funcs_t
*
unicode
,
bool
(
*
decompose
)
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
ab
,
hb_codepoint_t
ab
,
hb_codepoint_t
*
a
,
hb_codepoint_t
*
a
,
hb_codepoint_t
*
b
);
hb_codepoint_t
*
b
);
...
@@ -115,7 +115,7 @@ struct hb_ot_complex_shaper_t
...
@@ -115,7 +115,7 @@ struct hb_ot_complex_shaper_t
* Called during shape()'s normalization.
* Called during shape()'s normalization.
* May be NULL.
* May be NULL.
*/
*/
hb_bool_t
(
*
compose
)
(
hb_unicode_funcs_t
*
unicode
,
bool
(
*
compose
)
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
a
,
hb_codepoint_t
a
,
hb_codepoint_t
b
,
hb_codepoint_t
b
,
hb_codepoint_t
*
ab
);
hb_codepoint_t
*
ab
);
...
...
src/hb-ot-shape-normalize-private.hh
浏览文件 @
eba312c8
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
/* buffer var allocations, used during the normalization process */
/* buffer var allocations, used during the normalization process */
#define glyph_index() var1.u32
#define glyph_index() var1.u32
struct
hb_ot_
complex_shaper
_t
;
struct
hb_ot_
shape_plan
_t
;
enum
hb_ot_shape_normalization_mode_t
{
enum
hb_ot_shape_normalization_mode_t
{
HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED
,
HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED
,
...
@@ -46,8 +46,26 @@ enum hb_ot_shape_normalization_mode_t {
...
@@ -46,8 +46,26 @@ enum hb_ot_shape_normalization_mode_t {
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT
=
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT
=
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
};
};
HB_INTERNAL
void
_hb_ot_shape_normalize
(
const
hb_ot_
complex_shaper
_t
*
shaper
,
HB_INTERNAL
void
_hb_ot_shape_normalize
(
const
hb_ot_
shape_plan
_t
*
shaper
,
hb_buffer_t
*
buffer
,
hb_buffer_t
*
buffer
,
hb_font_t
*
font
);
hb_font_t
*
font
);
struct
hb_ot_shape_normalize_context_t
{
const
hb_ot_shape_plan_t
*
plan
;
hb_buffer_t
*
buffer
;
hb_font_t
*
font
;
hb_unicode_funcs_t
*
unicode
;
bool
(
*
decompose
)
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
ab
,
hb_codepoint_t
*
a
,
hb_codepoint_t
*
b
);
bool
(
*
compose
)
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
a
,
hb_codepoint_t
b
,
hb_codepoint_t
*
ab
);
};
#endif
/* HB_OT_SHAPE_NORMALIZE_PRIVATE_HH */
#endif
/* HB_OT_SHAPE_NORMALIZE_PRIVATE_HH */
src/hb-ot-shape-normalize.cc
浏览文件 @
eba312c8
...
@@ -82,22 +82,22 @@
...
@@ -82,22 +82,22 @@
* egrep "`echo -n ';('; grep ';<' UnicodeData.txt | cut -d';' -f1 | tr '\n' '|'; echo ') '`" UnicodeData.txt
* egrep "`echo -n ';('; grep ';<' UnicodeData.txt | cut -d';' -f1 | tr '\n' '|'; echo ') '`" UnicodeData.txt
*/
*/
static
hb_bool_t
static
bool
decompose_unicode
(
hb_unicode_funcs_t
*
unicode
,
decompose_unicode
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
ab
,
hb_codepoint_t
ab
,
hb_codepoint_t
*
a
,
hb_codepoint_t
*
a
,
hb_codepoint_t
*
b
)
hb_codepoint_t
*
b
)
{
{
return
unicode
->
decompose
(
ab
,
a
,
b
);
return
c
->
unicode
->
decompose
(
ab
,
a
,
b
);
}
}
static
hb_bool_t
static
bool
compose_unicode
(
hb_unicode_funcs_t
*
unicode
,
compose_unicode
(
const
hb_ot_shape_normalize_context_t
*
c
,
hb_codepoint_t
a
,
hb_codepoint_t
a
,
hb_codepoint_t
b
,
hb_codepoint_t
b
,
hb_codepoint_t
*
ab
)
hb_codepoint_t
*
ab
)
{
{
return
unicode
->
compose
(
a
,
b
,
ab
);
return
c
->
unicode
->
compose
(
a
,
b
,
ab
);
}
}
static
inline
void
static
inline
void
...
@@ -127,27 +127,13 @@ skip_char (hb_buffer_t *buffer)
...
@@ -127,27 +127,13 @@ skip_char (hb_buffer_t *buffer)
buffer
->
skip_glyph
();
buffer
->
skip_glyph
();
}
}
struct
normalize_context_t
{
hb_buffer_t
*
buffer
;
hb_font_t
*
font
;
hb_bool_t
(
*
decompose
)
(
hb_unicode_funcs_t
*
unicode
,
hb_codepoint_t
ab
,
hb_codepoint_t
*
a
,
hb_codepoint_t
*
b
);
hb_bool_t
(
*
compose
)
(
hb_unicode_funcs_t
*
unicode
,
hb_codepoint_t
a
,
hb_codepoint_t
b
,
hb_codepoint_t
*
ab
);
};
/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
static
inline
unsigned
int
static
inline
unsigned
int
decompose
(
const
normalize_context_t
*
c
,
bool
shortest
,
hb_codepoint_t
ab
)
decompose
(
const
hb_ot_shape_
normalize_context_t
*
c
,
bool
shortest
,
hb_codepoint_t
ab
)
{
{
hb_codepoint_t
a
,
b
,
a_glyph
,
b_glyph
;
hb_codepoint_t
a
,
b
,
a_glyph
,
b_glyph
;
if
(
!
c
->
decompose
(
c
->
buffer
->
unicode
,
ab
,
&
a
,
&
b
)
||
if
(
!
c
->
decompose
(
c
,
ab
,
&
a
,
&
b
)
||
(
b
&&
!
c
->
font
->
get_glyph
(
b
,
0
,
&
b_glyph
)))
(
b
&&
!
c
->
font
->
get_glyph
(
b
,
0
,
&
b_glyph
)))
return
0
;
return
0
;
...
@@ -185,7 +171,7 @@ decompose (const normalize_context_t *c, bool shortest, hb_codepoint_t ab)
...
@@ -185,7 +171,7 @@ decompose (const normalize_context_t *c, bool shortest, hb_codepoint_t ab)
/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
static
inline
bool
static
inline
bool
decompose_compatibility
(
const
normalize_context_t
*
c
,
hb_codepoint_t
u
)
decompose_compatibility
(
const
hb_ot_shape_
normalize_context_t
*
c
,
hb_codepoint_t
u
)
{
{
unsigned
int
len
,
i
;
unsigned
int
len
,
i
;
hb_codepoint_t
decomposed
[
HB_UNICODE_MAX_DECOMPOSITION_LEN
];
hb_codepoint_t
decomposed
[
HB_UNICODE_MAX_DECOMPOSITION_LEN
];
...
@@ -207,7 +193,7 @@ decompose_compatibility (const normalize_context_t *c, hb_codepoint_t u)
...
@@ -207,7 +193,7 @@ decompose_compatibility (const normalize_context_t *c, hb_codepoint_t u)
/* Returns true if recomposition may be benefitial. */
/* Returns true if recomposition may be benefitial. */
static
inline
bool
static
inline
bool
decompose_current_character
(
const
normalize_context_t
*
c
,
bool
shortest
)
decompose_current_character
(
const
hb_ot_shape_
normalize_context_t
*
c
,
bool
shortest
)
{
{
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
hb_codepoint_t
glyph
;
hb_codepoint_t
glyph
;
...
@@ -233,7 +219,7 @@ decompose_current_character (const normalize_context_t *c, bool shortest)
...
@@ -233,7 +219,7 @@ decompose_current_character (const normalize_context_t *c, bool shortest)
}
}
static
inline
void
static
inline
void
handle_variation_selector_cluster
(
const
normalize_context_t
*
c
,
unsigned
int
end
)
handle_variation_selector_cluster
(
const
hb_ot_shape_
normalize_context_t
*
c
,
unsigned
int
end
)
{
{
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
for
(;
buffer
->
idx
<
end
-
1
;)
{
for
(;
buffer
->
idx
<
end
-
1
;)
{
...
@@ -254,7 +240,7 @@ handle_variation_selector_cluster (const normalize_context_t *c, unsigned int en
...
@@ -254,7 +240,7 @@ handle_variation_selector_cluster (const normalize_context_t *c, unsigned int en
/* Returns true if recomposition may be benefitial. */
/* Returns true if recomposition may be benefitial. */
static
inline
bool
static
inline
bool
decompose_multi_char_cluster
(
const
normalize_context_t
*
c
,
unsigned
int
end
)
decompose_multi_char_cluster
(
const
hb_ot_shape_
normalize_context_t
*
c
,
unsigned
int
end
)
{
{
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
/* 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. */
...
@@ -272,7 +258,7 @@ decompose_multi_char_cluster (const normalize_context_t *c, unsigned int end)
...
@@ -272,7 +258,7 @@ decompose_multi_char_cluster (const normalize_context_t *c, unsigned int end)
}
}
static
inline
bool
static
inline
bool
decompose_cluster
(
const
normalize_context_t
*
c
,
bool
short_circuit
,
unsigned
int
end
)
decompose_cluster
(
const
hb_ot_shape_
normalize_context_t
*
c
,
bool
short_circuit
,
unsigned
int
end
)
{
{
if
(
likely
(
c
->
buffer
->
idx
+
1
==
end
))
if
(
likely
(
c
->
buffer
->
idx
+
1
==
end
))
return
decompose_current_character
(
c
,
short_circuit
);
return
decompose_current_character
(
c
,
short_circuit
);
...
@@ -292,18 +278,20 @@ compare_combining_class (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
...
@@ -292,18 +278,20 @@ compare_combining_class (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
void
void
_hb_ot_shape_normalize
(
const
hb_ot_
complex_shaper_t
*
shaper
,
_hb_ot_shape_normalize
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_buffer_t
*
buffer
,
hb_buffer_t
*
buffer
,
hb_font_t
*
font
)
hb_font_t
*
font
)
{
{
hb_ot_shape_normalization_mode_t
mode
=
shaper
->
normalization_preference
?
hb_ot_shape_normalization_mode_t
mode
=
plan
->
shaper
->
normalization_preference
?
shaper
->
normalization_preference
(
&
buffer
->
props
)
:
plan
->
shaper
->
normalization_preference
(
&
buffer
->
props
)
:
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT
;
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT
;
const
normalize_context_t
c
=
{
const
hb_ot_shape_normalize_context_t
c
=
{
plan
,
buffer
,
buffer
,
font
,
font
,
shaper
->
decompose
?
shaper
->
decompose
:
decompose_unicode
,
buffer
->
unicode
,
shaper
->
compose
?
shaper
->
compose
:
compose_unicode
plan
->
shaper
->
decompose
?
plan
->
shaper
->
decompose
:
decompose_unicode
,
plan
->
shaper
->
compose
?
plan
->
shaper
->
compose
:
compose_unicode
};
};
bool
short_circuit
=
mode
!=
HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED
&&
bool
short_circuit
=
mode
!=
HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED
&&
...
@@ -389,7 +377,7 @@ _hb_ot_shape_normalize (const hb_ot_complex_shaper_t *shaper,
...
@@ -389,7 +377,7 @@ _hb_ot_shape_normalize (const hb_ot_complex_shaper_t *shaper,
(
starter
==
buffer
->
out_len
-
1
||
(
starter
==
buffer
->
out_len
-
1
||
_hb_glyph_info_get_modified_combining_class
(
&
buffer
->
prev
())
<
_hb_glyph_info_get_modified_combining_class
(
&
buffer
->
cur
()))
&&
_hb_glyph_info_get_modified_combining_class
(
&
buffer
->
prev
())
<
_hb_glyph_info_get_modified_combining_class
(
&
buffer
->
cur
()))
&&
/* And compose. */
/* And compose. */
c
.
compose
(
buffer
->
unicode
,
c
.
compose
(
&
c
,
buffer
->
out_info
[
starter
].
codepoint
,
buffer
->
out_info
[
starter
].
codepoint
,
buffer
->
cur
().
codepoint
,
buffer
->
cur
().
codepoint
,
&
composed
)
&&
&
composed
)
&&
...
...
src/hb-ot-shape.cc
浏览文件 @
eba312c8
...
@@ -362,7 +362,7 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c)
...
@@ -362,7 +362,7 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c)
HB_BUFFER_ALLOCATE_VAR
(
c
->
buffer
,
glyph_index
);
HB_BUFFER_ALLOCATE_VAR
(
c
->
buffer
,
glyph_index
);
_hb_ot_shape_normalize
(
c
->
plan
->
shaper
,
c
->
buffer
,
c
->
font
);
_hb_ot_shape_normalize
(
c
->
plan
,
c
->
buffer
,
c
->
font
);
hb_ot_shape_setup_masks
(
c
);
hb_ot_shape_setup_masks
(
c
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录