Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
7cd33f23
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
7cd33f23
编写于
7月 17, 2014
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Micro optimization
上级
164c13d7
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
78 addition
and
54 deletion
+78
-54
src/hb-fallback-shape.cc
src/hb-fallback-shape.cc
+19
-17
src/hb-ot-shape-complex-arabic.cc
src/hb-ot-shape-complex-arabic.cc
+11
-8
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+10
-5
src/hb-ot-shape-complex-myanmar.cc
src/hb-ot-shape-complex-myanmar.cc
+5
-2
src/hb-ot-shape-complex-sea.cc
src/hb-ot-shape-complex-sea.cc
+5
-2
src/hb-ot-shape-fallback.cc
src/hb-ot-shape-fallback.cc
+16
-14
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+12
-6
未找到文件。
src/hb-fallback-shape.cc
浏览文件 @
7cd33f23
...
...
@@ -105,34 +105,36 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
* shaper which many people unfortunately still request.
*/
bool
has_space
;
hb_codepoint_t
space
;
has_space
=
font
->
get_glyph
(
' '
,
0
,
&
space
);
bool
has_space
=
font
->
get_glyph
(
' '
,
0
,
&
space
);
buffer
->
clear_positions
();
hb_direction_t
direction
=
buffer
->
props
.
direction
;
hb_unicode_funcs_t
*
unicode
=
buffer
->
unicode
;
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
hb_glyph_position_t
*
pos
=
buffer
->
pos
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
if
(
has_space
&&
buffer
->
unicode
->
is_default_ignorable
(
buffer
->
info
[
i
].
codepoint
))
{
buffer
->
info
[
i
].
codepoint
=
space
;
buffer
->
pos
[
i
].
x_advance
=
0
;
buffer
->
pos
[
i
].
y_advance
=
0
;
if
(
has_space
&&
unicode
->
is_default_ignorable
(
info
[
i
].
codepoint
))
{
info
[
i
].
codepoint
=
space
;
pos
[
i
].
x_advance
=
0
;
pos
[
i
].
y_advance
=
0
;
continue
;
}
font
->
get_glyph
(
buffer
->
info
[
i
].
codepoint
,
0
,
&
buffer
->
info
[
i
].
codepoint
);
font
->
get_glyph_advance_for_direction
(
buffer
->
info
[
i
].
codepoint
,
buffer
->
props
.
direction
,
&
buffer
->
pos
[
i
].
x_advance
,
&
buffer
->
pos
[
i
].
y_advance
);
font
->
subtract_glyph_origin_for_direction
(
buffer
->
info
[
i
].
codepoint
,
buffer
->
props
.
direction
,
&
buffer
->
pos
[
i
].
x_offset
,
&
buffer
->
pos
[
i
].
y_offset
);
font
->
get_glyph
(
info
[
i
].
codepoint
,
0
,
&
info
[
i
].
codepoint
);
font
->
get_glyph_advance_for_direction
(
info
[
i
].
codepoint
,
direction
,
&
pos
[
i
].
x_advance
,
&
pos
[
i
].
y_advance
);
font
->
subtract_glyph_origin_for_direction
(
info
[
i
].
codepoint
,
direction
,
&
pos
[
i
].
x_offset
,
&
pos
[
i
].
y_offset
);
}
if
(
HB_DIRECTION_IS_BACKWARD
(
buffer
->
props
.
direction
))
if
(
HB_DIRECTION_IS_BACKWARD
(
direction
))
hb_buffer_reverse
(
buffer
);
return
true
;
...
...
src/hb-ot-shape-complex-arabic.cc
浏览文件 @
7cd33f23
...
...
@@ -223,6 +223,7 @@ static void
arabic_joining
(
hb_buffer_t
*
buffer
)
{
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
unsigned
int
prev
=
(
unsigned
int
)
-
1
,
state
=
0
;
/* Check pre-context */
...
...
@@ -241,19 +242,19 @@ arabic_joining (hb_buffer_t *buffer)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
unsigned
int
this_type
=
get_joining_type
(
buffer
->
info
[
i
].
codepoint
,
_hb_glyph_info_get_general_category
(
&
buffer
->
info
[
i
]));
unsigned
int
this_type
=
get_joining_type
(
info
[
i
].
codepoint
,
_hb_glyph_info_get_general_category
(
&
info
[
i
]));
if
(
unlikely
(
this_type
==
JOINING_TYPE_T
))
{
buffer
->
info
[
i
].
arabic_shaping_action
()
=
NONE
;
info
[
i
].
arabic_shaping_action
()
=
NONE
;
continue
;
}
const
arabic_state_table_entry
*
entry
=
&
arabic_state_table
[
state
][
this_type
];
if
(
entry
->
prev_action
!=
NONE
&&
prev
!=
(
unsigned
int
)
-
1
)
buffer
->
info
[
prev
].
arabic_shaping_action
()
=
entry
->
prev_action
;
info
[
prev
].
arabic_shaping_action
()
=
entry
->
prev_action
;
buffer
->
info
[
i
].
arabic_shaping_action
()
=
entry
->
curr_action
;
info
[
i
].
arabic_shaping_action
()
=
entry
->
curr_action
;
prev
=
i
;
state
=
entry
->
next_state
;
...
...
@@ -269,7 +270,7 @@ arabic_joining (hb_buffer_t *buffer)
const
arabic_state_table_entry
*
entry
=
&
arabic_state_table
[
state
][
this_type
];
if
(
entry
->
prev_action
!=
NONE
&&
prev
!=
(
unsigned
int
)
-
1
)
buffer
->
info
[
prev
].
arabic_shaping_action
()
=
entry
->
prev_action
;
info
[
prev
].
arabic_shaping_action
()
=
entry
->
prev_action
;
break
;
}
}
...
...
@@ -299,8 +300,9 @@ setup_masks_arabic (const hb_ot_shape_plan_t *plan,
mongolian_variation_selectors
(
buffer
);
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
buffer
->
info
[
i
].
mask
|=
arabic_plan
->
mask_array
[
buffer
->
info
[
i
].
arabic_shaping_action
()];
info
[
i
].
mask
|=
arabic_plan
->
mask_array
[
info
[
i
].
arabic_shaping_action
()];
HB_BUFFER_DEALLOCATE_VAR
(
buffer
,
arabic_shaping_action
);
}
...
...
@@ -312,9 +314,10 @@ nuke_joiners (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_buffer_t
*
buffer
)
{
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
_hb_glyph_info_is_zwj
(
&
buffer
->
info
[
i
]))
_hb_glyph_info_flip_joiners
(
&
buffer
->
info
[
i
]);
if
(
_hb_glyph_info_is_zwj
(
&
info
[
i
]))
_hb_glyph_info_flip_joiners
(
&
info
[
i
]);
}
static
void
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
7cd33f23
...
...
@@ -635,8 +635,9 @@ setup_masks_indic (const hb_ot_shape_plan_t *plan HB_UNUSED,
* and setup masks later on in a pause-callback. */
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
set_indic_properties
(
buffer
->
info
[
i
]);
set_indic_properties
(
info
[
i
]);
}
static
void
...
...
@@ -673,10 +674,12 @@ update_consonant_positions (const hb_ot_shape_plan_t *plan,
{
hb_face_t
*
face
=
font
->
face
;
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
buffer
->
info
[
i
].
indic_position
()
==
POS_BASE_C
)
{
hb_codepoint_t
consonant
=
buffer
->
info
[
i
].
codepoint
;
buffer
->
info
[
i
].
indic_position
()
=
consonant_position_from_face
(
indic_plan
,
consonant
,
virama
,
face
);
if
(
info
[
i
].
indic_position
()
==
POS_BASE_C
)
{
hb_codepoint_t
consonant
=
info
[
i
].
codepoint
;
info
[
i
].
indic_position
()
=
consonant_position_from_face
(
indic_plan
,
consonant
,
virama
,
face
);
}
}
}
...
...
@@ -1228,8 +1231,10 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
/* Note: This loop is extra overhead, but should not be measurable. */
bool
has_broken_syllables
=
false
;
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
((
buffer
->
info
[
i
].
syllable
()
&
0x0F
)
==
broken_cluster
)
{
if
((
info
[
i
].
syllable
()
&
0x0F
)
==
broken_cluster
)
{
has_broken_syllables
=
true
;
break
;
}
...
...
src/hb-ot-shape-complex-myanmar.cc
浏览文件 @
7cd33f23
...
...
@@ -277,8 +277,9 @@ setup_masks_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
* and setup masks later on in a pause-callback. */
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
set_myanmar_properties
(
buffer
->
info
[
i
]);
set_myanmar_properties
(
info
[
i
]);
}
static
void
...
...
@@ -451,8 +452,10 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
/* Note: This loop is extra overhead, but should not be measurable. */
bool
has_broken_syllables
=
false
;
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
((
buffer
->
info
[
i
].
syllable
()
&
0x0F
)
==
broken_cluster
)
{
if
((
info
[
i
].
syllable
()
&
0x0F
)
==
broken_cluster
)
{
has_broken_syllables
=
true
;
break
;
}
...
...
src/hb-ot-shape-complex-sea.cc
浏览文件 @
7cd33f23
...
...
@@ -174,8 +174,9 @@ setup_masks_sea (const hb_ot_shape_plan_t *plan HB_UNUSED,
* and setup masks later on in a pause-callback. */
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
set_sea_properties
(
buffer
->
info
[
i
]);
set_sea_properties
(
info
[
i
]);
}
static
void
...
...
@@ -278,8 +279,10 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
/* Note: This loop is extra overhead, but should not be measurable. */
bool
has_broken_syllables
=
false
;
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
((
buffer
->
info
[
i
].
syllable
()
&
0x0F
)
==
broken_cluster
)
{
if
((
info
[
i
].
syllable
()
&
0x0F
)
==
broken_cluster
)
{
has_broken_syllables
=
true
;
break
;
}
...
...
src/hb-ot-shape-fallback.cc
浏览文件 @
7cd33f23
...
...
@@ -167,11 +167,12 @@ _hb_ot_shape_fallback_position_recategorize_marks (const hb_ot_shape_plan_t *pla
hb_buffer_t
*
buffer
)
{
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
_hb_glyph_info_get_general_category
(
&
buffer
->
info
[
i
])
==
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
)
{
unsigned
int
combining_class
=
_hb_glyph_info_get_modified_combining_class
(
&
buffer
->
info
[
i
]);
combining_class
=
recategorize_combining_class
(
buffer
->
info
[
i
].
codepoint
,
combining_class
);
_hb_glyph_info_set_modified_combining_class
(
&
buffer
->
info
[
i
],
combining_class
);
if
(
_hb_glyph_info_get_general_category
(
&
info
[
i
])
==
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
)
{
unsigned
int
combining_class
=
_hb_glyph_info_get_modified_combining_class
(
&
info
[
i
]);
combining_class
=
recategorize_combining_class
(
info
[
i
].
codepoint
,
combining_class
);
_hb_glyph_info_set_modified_combining_class
(
&
info
[
i
],
combining_class
);
}
}
...
...
@@ -181,8 +182,9 @@ zero_mark_advances (hb_buffer_t *buffer,
unsigned
int
start
,
unsigned
int
end
)
{
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
start
;
i
<
end
;
i
++
)
if
(
_hb_glyph_info_get_general_category
(
&
buffer
->
info
[
i
])
==
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
)
if
(
_hb_glyph_info_get_general_category
(
&
info
[
i
])
==
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
)
{
buffer
->
pos
[
i
].
x_advance
=
0
;
buffer
->
pos
[
i
].
y_advance
=
0
;
...
...
@@ -327,12 +329,13 @@ position_around_base (const hb_ot_shape_plan_t *plan,
unsigned
int
last_lig_component
=
(
unsigned
int
)
-
1
;
unsigned
int
last_combining_class
=
255
;
hb_glyph_extents_t
cluster_extents
=
base_extents
;
/* Initialization is just to shut gcc up. */
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
base
+
1
;
i
<
end
;
i
++
)
if
(
_hb_glyph_info_get_modified_combining_class
(
&
buffer
->
info
[
i
]))
if
(
_hb_glyph_info_get_modified_combining_class
(
&
info
[
i
]))
{
if
(
num_lig_components
>
1
)
{
unsigned
int
this_lig_id
=
_hb_glyph_info_get_lig_id
(
&
buffer
->
info
[
i
]);
unsigned
int
this_lig_component
=
_hb_glyph_info_get_lig_comp
(
&
buffer
->
info
[
i
])
-
1
;
unsigned
int
this_lig_id
=
_hb_glyph_info_get_lig_id
(
&
info
[
i
]);
unsigned
int
this_lig_component
=
_hb_glyph_info_get_lig_comp
(
&
info
[
i
])
-
1
;
/* Conditions for attaching to the last component. */
if
(
!
lig_id
||
lig_id
!=
this_lig_id
||
this_lig_component
>=
num_lig_components
)
this_lig_component
=
num_lig_components
-
1
;
...
...
@@ -355,7 +358,7 @@ position_around_base (const hb_ot_shape_plan_t *plan,
}
}
unsigned
int
this_combining_class
=
_hb_glyph_info_get_modified_combining_class
(
&
buffer
->
info
[
i
]);
unsigned
int
this_combining_class
=
_hb_glyph_info_get_modified_combining_class
(
&
info
[
i
]);
if
(
last_combining_class
!=
this_combining_class
)
{
last_combining_class
=
this_combining_class
;
...
...
@@ -391,13 +394,14 @@ position_cluster (const hb_ot_shape_plan_t *plan,
return
;
/* Find the base glyph */
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
start
;
i
<
end
;
i
++
)
if
(
!
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
_hb_glyph_info_get_general_category
(
&
buffer
->
info
[
i
])))
if
(
!
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
_hb_glyph_info_get_general_category
(
&
info
[
i
])))
{
/* Find mark glyphs */
unsigned
int
j
;
for
(
j
=
i
+
1
;
j
<
end
;
j
++
)
if
(
!
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
_hb_glyph_info_get_general_category
(
&
buffer
->
info
[
j
])))
if
(
!
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
_hb_glyph_info_get_general_category
(
&
info
[
j
])))
break
;
position_around_base
(
plan
,
font
,
buffer
,
i
,
j
);
...
...
@@ -432,15 +436,13 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
{
if
(
!
plan
->
has_kern
)
return
;
unsigned
int
count
=
buffer
->
len
;
OT
::
hb_apply_context_t
c
(
1
,
font
,
buffer
);
c
.
set_lookup_mask
(
plan
->
kern_mask
);
c
.
set_lookup_props
(
OT
::
LookupFlag
::
IgnoreMarks
);
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
hb_glyph_position_t
*
pos
=
buffer
->
pos
;
for
(
unsigned
int
idx
=
0
;
idx
<
count
;)
{
OT
::
hb_apply_context_t
::
skipping_forward_iterator_t
skippy_iter
(
&
c
,
idx
,
1
);
...
...
src/hb-ot-shape.cc
浏览文件 @
7cd33f23
...
...
@@ -227,8 +227,9 @@ static void
hb_set_unicode_props
(
hb_buffer_t
*
buffer
)
{
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
_hb_glyph_info_set_unicode_props
(
&
buffer
->
info
[
i
],
buffer
->
unicode
);
_hb_glyph_info_set_unicode_props
(
&
info
[
i
],
buffer
->
unicode
);
}
static
void
...
...
@@ -263,8 +264,9 @@ static void
hb_form_clusters
(
hb_buffer_t
*
buffer
)
{
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
1
;
i
<
count
;
i
++
)
if
(
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
_hb_glyph_info_get_general_category
(
&
buffer
->
info
[
i
])))
if
(
HB_UNICODE_GENERAL_CATEGORY_IS_MARK
(
_hb_glyph_info_get_general_category
(
&
info
[
i
])))
buffer
->
merge_clusters
(
i
-
1
,
i
+
1
);
}
...
...
@@ -382,8 +384,9 @@ hb_ot_map_glyphs_fast (hb_buffer_t *buffer)
{
/* Normalization process sets up glyph_index(), we just copy it. */
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
buffer
->
info
[
i
].
codepoint
=
buffer
->
info
[
i
].
glyph_index
();
info
[
i
].
codepoint
=
info
[
i
].
glyph_index
();
}
static
inline
void
...
...
@@ -483,8 +486,9 @@ static inline void
zero_mark_widths_by_unicode
(
hb_buffer_t
*
buffer
,
bool
adjust_offsets
)
{
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
_hb_glyph_info_get_general_category
(
&
buffer
->
info
[
i
])
==
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
)
if
(
_hb_glyph_info_get_general_category
(
&
info
[
i
])
==
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
)
{
if
(
adjust_offsets
)
adjust_mark_offsets
(
&
buffer
->
pos
[
i
]);
...
...
@@ -496,8 +500,9 @@ static inline void
zero_mark_widths_by_gdef
(
hb_buffer_t
*
buffer
,
bool
adjust_offsets
)
{
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
_hb_glyph_info_is_mark
(
&
buffer
->
info
[
i
]))
if
(
_hb_glyph_info_is_mark
(
&
info
[
i
]))
{
if
(
adjust_offsets
)
adjust_mark_offsets
(
&
buffer
->
pos
[
i
]);
...
...
@@ -773,8 +778,9 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
bool
mirror
=
hb_script_get_horizontal_direction
(
buffer
->
props
.
script
)
==
HB_DIRECTION_RTL
;
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
add_char
(
font
,
buffer
->
unicode
,
mirror
,
buffer
->
info
[
i
].
codepoint
,
glyphs
);
add_char
(
font
,
buffer
->
unicode
,
mirror
,
info
[
i
].
codepoint
,
glyphs
);
hb_set_t
lookups
;
lookups
.
init
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录