Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
cf203af8
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看板
提交
cf203af8
编写于
10月 31, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement space fallback in vertical direction
Fixes
https://github.com/harfbuzz/harfbuzz/issues/1343
上级
e0125023
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
11 deletion
+42
-11
src/hb-ot-shape-fallback.cc
src/hb-ot-shape-fallback.cc
+25
-11
test/shaping/data/in-house/tests/spaces.tests
test/shaping/data/in-house/tests/spaces.tests
+17
-0
未找到文件。
src/hb-ot-shape-fallback.cc
浏览文件 @
cf203af8
...
...
@@ -476,11 +476,9 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
{
if
(
!
HB_DIRECTION_IS_HORIZONTAL
(
buffer
->
props
.
direction
))
return
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
hb_glyph_position_t
*
pos
=
buffer
->
pos
;
bool
horizontal
=
HB_DIRECTION_IS_HORIZONTAL
(
buffer
->
props
.
direction
);
unsigned
int
count
=
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
_hb_glyph_info_is_unicode_space
(
&
info
[
i
])
&&
!
_hb_glyph_info_ligated
(
&
info
[
i
]))
...
...
@@ -501,27 +499,40 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan HB_UNUSED,
case
t
::
SPACE_EM_5
:
case
t
::
SPACE_EM_6
:
case
t
::
SPACE_EM_16
:
pos
[
i
].
x_advance
=
(
font
->
x_scale
+
((
int
)
space_type
)
/
2
)
/
(
int
)
space_type
;
if
(
horizontal
)
pos
[
i
].
x_advance
=
(
font
->
x_scale
+
((
int
)
space_type
)
/
2
)
/
(
int
)
space_type
;
else
pos
[
i
].
y_advance
=
(
font
->
y_scale
+
((
int
)
space_type
)
/
2
)
/
(
int
)
space_type
;
break
;
case
t
::
SPACE_4_EM_18
:
pos
[
i
].
x_advance
=
(
int64_t
)
font
->
x_scale
*
4
/
18
;
if
(
horizontal
)
pos
[
i
].
x_advance
=
(
int64_t
)
font
->
x_scale
*
4
/
18
;
else
pos
[
i
].
y_advance
=
(
int64_t
)
font
->
y_scale
*
4
/
18
;
break
;
case
t
::
SPACE_FIGURE
:
for
(
char
u
=
'0'
;
u
<=
'9'
;
u
++
)
if
(
font
->
get_nominal_glyph
(
u
,
&
glyph
))
{
pos
[
i
].
x_advance
=
font
->
get_glyph_h_advance
(
glyph
);
if
(
horizontal
)
pos
[
i
].
x_advance
=
font
->
get_glyph_h_advance
(
glyph
);
else
pos
[
i
].
y_advance
=
font
->
get_glyph_v_advance
(
glyph
);
break
;
}
break
;
case
t
::
SPACE_PUNCTUATION
:
if
(
font
->
get_nominal_glyph
(
'.'
,
&
glyph
))
pos
[
i
].
x_advance
=
font
->
get_glyph_h_advance
(
glyph
);
else
if
(
font
->
get_nominal_glyph
(
','
,
&
glyph
))
pos
[
i
].
x_advance
=
font
->
get_glyph_h_advance
(
glyph
);
if
(
font
->
get_nominal_glyph
(
'.'
,
&
glyph
)
||
font
->
get_nominal_glyph
(
','
,
&
glyph
))
{
if
(
horizontal
)
pos
[
i
].
x_advance
=
font
->
get_glyph_h_advance
(
glyph
);
else
pos
[
i
].
y_advance
=
font
->
get_glyph_v_advance
(
glyph
);
}
break
;
case
t
::
SPACE_NARROW
:
...
...
@@ -530,7 +541,10 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan HB_UNUSED,
* However, in my testing, many fonts have their regular space being about that
* size. To me, a percentage of the space width makes more sense. Half is as
* good as any. */
pos
[
i
].
x_advance
/=
2
;
if
(
horizontal
)
pos
[
i
].
x_advance
/=
2
;
else
pos
[
i
].
y_advance
/=
2
;
break
;
}
}
...
...
test/shaping/data/in-house/tests/spaces.tests
浏览文件 @
cf203af8
...
...
@@ -15,3 +15,20 @@
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot:U+202F:[gid1=0+280]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot:U+205F:[gid1=0+455]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot:U+3000:[gid1=0+2048]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+0020:[gid1=0@-280,0+0,-2048]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+00A0:[gid1=0@-280,0+0,-2048]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+1680:[gid0=0@-346,0+0,-2048]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2000:[gid1=0@-280,0+0,1024]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2001:[gid1=0@-280,0+0,2048]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2002:[gid1=0@-280,0+0,1024]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2003:[gid1=0@-280,0+0,2048]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2004:[gid1=0@-280,0+0,683]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2005:[gid1=0@-280,0+0,512]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2006:[gid1=0@-280,0+0,341]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2007:[gid1=0@-280,0+0,-2048]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2008:[gid1=0@-280,0+0,-2048]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+2009:[gid1=0@-280,0+0,410]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+200A:[gid1=0@-280,0+0,128]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+202F:[gid1=0@-280,0+0,-1024]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+205F:[gid1=0@-280,0+0,455]
../fonts/1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf:--font-funcs=ot --direction=ttb:U+3000:[gid1=0@-280,0+0,2048]
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录