Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
8bb5deba
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,发现更多精彩内容 >>
提交
8bb5deba
编写于
8月 02, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[OT] Pipe shape_plan down to pause_callbacks
上级
3e38c0f2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
57 addition
and
50 deletion
+57
-50
src/hb-ot-map-private.hh
src/hb-ot-map-private.hh
+4
-4
src/hb-ot-map.cc
src/hb-ot-map.cc
+5
-6
src/hb-ot-shape-complex-indic-machine.rl
src/hb-ot-shape-complex-indic-machine.rl
+2
-2
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+24
-26
src/hb-ot-shape-private.hh
src/hb-ot-shape-private.hh
+6
-0
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+16
-12
未找到文件。
src/hb-ot-map-private.hh
浏览文件 @
8bb5deba
...
...
@@ -62,7 +62,7 @@ struct hb_ot_map_t
{
return
a
->
index
<
b
->
index
?
-
1
:
a
->
index
>
b
->
index
?
1
:
0
;
}
};
typedef
void
(
*
pause_func_t
)
(
const
hb_ot_map_t
*
map
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
);
typedef
void
(
*
pause_func_t
)
(
const
struct
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
);
struct
pause_map_t
{
unsigned
int
num_lookups
;
/* Cumulative */
...
...
@@ -112,9 +112,9 @@ struct hb_ot_map_t
inline
hb_tag_t
get_chosen_script
(
unsigned
int
table_index
)
const
{
return
chosen_script
[
table_index
];
}
HB_INTERNAL
void
substitute_closure
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
)
const
;
HB_INTERNAL
void
substitute
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
;
HB_INTERNAL
void
position
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
;
HB_INTERNAL
void
substitute_closure
(
const
struct
hb_ot_shape_plan_t
*
plan
,
hb_face_t
*
face
,
hb_set_t
*
glyphs
)
const
;
HB_INTERNAL
void
substitute
(
const
struct
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
;
HB_INTERNAL
void
position
(
const
struct
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
;
inline
void
finish
(
void
)
{
features
.
finish
();
...
...
src/hb-ot-map.cc
浏览文件 @
8bb5deba
...
...
@@ -75,7 +75,7 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, bool gl
/* Keep the next two functions in sync. */
void
hb_ot_map_t
::
substitute
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
void
hb_ot_map_t
::
substitute
(
const
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
{
const
unsigned
int
table_index
=
0
;
unsigned
int
i
=
0
;
...
...
@@ -88,14 +88,14 @@ void hb_ot_map_t::substitute (hb_font_t *font, hb_buffer_t *buffer) const
buffer
->
clear_output
();
if
(
pause
->
callback
)
pause
->
callback
(
this
,
font
,
buffer
);
pause
->
callback
(
plan
,
font
,
buffer
);
}
for
(;
i
<
lookups
[
table_index
].
len
;
i
++
)
hb_ot_layout_substitute_lookup
(
font
,
buffer
,
lookups
[
table_index
][
i
].
index
,
lookups
[
table_index
][
i
].
mask
);
}
void
hb_ot_map_t
::
position
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
void
hb_ot_map_t
::
position
(
const
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
{
const
unsigned
int
table_index
=
1
;
unsigned
int
i
=
0
;
...
...
@@ -106,15 +106,14 @@ void hb_ot_map_t::position (hb_font_t *font, hb_buffer_t *buffer) const
hb_ot_layout_position_lookup
(
font
,
buffer
,
lookups
[
table_index
][
i
].
index
,
lookups
[
table_index
][
i
].
mask
);
if
(
pause
->
callback
)
pause
->
callback
(
this
,
font
,
buffer
);
pause
->
callback
(
plan
,
font
,
buffer
);
}
for
(;
i
<
lookups
[
table_index
].
len
;
i
++
)
hb_ot_layout_position_lookup
(
font
,
buffer
,
lookups
[
table_index
][
i
].
index
,
lookups
[
table_index
][
i
].
mask
);
}
void
hb_ot_map_t
::
substitute_closure
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
)
const
void
hb_ot_map_t
::
substitute_closure
(
const
hb_ot_shape_plan_t
*
plan
,
hb_face_t
*
face
,
hb_set_t
*
glyphs
)
const
{
unsigned
int
table_index
=
0
;
unsigned
int
i
=
0
;
...
...
src/hb-ot-shape-complex-indic-machine.rl
浏览文件 @
8bb5deba
...
...
@@ -92,14 +92,14 @@ main := |*
if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #func); \
for (unsigned int i = last; i < p+1; i++) \
info[i].syllable() = syllable_serial; \
PASTE (initial_reordering_, func) (
map
, buffer, mask_array, last, p+1); \
PASTE (initial_reordering_, func) (
plan
, buffer, mask_array, last, p+1); \
last = p+1; \
syllable_serial++; \
if (unlikely (!syllable_serial)) syllable_serial++; \
} HB_STMT_END
static void
find_syllables (const hb_ot_
map_t *map
, hb_buffer_t *buffer, hb_mask_t *mask_array)
find_syllables (const hb_ot_
shape_plan_t *plan
, hb_buffer_t *buffer, hb_mask_t *mask_array)
{
unsigned int p, pe, eof, ts, te, act;
int cs;
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
8bb5deba
...
...
@@ -108,14 +108,12 @@ struct indic_shape_plan_t
unsigned
int
count
;
};
indic_shape_plan_t
(
const
hb_ot_map_t
*
map_
)
:
map
(
map_
),
pref
(
map_
,
HB_TAG
(
'p'
,
'r'
,
'e'
,
'f'
)),
blwf
(
map_
,
HB_TAG
(
'b'
,
'l'
,
'w'
,
'f'
)),
pstf
(
map_
,
HB_TAG
(
'p'
,
's'
,
't'
,
'f'
)),
is_old_spec
(
IS_OLD_INDIC_TAG
(
map
->
get_chosen_script
(
0
)))
{}
const
hb_ot_map_t
*
map
;
indic_shape_plan_t
(
const
hb_ot_shape_plan_t
*
plan
)
:
pref
(
&
plan
->
map
,
HB_TAG
(
'p'
,
'r'
,
'e'
,
'f'
)),
blwf
(
&
plan
->
map
,
HB_TAG
(
'b'
,
'l'
,
'w'
,
'f'
)),
pstf
(
&
plan
->
map
,
HB_TAG
(
'p'
,
's'
,
't'
,
'f'
)),
is_old_spec
(
IS_OLD_INDIC_TAG
(
plan
->
map
.
get_chosen_script
(
0
)))
{}
would_apply_feature_t
pref
;
would_apply_feature_t
blwf
;
would_apply_feature_t
pstf
;
...
...
@@ -192,11 +190,11 @@ indic_other_features[] =
static
void
initial_reordering
(
const
hb_ot_
map_t
*
map
,
initial_reordering
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
);
static
void
final_reordering
(
const
hb_ot_
map_t
*
map
,
final_reordering
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
);
...
...
@@ -260,7 +258,7 @@ compare_indic_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
static
void
update_consonant_positions
(
const
hb_ot_
map_t
*
map
,
update_consonant_positions
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_buffer_t
*
buffer
,
hb_font_t
*
font
)
{
...
...
@@ -280,7 +278,7 @@ update_consonant_positions (const hb_ot_map_t *map,
default:
virama
=
0
;
break
;
}
indic_shape_plan_t
indic_plan
(
map
);
indic_shape_plan_t
indic_plan
(
plan
);
unsigned
int
consonant_pos
=
indic_plan
.
is_old_spec
?
0
:
1
;
hb_codepoint_t
glyphs
[
2
];
...
...
@@ -303,7 +301,7 @@ update_consonant_positions (const hb_ot_map_t *map,
* https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx */
static
void
initial_reordering_consonant_syllable
(
const
hb_ot_
map_t
*
map
,
hb_buffer_t
*
buffer
,
hb_mask_t
*
basic_mask_array
,
initial_reordering_consonant_syllable
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_buffer_t
*
buffer
,
hb_mask_t
*
basic_mask_array
,
unsigned
int
start
,
unsigned
int
end
)
{
hb_glyph_info_t
*
info
=
buffer
->
info
;
...
...
@@ -508,7 +506,7 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff
/* For old-style Indic script tags, move the first post-base Halant after
* last consonant. */
if
(
IS_OLD_INDIC_TAG
(
map
->
get_chosen_script
(
0
)))
{
if
(
IS_OLD_INDIC_TAG
(
plan
->
map
.
get_chosen_script
(
0
)))
{
for
(
unsigned
int
i
=
base
+
1
;
i
<
end
;
i
++
)
if
(
info
[
i
].
indic_category
()
==
OT_H
)
{
unsigned
int
j
;
...
...
@@ -650,17 +648,17 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff
static
void
initial_reordering_vowel_syllable
(
const
hb_ot_
map_t
*
map
,
initial_reordering_vowel_syllable
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_buffer_t
*
buffer
,
hb_mask_t
*
basic_mask_array
,
unsigned
int
start
,
unsigned
int
end
)
{
/* We made the vowels look like consonants. So let's call the consonant logic! */
initial_reordering_consonant_syllable
(
map
,
buffer
,
basic_mask_array
,
start
,
end
);
initial_reordering_consonant_syllable
(
plan
,
buffer
,
basic_mask_array
,
start
,
end
);
}
static
void
initial_reordering_standalone_cluster
(
const
hb_ot_
map_t
*
map
,
initial_reordering_standalone_cluster
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_buffer_t
*
buffer
,
hb_mask_t
*
basic_mask_array
,
unsigned
int
start
,
unsigned
int
end
)
...
...
@@ -677,11 +675,11 @@ initial_reordering_standalone_cluster (const hb_ot_map_t *map,
return
;
}
initial_reordering_consonant_syllable
(
map
,
buffer
,
basic_mask_array
,
start
,
end
);
initial_reordering_consonant_syllable
(
plan
,
buffer
,
basic_mask_array
,
start
,
end
);
}
static
void
initial_reordering_non_indic
(
const
hb_ot_
map_t
*
map
HB_UNUSED
,
initial_reordering_non_indic
(
const
hb_ot_
shape_plan_t
*
plan
HB_UNUSED
,
hb_buffer_t
*
buffer
HB_UNUSED
,
hb_mask_t
*
basic_mask_array
HB_UNUSED
,
unsigned
int
start
HB_UNUSED
,
unsigned
int
end
HB_UNUSED
)
...
...
@@ -693,18 +691,18 @@ initial_reordering_non_indic (const hb_ot_map_t *map HB_UNUSED,
#include "hb-ot-shape-complex-indic-machine.hh"
static
void
initial_reordering
(
const
hb_ot_
map_t
*
map
,
initial_reordering
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
{
update_consonant_positions
(
map
,
buffer
,
font
);
update_consonant_positions
(
plan
,
buffer
,
font
);
hb_mask_t
basic_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
++
)
basic_mask_array
[
i
]
=
map
->
get_1_mask
(
indic_basic_features
[
i
].
tag
);
basic_mask_array
[
i
]
=
plan
->
map
.
get_1_mask
(
indic_basic_features
[
i
].
tag
);
find_syllables
(
map
,
buffer
,
basic_mask_array
);
find_syllables
(
plan
,
buffer
,
basic_mask_array
);
}
static
void
...
...
@@ -1057,15 +1055,15 @@ final_reordering_syllable (hb_buffer_t *buffer,
static
void
final_reordering
(
const
hb_ot_
map_t
*
map
,
final_reordering
(
const
hb_ot_
shape_plan_t
*
plan
,
hb_font_t
*
font
HB_UNUSED
,
hb_buffer_t
*
buffer
)
{
unsigned
int
count
=
buffer
->
len
;
if
(
!
count
)
return
;
hb_mask_t
init_mask
=
map
->
get_1_mask
(
HB_TAG
(
'i'
,
'n'
,
'i'
,
't'
));
hb_mask_t
pref_mask
=
map
->
get_1_mask
(
HB_TAG
(
'p'
,
'r'
,
'e'
,
'f'
));
hb_mask_t
init_mask
=
plan
->
map
.
get_1_mask
(
HB_TAG
(
'i'
,
'n'
,
'i'
,
't'
));
hb_mask_t
pref_mask
=
plan
->
map
.
get_1_mask
(
HB_TAG
(
'p'
,
'r'
,
'e'
,
'f'
));
hb_glyph_info_t
*
info
=
buffer
->
info
;
unsigned
int
last
=
0
;
...
...
src/hb-ot-shape-private.hh
浏览文件 @
8bb5deba
...
...
@@ -44,6 +44,12 @@ struct hb_ot_shape_plan_t
hb_segment_properties_t
props
;
const
struct
hb_ot_complex_shaper_t
*
shaper
;
hb_ot_map_t
map
;
inline
void
substitute_closure
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
)
const
{
map
.
substitute_closure
(
this
,
face
,
glyphs
);
}
inline
void
substitute
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
{
map
.
substitute
(
this
,
font
,
buffer
);
}
inline
void
position
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
{
map
.
position
(
this
,
font
,
buffer
);
}
void
finish
(
void
)
{
map
.
finish
();
}
};
struct
hb_ot_shape_planner_t
...
...
src/hb-ot-shape.cc
浏览文件 @
8bb5deba
...
...
@@ -77,14 +77,16 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
const
hb_feature_t
*
user_features
,
unsigned
int
num_user_features
)
{
hb_ot_map_builder_t
*
map
=
&
planner
->
map
;
switch
(
props
->
direction
)
{
case
HB_DIRECTION_LTR
:
planner
->
map
.
add_bool_feature
(
HB_TAG
(
'l'
,
't'
,
'r'
,
'a'
));
planner
->
map
.
add_bool_feature
(
HB_TAG
(
'l'
,
't'
,
'r'
,
'm'
));
map
->
add_bool_feature
(
HB_TAG
(
'l'
,
't'
,
'r'
,
'a'
));
map
->
add_bool_feature
(
HB_TAG
(
'l'
,
't'
,
'r'
,
'm'
));
break
;
case
HB_DIRECTION_RTL
:
planner
->
map
.
add_bool_feature
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'a'
));
planner
->
map
.
add_bool_feature
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'm'
),
false
);
map
->
add_bool_feature
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'a'
));
map
->
add_bool_feature
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'm'
),
false
);
break
;
case
HB_DIRECTION_TTB
:
case
HB_DIRECTION_BTT
:
...
...
@@ -96,7 +98,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
#define ADD_FEATURES(array) \
HB_STMT_START { \
for (unsigned int i = 0; i < ARRAY_LENGTH (array); i++) \
planner->map.
add_bool_feature (array[i]); \
map->
add_bool_feature (array[i]); \
} HB_STMT_END
if
(
planner
->
shaper
->
collect_features
)
...
...
@@ -116,7 +118,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
for
(
unsigned
int
i
=
0
;
i
<
num_user_features
;
i
++
)
{
const
hb_feature_t
*
feature
=
&
user_features
[
i
];
planner
->
map
.
add_feature
(
feature
->
tag
,
feature
->
value
,
(
feature
->
start
==
0
&&
feature
->
end
==
(
unsigned
int
)
-
1
));
map
->
add_feature
(
feature
->
tag
,
feature
->
value
,
(
feature
->
start
==
0
&&
feature
->
end
==
(
unsigned
int
)
-
1
));
}
}
...
...
@@ -183,7 +185,7 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
void
_hb_ot_shaper_shape_plan_data_destroy
(
hb_ot_shaper_shape_plan_data_t
*
data
)
{
data
->
map
.
finish
();
data
->
finish
();
free
(
data
);
}
...
...
@@ -211,7 +213,9 @@ struct hb_ot_shape_context_t
static
void
hb_ot_shape_setup_masks
(
hb_ot_shape_context_t
*
c
)
{
hb_mask_t
global_mask
=
c
->
plan
->
map
.
get_global_mask
();
hb_ot_map_t
*
map
=
&
c
->
plan
->
map
;
hb_mask_t
global_mask
=
map
->
get_global_mask
();
c
->
buffer
->
reset_masks
(
global_mask
);
if
(
c
->
plan
->
shaper
->
setup_masks
)
...
...
@@ -222,7 +226,7 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
const
hb_feature_t
*
feature
=
&
c
->
user_features
[
i
];
if
(
!
(
feature
->
start
==
0
&&
feature
->
end
==
(
unsigned
int
)
-
1
))
{
unsigned
int
shift
;
hb_mask_t
mask
=
c
->
plan
->
map
.
get_mask
(
feature
->
tag
,
&
shift
);
hb_mask_t
mask
=
map
->
get_mask
(
feature
->
tag
,
&
shift
);
c
->
buffer
->
set_masks
(
feature
->
value
<<
shift
,
mask
,
feature
->
start
,
feature
->
end
);
}
}
...
...
@@ -352,7 +356,7 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
hb_synthesize_glyph_classes
(
c
);
if
(
hb_ot_layout_has_substitution
(
c
->
face
))
c
->
plan
->
map
.
substitute
(
c
->
font
,
c
->
buffer
);
c
->
plan
->
substitute
(
c
->
font
,
c
->
buffer
);
hb_ot_layout_substitute_finish
(
c
->
font
,
c
->
buffer
);
...
...
@@ -408,7 +412,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
&
c
->
buffer
->
pos
[
i
].
y_offset
);
}
c
->
plan
->
map
.
position
(
c
->
font
,
c
->
buffer
);
c
->
plan
->
position
(
c
->
font
,
c
->
buffer
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
c
->
font
->
subtract_glyph_origin_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
...
...
@@ -588,7 +592,7 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
do
{
copy
.
set
(
glyphs
);
HB_SHAPER_DATA_GET
(
shape_plan
)
->
map
.
substitute_closure
(
font
->
face
,
glyphs
);
HB_SHAPER_DATA_GET
(
shape_plan
)
->
substitute_closure
(
font
->
face
,
glyphs
);
}
while
(
!
copy
.
equal
(
glyphs
));
hb_shape_plan_destroy
(
shape_plan
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录