Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
76f76812
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看板
提交
76f76812
编写于
7月 07, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Shuffle code around, remove shape_plan from complex shapers
上级
e88bff9b
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
69 addition
and
65 deletion
+69
-65
src/hb-ot-shape-complex-arabic.cc
src/hb-ot-shape-complex-arabic.cc
+18
-18
src/hb-ot-shape-complex-indic-machine.rl
src/hb-ot-shape-complex-indic-machine.rl
+6
-6
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+12
-13
src/hb-ot-shape-complex-private.hh
src/hb-ot-shape-complex-private.hh
+29
-15
src/hb-ot-shape-private.hh
src/hb-ot-shape-private.hh
+2
-11
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+2
-2
未找到文件。
src/hb-ot-shape-complex-arabic.cc
浏览文件 @
76f76812
...
...
@@ -151,7 +151,7 @@ static const struct arabic_state_table_entry {
void
_hb_ot_shape_complex_collect_features_arabic
(
hb_ot_
shape_planner_t
*
planner
,
const
hb_segment_properties_t
*
props
)
_hb_ot_shape_complex_collect_features_arabic
(
hb_ot_
map_builder_t
*
map
,
const
hb_segment_properties_t
*
props
)
{
/* For Language forms (in ArabicOT speak), we do the iso/fina/medi/init together,
* then rlig and calt each in their own stage. This makes IranNastaliq's ALLAH
...
...
@@ -163,57 +163,57 @@ _hb_ot_shape_complex_collect_features_arabic (hb_ot_shape_planner_t *planner, co
* TODO: Add test cases for these two.
*/
planner
->
map
.
add_gsub_pause
(
NULL
,
NULL
);
map
->
add_gsub_pause
(
NULL
,
NULL
);
unsigned
int
num_features
=
props
->
script
==
HB_SCRIPT_SYRIAC
?
SYRIAC_NUM_FEATURES
:
COMMON_NUM_FEATURES
;
for
(
unsigned
int
i
=
0
;
i
<
num_features
;
i
++
)
planner
->
map
.
add_bool_feature
(
arabic_syriac_features
[
i
],
false
);
map
->
add_bool_feature
(
arabic_syriac_features
[
i
],
false
);
planner
->
map
.
add_gsub_pause
(
NULL
,
NULL
);
map
->
add_gsub_pause
(
NULL
,
NULL
);
planner
->
map
.
add_bool_feature
(
HB_TAG
(
'r'
,
'l'
,
'i'
,
'g'
));
planner
->
map
.
add_gsub_pause
(
NULL
,
NULL
);
map
->
add_bool_feature
(
HB_TAG
(
'r'
,
'l'
,
'i'
,
'g'
));
map
->
add_gsub_pause
(
NULL
,
NULL
);
planner
->
map
.
add_bool_feature
(
HB_TAG
(
'c'
,
'a'
,
'l'
,
't'
));
planner
->
map
.
add_gsub_pause
(
NULL
,
NULL
);
map
->
add_bool_feature
(
HB_TAG
(
'c'
,
'a'
,
'l'
,
't'
));
map
->
add_gsub_pause
(
NULL
,
NULL
);
/* ArabicOT spec enables 'cswh' for Arabic where as for basic shaper it's disabled by default. */
planner
->
map
.
add_bool_feature
(
HB_TAG
(
'c'
,
's'
,
'w'
,
'h'
));
map
->
add_bool_feature
(
HB_TAG
(
'c'
,
's'
,
'w'
,
'h'
));
}
void
_hb_ot_shape_complex_setup_masks_arabic
(
hb_ot_
shape_context_t
*
c
)
_hb_ot_shape_complex_setup_masks_arabic
(
hb_ot_
map_t
*
map
,
hb_buffer_t
*
buffer
)
{
unsigned
int
count
=
c
->
buffer
->
len
;
unsigned
int
count
=
buffer
->
len
;
unsigned
int
prev
=
0
,
state
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
unsigned
int
this_type
=
get_joining_type
(
c
->
buffer
->
info
[
i
].
codepoint
,
(
hb_unicode_general_category_t
)
c
->
buffer
->
info
[
i
].
general_category
());
unsigned
int
this_type
=
get_joining_type
(
buffer
->
info
[
i
].
codepoint
,
(
hb_unicode_general_category_t
)
buffer
->
info
[
i
].
general_category
());
if
(
unlikely
(
this_type
==
JOINING_TYPE_T
))
{
c
->
buffer
->
info
[
i
].
arabic_shaping_action
()
=
NONE
;
buffer
->
info
[
i
].
arabic_shaping_action
()
=
NONE
;
continue
;
}
const
arabic_state_table_entry
*
entry
=
&
arabic_state_table
[
state
][
this_type
];
if
(
entry
->
prev_action
!=
NONE
)
c
->
buffer
->
info
[
prev
].
arabic_shaping_action
()
=
entry
->
prev_action
;
buffer
->
info
[
prev
].
arabic_shaping_action
()
=
entry
->
prev_action
;
c
->
buffer
->
info
[
i
].
arabic_shaping_action
()
=
entry
->
curr_action
;
buffer
->
info
[
i
].
arabic_shaping_action
()
=
entry
->
curr_action
;
prev
=
i
;
state
=
entry
->
next_state
;
}
hb_mask_t
mask_array
[
TOTAL_NUM_FEATURES
+
1
]
=
{
0
};
unsigned
int
num_masks
=
c
->
buffer
->
props
.
script
==
HB_SCRIPT_SYRIAC
?
SYRIAC_NUM_FEATURES
:
COMMON_NUM_FEATURES
;
unsigned
int
num_masks
=
buffer
->
props
.
script
==
HB_SCRIPT_SYRIAC
?
SYRIAC_NUM_FEATURES
:
COMMON_NUM_FEATURES
;
for
(
unsigned
int
i
=
0
;
i
<
num_masks
;
i
++
)
mask_array
[
i
]
=
c
->
plan
->
map
.
get_1_mask
(
arabic_syriac_features
[
i
]);
mask_array
[
i
]
=
map
->
get_1_mask
(
arabic_syriac_features
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
c
->
buffer
->
info
[
i
].
mask
|=
mask_array
[
c
->
buffer
->
info
[
i
].
arabic_shaping_action
()];
buffer
->
info
[
i
].
mask
|=
mask_array
[
buffer
->
info
[
i
].
arabic_shaping_action
()];
}
...
...
src/hb-ot-shape-complex-indic-machine.rl
浏览文件 @
76f76812
...
...
@@ -59,12 +59,12 @@ z = ZWJ|ZWNJ;
matra_group = M N? H?;
syllable_tail = SM? (VD VD?)?;
action
matche
d_syllable {
matched_syllable (c
, last, p);
action
foun
d_syllable {
found_syllable (map, buffer
, last, p);
last = p;
}
consonant_syllable = (c.N? (z.H|H.z?))* c.N? A? (H.z? | matra_group*)? syllable_tail %(
matche
d_syllable);
consonant_syllable = (c.N? (z.H|H.z?))* c.N? A? (H.z? | matra_group*)? syllable_tail %(
foun
d_syllable);
vowel_syllable = (Ra H)? V N? (z.H.c | ZWJ.c)? matra_group* syllable_tail;
standalone_cluster = (Ra H)? NBSP N? (z? H c)? matra_group* syllable_tail;
non_indic = X;
...
...
@@ -85,17 +85,17 @@ main := syllable**;
#include <string.h>
static void
find_syllables (hb_ot_
shape_context_t *c
)
find_syllables (hb_ot_
map_t *map, hb_buffer_t *buffer
)
{
unsigned int p, pe, eof;
int cs;
%%{
write init;
getkey
c->
buffer->info[p].indic_category();
getkey buffer->info[p].indic_category();
}%%
p = 0;
pe = eof =
c->
buffer->len;
pe = eof = buffer->len;
unsigned int last = 0;
%%{
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
76f76812
...
...
@@ -283,20 +283,19 @@ static const hb_tag_t indic_other_features[] =
void
_hb_ot_shape_complex_collect_features_indic
(
hb_ot_
shape_planner_t
*
planner
,
const
hb_segment_properties_t
*
props
HB_UNUSED
)
_hb_ot_shape_complex_collect_features_indic
(
hb_ot_
map_builder_t
*
map
,
const
hb_segment_properties_t
*
props
)
{
for
(
unsigned
int
i
=
0
;
i
<
ARRAY_LENGTH
(
indic_basic_features
);
i
++
)
planner
->
map
.
add_bool_feature
(
indic_basic_features
[
i
].
tag
,
indic_basic_features
[
i
].
is_global
);
map
->
add_bool_feature
(
indic_basic_features
[
i
].
tag
,
indic_basic_features
[
i
].
is_global
);
for
(
unsigned
int
i
=
0
;
i
<
ARRAY_LENGTH
(
indic_other_features
);
i
++
)
planner
->
map
.
add_bool_feature
(
indic_other_features
[
i
],
true
);
map
->
add_bool_feature
(
indic_other_features
[
i
],
true
);
}
static
void
matched_syllable
(
hb_ot_shape_context_t
*
c
,
unsigned
int
start
,
unsigned
int
end
)
found_syllable
(
hb_ot_map_t
*
map
,
hb_buffer_t
*
buffer
,
unsigned
int
start
,
unsigned
int
end
)
{
//fprintf (stderr, "%d %d\n", start, end);
}
...
...
@@ -305,24 +304,24 @@ matched_syllable (hb_ot_shape_context_t *c,
void
_hb_ot_shape_complex_setup_masks_indic
(
hb_ot_
shape_context_t
*
c
)
_hb_ot_shape_complex_setup_masks_indic
(
hb_ot_
map_t
*
map
,
hb_buffer_t
*
buffer
)
{
unsigned
int
count
=
c
->
buffer
->
len
;
unsigned
int
count
=
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
unsigned
int
type
=
get_indic_categories
(
c
->
buffer
->
info
[
i
].
codepoint
);
unsigned
int
type
=
get_indic_categories
(
buffer
->
info
[
i
].
codepoint
);
c
->
buffer
->
info
[
i
].
indic_category
()
=
type
&
0x0F
;
c
->
buffer
->
info
[
i
].
indic_position
()
=
type
>>
4
;
buffer
->
info
[
i
].
indic_category
()
=
type
&
0x0F
;
buffer
->
info
[
i
].
indic_position
()
=
type
>>
4
;
}
find_syllables
(
c
);
find_syllables
(
map
,
buffer
);
hb_mask_t
mask_array
[
ARRAY_LENGTH
(
indic_basic_features
)]
=
{
0
};
unsigned
int
num_masks
=
ARRAY_LENGTH
(
indic_basic_features
);
for
(
unsigned
int
i
=
0
;
i
<
num_masks
;
i
++
)
mask_array
[
i
]
=
c
->
plan
->
map
.
get_1_mask
(
indic_basic_features
[
i
].
tag
);
mask_array
[
i
]
=
map
->
get_1_mask
(
indic_basic_features
[
i
].
tag
);
}
...
...
src/hb-ot-shape-complex-private.hh
浏览文件 @
76f76812
...
...
@@ -29,11 +29,22 @@
#include "hb-private.hh"
#include "hb-ot-
shape
-private.hh"
#include "hb-ot-
map
-private.hh"
HB_BEGIN_DECLS
/* buffer var allocations, used by all shapers */
#define general_category() var1.u8[0]
/* unicode general_category (hb_unicode_general_category_t) */
#define combining_class() var1.u8[1]
/* unicode combining_class (uint8_t) */
enum
hb_ot_complex_shaper_t
{
hb_ot_complex_shaper_none
,
hb_ot_complex_shaper_arabic
,
hb_ot_complex_shaper_indic
};
static
inline
hb_ot_complex_shaper_t
hb_ot_shape_complex_categorize
(
const
hb_segment_properties_t
*
props
)
{
...
...
@@ -104,20 +115,21 @@ hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
*
* Called during shape_plan().
*
* Shapers should use
plan->map to add their feature
s.
* Shapers should use
map to add their features and callback
s.
*/
typedef
void
hb_ot_shape_complex_collect_features_func_t
(
hb_ot_
shape_planner_t
*
plan
,
const
hb_segment_properties_t
*
props
);
typedef
void
hb_ot_shape_complex_collect_features_func_t
(
hb_ot_
map_builder_t
*
map
,
const
hb_segment_properties_t
*
props
);
HB_INTERNAL
hb_ot_shape_complex_collect_features_func_t
_hb_ot_shape_complex_collect_features_arabic
;
HB_INTERNAL
hb_ot_shape_complex_collect_features_func_t
_hb_ot_shape_complex_collect_features_indic
;
static
inline
void
hb_ot_shape_complex_collect_features
(
hb_ot_shape_planner_t
*
planner
,
hb_ot_shape_complex_collect_features
(
hb_ot_complex_shaper_t
shaper
,
hb_ot_map_builder_t
*
map
,
const
hb_segment_properties_t
*
props
)
{
switch
(
planner
->
shaper
)
{
case
hb_ot_complex_shaper_arabic
:
_hb_ot_shape_complex_collect_features_arabic
(
planner
,
props
);
return
;
case
hb_ot_complex_shaper_indic
:
_hb_ot_shape_complex_collect_features_indic
(
planner
,
props
);
return
;
switch
(
shaper
)
{
case
hb_ot_complex_shaper_arabic
:
_hb_ot_shape_complex_collect_features_arabic
(
map
,
props
);
return
;
case
hb_ot_complex_shaper_indic
:
_hb_ot_shape_complex_collect_features_indic
(
map
,
props
);
return
;
case
hb_ot_complex_shaper_none
:
default
:
return
;
}
}
...
...
@@ -127,19 +139,21 @@ hb_ot_shape_complex_collect_features (hb_ot_shape_planner_t *planner,
*
* Called during shape_execute().
*
* Shapers should use
c->plan.
map to get feature masks and set on buffer.
* Shapers should use map to get feature masks and set on buffer.
*/
typedef
void
hb_ot_shape_complex_setup_masks_func_t
(
hb_ot_
shape_context_t
*
c
);
typedef
void
hb_ot_shape_complex_setup_masks_func_t
(
hb_ot_
map_t
*
map
,
hb_buffer_t
*
buffer
);
HB_INTERNAL
hb_ot_shape_complex_setup_masks_func_t
_hb_ot_shape_complex_setup_masks_arabic
;
HB_INTERNAL
hb_ot_shape_complex_setup_masks_func_t
_hb_ot_shape_complex_setup_masks_indic
;
static
inline
void
hb_ot_shape_complex_setup_masks
(
hb_ot_shape_context_t
*
c
)
hb_ot_shape_complex_setup_masks
(
hb_ot_complex_shaper_t
shaper
,
hb_ot_map_t
*
map
,
hb_buffer_t
*
buffer
)
{
switch
(
c
->
plan
->
shaper
)
{
case
hb_ot_complex_shaper_arabic
:
_hb_ot_shape_complex_setup_masks_arabic
(
c
);
return
;
case
hb_ot_complex_shaper_indic
:
_hb_ot_shape_complex_setup_masks_indic
(
c
);
return
;
switch
(
shaper
)
{
case
hb_ot_complex_shaper_arabic
:
_hb_ot_shape_complex_setup_masks_arabic
(
map
,
buffer
);
return
;
case
hb_ot_complex_shaper_indic
:
_hb_ot_shape_complex_setup_masks_indic
(
map
,
buffer
);
return
;
case
hb_ot_complex_shaper_none
:
default
:
return
;
}
}
...
...
src/hb-ot-shape-private.hh
浏览文件 @
76f76812
...
...
@@ -32,21 +32,12 @@
#include "hb-ot-shape.h"
#include "hb-ot-map-private.hh"
#include "hb-ot-shape-complex-private.hh"
HB_BEGIN_DECLS
/* buffer var allocations */
#define general_category() var1.u8[0]
/* unicode general_category (hb_unicode_general_category_t) */
#define combining_class() var1.u8[1]
/* unicode combining_class (uint8_t) */
enum
hb_ot_complex_shaper_t
{
hb_ot_complex_shaper_none
,
hb_ot_complex_shaper_arabic
,
hb_ot_complex_shaper_indic
};
enum
hb_ot_complex_shaper_t
;
struct
hb_ot_shape_plan_t
{
...
...
src/hb-ot-shape.cc
浏览文件 @
76f76812
...
...
@@ -96,7 +96,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
ADD_FEATURES
(
early_features
);
hb_ot_shape_complex_collect_features
(
planner
,
props
);
hb_ot_shape_complex_collect_features
(
planner
->
shaper
,
&
planner
->
map
,
props
);
ADD_FEATURES
(
common_features
);
...
...
@@ -120,7 +120,7 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
hb_mask_t
global_mask
=
c
->
plan
->
map
.
get_global_mask
();
c
->
buffer
->
reset_masks
(
global_mask
);
hb_ot_shape_complex_setup_masks
(
c
);
/* BUFFER: Clobbers var2 */
hb_ot_shape_complex_setup_masks
(
c
->
plan
->
shaper
,
&
c
->
plan
->
map
,
c
->
buffer
);
/* BUFFER: Clobbers var2 */
for
(
unsigned
int
i
=
0
;
i
<
c
->
num_user_features
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录