Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
cf92d657
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看板
提交
cf92d657
编写于
10月 23, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[trak] Allow disabling tracking for ranges of text
Fixes
https://github.com/harfbuzz/harfbuzz/issues/1303
上级
8869436c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
5 deletion
+16
-5
src/hb-aat-layout-trak-table.hh
src/hb-aat-layout-trak-table.hh
+4
-0
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+7
-4
src/hb-ot-shape.hh
src/hb-ot-shape.hh
+4
-1
test/shaping/data/in-house/tests/aat-trak.tests
test/shaping/data/in-house/tests/aat-trak.tests
+1
-0
未找到文件。
src/hb-aat-layout-trak-table.hh
浏览文件 @
cf92d657
...
...
@@ -184,6 +184,8 @@ struct trak
{
TRACE_APPLY
(
this
);
hb_mask_t
trak_mask
=
c
->
plan
->
trak_mask
;
const
float
ptem
=
c
->
font
->
ptem
;
if
(
unlikely
(
ptem
<=
0.
f
))
return_trace
(
false
);
...
...
@@ -197,6 +199,7 @@ struct trak
hb_position_t
advance_to_add
=
c
->
font
->
em_scalef_x
(
tracking
);
foreach_grapheme
(
buffer
,
start
,
end
)
{
if
(
!
(
buffer
->
info
[
start
].
mask
&
trak_mask
))
continue
;
buffer
->
pos
[
start
].
x_advance
+=
advance_to_add
;
buffer
->
pos
[
start
].
x_offset
+=
offset_to_add
;
}
...
...
@@ -209,6 +212,7 @@ struct trak
hb_position_t
advance_to_add
=
c
->
font
->
em_scalef_y
(
tracking
);
foreach_grapheme
(
buffer
,
start
,
end
)
{
if
(
!
(
buffer
->
info
[
start
].
mask
&
trak_mask
))
continue
;
buffer
->
pos
[
start
].
y_advance
+=
advance_to_add
;
buffer
->
pos
[
start
].
y_offset
+=
offset_to_add
;
}
...
...
src/hb-ot-shape.cc
浏览文件 @
cf92d657
...
...
@@ -62,16 +62,18 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
plan
.
shaper
=
shaper
;
map
.
compile
(
plan
.
map
,
coords
,
num_coords
);
plan
.
rtlm_mask
=
plan
.
map
.
get_1_mask
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'm'
));
plan
.
frac_mask
=
plan
.
map
.
get_1_mask
(
HB_TAG
(
'f'
,
'r'
,
'a'
,
'c'
));
plan
.
numr_mask
=
plan
.
map
.
get_1_mask
(
HB_TAG
(
'n'
,
'u'
,
'm'
,
'r'
));
plan
.
dnom_mask
=
plan
.
map
.
get_1_mask
(
HB_TAG
(
'd'
,
'n'
,
'o'
,
'm'
));
plan
.
has_frac
=
plan
.
frac_mask
||
(
plan
.
numr_mask
&&
plan
.
dnom_mask
);
plan
.
rtlm_mask
=
plan
.
map
.
get_1_mask
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'm'
));
hb_tag_t
kern_tag
=
HB_DIRECTION_IS_HORIZONTAL
(
plan
.
props
.
direction
)
?
HB_TAG
(
'k'
,
'e'
,
'r'
,
'n'
)
:
HB_TAG
(
'v'
,
'k'
,
'r'
,
'n'
);
plan
.
kern_mask
=
plan
.
map
.
get_mask
(
kern_tag
);
plan
.
trak_mask
=
plan
.
map
.
get_mask
(
HB_TAG
(
't'
,
'r'
,
'a'
,
'k'
));
plan
.
requested_kerning
=
!!
plan
.
kern_mask
;
plan
.
requested_tracking
=
!!
plan
.
trak_mask
;
bool
has_gpos_kern
=
plan
.
map
.
get_feature_index
(
1
,
kern_tag
)
!=
HB_OT_LAYOUT_NO_FEATURE_INDEX
;
bool
disable_gpos
=
plan
.
shaper
->
gpos_tag
&&
plan
.
shaper
->
gpos_tag
!=
plan
.
map
.
chosen_script
[
1
];
...
...
@@ -116,8 +118,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
plan
.
fallback_mark_positioning
=
true
;
/* Currently we always apply trak. */
plan
.
apply_trak
=
hb_aat_layout_has_tracking
(
face
)
&&
plan
.
map
.
needs_fallback
(
HB_TAG
(
't'
,
'r'
,
'a'
,
'k'
));
plan
.
apply_trak
=
plan
.
requested_tracking
&&
hb_aat_layout_has_tracking
(
face
);
}
...
...
@@ -178,7 +179,9 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
/* Random! */
map
->
enable_feature
(
HB_TAG
(
'r'
,
'a'
,
'n'
,
'd'
),
F_RANDOM
,
HB_OT_MAP_MAX_VALUE
);
/* Tracking. */
/* Tracking. We enable dummy feature here just to allow disabling
* AAT 'trak' table using features.
* https://github.com/harfbuzz/harfbuzz/issues/1303 */
map
->
enable_feature
(
HB_TAG
(
't'
,
'r'
,
'a'
,
'k'
),
F_HAS_FALLBACK
);
map
->
enable_feature
(
HB_TAG
(
'H'
,
'A'
,
'R'
,
'F'
));
...
...
src/hb-ot-shape.hh
浏览文件 @
cf92d657
...
...
@@ -40,10 +40,13 @@ struct hb_ot_shape_plan_t
const
struct
hb_ot_complex_shaper_t
*
shaper
;
hb_ot_map_t
map
;
const
void
*
data
;
hb_mask_t
rtlm_mask
,
frac_mask
,
numr_mask
,
dnom_mask
;
hb_mask_t
frac_mask
,
numr_mask
,
dnom_mask
;
hb_mask_t
rtlm_mask
;
hb_mask_t
kern_mask
;
hb_mask_t
trak_mask
;
bool
requested_kerning
:
1
;
bool
requested_tracking
:
1
;
bool
has_frac
:
1
;
bool
has_gpos_mark
:
1
;
bool
fallback_glyph_classes
:
1
;
...
...
test/shaping/data/in-house/tests/aat-trak.tests
浏览文件 @
cf92d657
...
...
@@ -8,3 +8,4 @@
../fonts/TestTRAK.ttf:--font-ptem=144:U+0041,U+0042,U+0043:[A.alt=0@-107,0+786|B=1@-107,0+786|C.alt=2@-107,0+786]
../fonts/TestTRAK.ttf:--font-ptem=144:U+0041,U+0042,U+0043:[A.alt=0@-107,0+786|B=1@-107,0+786|C.alt=2@-107,0+786]
../fonts/TestTRAK.ttf:--font-ptem=144 --features=-trak:U+0041,U+0042,U+0043:[A.alt=0+1000|B=1+1000|C.alt=2+1000]
../fonts/TestTRAK.ttf:--font-ptem=144 --features=-trak[1;3]:U+0041,U+0042,U+0043,U+0041,U+0042,U+0043:[A.alt=0@-107,0+786|B=1+1000|C.alt=2+1000|A.alt=3@-107,0+786|B=4@-107,0+786|C.alt=5@-107,0+786]
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录