Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
683c3a95
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看板
提交
683c3a95
编写于
10月 08, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kern] Abstract away kerning machine
上级
fb4f4383
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
89 addition
and
51 deletion
+89
-51
src/hb-font.hh
src/hb-font.hh
+1
-1
src/hb-ot-kern-table.hh
src/hb-ot-kern-table.hh
+71
-0
src/hb-ot-shape-fallback.cc
src/hb-ot-shape-fallback.cc
+17
-50
未找到文件。
src/hb-font.hh
浏览文件 @
683c3a95
...
@@ -502,8 +502,8 @@ struct hb_font_t
...
@@ -502,8 +502,8 @@ struct hb_font_t
hb_position_t
*
x
,
hb_position_t
*
y
)
hb_position_t
*
x
,
hb_position_t
*
y
)
{
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
*
x
=
get_glyph_h_kerning
(
first_glyph
,
second_glyph
);
*
y
=
0
;
*
y
=
0
;
*
x
=
get_glyph_h_kerning
(
first_glyph
,
second_glyph
);
}
else
{
}
else
{
*
x
=
0
;
*
x
=
0
;
*
y
=
get_glyph_v_kerning
(
first_glyph
,
second_glyph
);
*
y
=
get_glyph_v_kerning
(
first_glyph
,
second_glyph
);
...
...
src/hb-ot-kern-table.hh
浏览文件 @
683c3a95
...
@@ -28,6 +28,77 @@
...
@@ -28,6 +28,77 @@
#define HB_OT_KERN_TABLE_HH
#define HB_OT_KERN_TABLE_HH
#include "hb-open-type.hh"
#include "hb-open-type.hh"
#include "hb-ot-shape.hh"
#include "hb-ot-layout-gsubgpos.hh"
template
<
typename
Driver
>
struct
hb_kern_machine_t
{
hb_kern_machine_t
(
Driver
&
driver_
)
:
driver
(
driver_
)
{}
inline
void
kern
(
const
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
{
if
(
!
plan
->
kerning_requested
)
return
;
OT
::
hb_ot_apply_context_t
c
(
1
,
font
,
buffer
);
hb_mask_t
kern_mask
=
plan
->
kern_mask
;
c
.
set_lookup_mask
(
kern_mask
);
c
.
set_lookup_props
(
OT
::
LookupFlag
::
IgnoreMarks
);
OT
::
hb_ot_apply_context_t
::
skipping_iterator_t
&
skippy_iter
=
c
.
iter_input
;
skippy_iter
.
init
(
&
c
);
bool
horizontal
=
HB_DIRECTION_IS_HORIZONTAL
(
buffer
->
props
.
direction
);
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
;)
{
if
(
!
(
info
[
idx
].
mask
&
kern_mask
))
{
idx
++
;
continue
;
}
skippy_iter
.
reset
(
idx
,
1
);
if
(
!
skippy_iter
.
next
())
{
idx
++
;
continue
;
}
unsigned
int
i
=
idx
;
unsigned
int
j
=
skippy_iter
.
idx
;
hb_position_t
kern
=
driver
.
get_kerning
(
info
[
i
].
codepoint
,
info
[
j
].
codepoint
);
hb_position_t
kern1
=
kern
>>
1
;
hb_position_t
kern2
=
kern
-
kern1
;
if
(
horizontal
)
{
pos
[
i
].
x_advance
+=
kern1
;
pos
[
j
].
x_advance
+=
kern2
;
pos
[
j
].
x_offset
+=
kern2
;
}
else
{
pos
[
i
].
y_advance
+=
kern1
;
pos
[
j
].
y_advance
+=
kern2
;
pos
[
j
].
y_offset
+=
kern2
;
}
buffer
->
unsafe_to_break
(
i
,
j
+
1
);
idx
=
skippy_iter
.
idx
;
}
}
Driver
&
driver
;
};
/*
/*
* kern -- Kerning
* kern -- Kerning
...
...
src/hb-ot-shape-fallback.cc
浏览文件 @
683c3a95
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
*/
*/
#include "hb-ot-shape-fallback.hh"
#include "hb-ot-shape-fallback.hh"
#include "hb-ot-
layout-gsubgpos
.hh"
#include "hb-ot-
kern-table
.hh"
static
unsigned
int
static
unsigned
int
recategorize_combining_class
(
hb_codepoint_t
u
,
recategorize_combining_class
(
hb_codepoint_t
u
,
...
@@ -435,67 +435,34 @@ _hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan,
...
@@ -435,67 +435,34 @@ _hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan,
}
}
/* Performs
old-style TrueType
kerning. */
/* Performs
font-assisted
kerning. */
void
void
_hb_ot_shape_fallback_kern
(
const
hb_ot_shape_plan_t
*
plan
,
_hb_ot_shape_fallback_kern
(
const
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
hb_buffer_t
*
buffer
)
{
{
if
(
!
plan
->
kerning_requested
)
return
;
struct
driver_t
OT
::
hb_ot_apply_context_t
c
(
1
,
font
,
buffer
);
hb_mask_t
kern_mask
=
plan
->
kern_mask
;
c
.
set_lookup_mask
(
kern_mask
);
c
.
set_lookup_props
(
OT
::
LookupFlag
::
IgnoreMarks
);
OT
::
hb_ot_apply_context_t
::
skipping_iterator_t
&
skippy_iter
=
c
.
iter_input
;
skippy_iter
.
init
(
&
c
);
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
;)
{
{
if
(
!
(
info
[
idx
].
mask
&
kern_mask
))
driver_t
(
hb_font_t
*
font_
,
{
hb_buffer_t
*
buffer
)
:
idx
++
;
font
(
font_
),
direction
(
buffer
->
props
.
direction
)
{}
continue
;
}
skippy_iter
.
reset
(
idx
,
1
);
hb_position_t
get_kerning
(
hb_codepoint_t
first
,
hb_codepoint_t
second
)
if
(
!
skippy_iter
.
next
())
{
{
idx
++
;
hb_position_t
kern
=
0
;
continue
;
font
->
get_glyph_kerning_for_direction
(
first
,
second
,
direction
,
&
kern
,
&
kern
);
return
kern
;
}
}
hb_position_t
x_kern
,
y_kern
;
hb_font_t
*
font
;
font
->
get_glyph_kerning_for_direction
(
info
[
idx
].
codepoint
,
hb_direction_t
direction
;
info
[
skippy_iter
.
idx
].
codepoint
,
}
driver
(
font
,
buffer
);
buffer
->
props
.
direction
,
&
x_kern
,
&
y_kern
);
if
(
x_kern
)
hb_kern_machine_t
<
driver_t
>
machine
(
driver
);
{
hb_position_t
kern1
=
x_kern
>>
1
;
hb_position_t
kern2
=
x_kern
-
kern1
;
pos
[
idx
].
x_advance
+=
kern1
;
pos
[
skippy_iter
.
idx
].
x_advance
+=
kern2
;
pos
[
skippy_iter
.
idx
].
x_offset
+=
kern2
;
buffer
->
unsafe_to_break
(
idx
,
skippy_iter
.
idx
+
1
);
}
if
(
y_kern
)
{
hb_position_t
kern1
=
y_kern
>>
1
;
hb_position_t
kern2
=
y_kern
-
kern1
;
pos
[
idx
].
y_advance
+=
kern1
;
pos
[
skippy_iter
.
idx
].
y_advance
+=
kern2
;
pos
[
skippy_iter
.
idx
].
y_offset
+=
kern2
;
buffer
->
unsafe_to_break
(
idx
,
skippy_iter
.
idx
+
1
);
}
idx
=
skippy_iter
.
idx
;
machine
.
kern
(
plan
,
font
,
buffer
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录