Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
77acc110
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看板
提交
77acc110
编写于
11月 01, 2017
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kern] More...
Almost there.
上级
49c0f355
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
88 addition
and
1 deletion
+88
-1
src/hb-ot-font.cc
src/hb-ot-font.cc
+14
-0
src/hb-ot-kern-table.hh
src/hb-ot-kern-table.hh
+74
-1
未找到文件。
src/hb-ot-font.cc
浏览文件 @
77acc110
...
...
@@ -471,6 +471,7 @@ struct hb_ot_font_t
OT
::
hb_lazy_loader_t
<
hb_ot_face_glyf_accelerator_t
>
glyf
;
OT
::
hb_lazy_loader_t
<
hb_ot_face_cbdt_accelerator_t
>
cbdt
;
OT
::
hb_lazy_loader_t
<
hb_ot_face_post_accelerator_t
>
post
;
OT
::
hb_lazy_table_loader_t
<
OT
::
kern
>
kern
;
};
...
...
@@ -489,6 +490,7 @@ _hb_ot_font_create (hb_face_t *face)
ot_font
->
glyf
.
init
(
face
);
ot_font
->
cbdt
.
init
(
face
);
ot_font
->
post
.
init
(
face
);
ot_font
->
kern
.
init
(
face
);
return
ot_font
;
}
...
...
@@ -504,6 +506,7 @@ _hb_ot_font_destroy (void *data)
ot_font
->
glyf
.
fini
();
ot_font
->
cbdt
.
fini
();
ot_font
->
post
.
fini
();
ot_font
->
kern
.
fini
();
free
(
ot_font
);
}
...
...
@@ -553,6 +556,17 @@ hb_ot_get_glyph_v_advance (hb_font_t *font,
return
font
->
em_scale_y
(
-
(
int
)
ot_font
->
v_metrics
.
get_advance
(
glyph
,
font
));
}
static
hb_position_t
hb_ot_get_glyph_h_kerning
(
hb_font_t
*
font
,
void
*
font_data
,
hb_codepoint_t
left_glyph
,
hb_codepoint_t
right_glyph
,
void
*
user_data
HB_UNUSED
)
{
const
hb_ot_font_t
*
ot_font
=
(
const
hb_ot_font_t
*
)
font_data
;
return
font
->
em_scale_x
(
ot_font
->
kern
->
get_h_kerning
(
left_glyph
,
right_glyph
));
}
static
hb_bool_t
hb_ot_get_glyph_extents
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
...
...
src/hb-ot-kern-table.hh
浏览文件 @
77acc110
...
...
@@ -98,6 +98,12 @@ struct KernSubTableFormat0
struct
KernSubTableFormat2
{
inline
int
get_kerning
(
hb_codepoint_t
left
,
hb_codepoint_t
right
)
const
{
/* XXX */
return
0
;
}
inline
unsigned
int
get_size
(
void
)
const
{
/* XXX */
...
...
@@ -116,6 +122,15 @@ struct KernSubTableFormat2
struct
KernSubTable
{
inline
int
get_kerning
(
hb_codepoint_t
left
,
hb_codepoint_t
right
,
unsigned
int
format
)
const
{
switch
(
format
)
{
case
0
:
return
u
.
format0
.
get_kerning
(
left
,
right
);
case
2
:
return
u
.
format2
.
get_kerning
(
left
,
right
);
default:
return
0
;
}
}
inline
unsigned
int
get_size
(
unsigned
int
format
)
const
{
switch
(
format
)
{
...
...
@@ -151,6 +166,18 @@ struct KernSubTableWrapper
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
inline
const
T
*
thiz
(
void
)
const
{
return
static_cast
<
const
T
*>
(
this
);
}
inline
bool
is_horizontal
(
void
)
const
{
return
(
thiz
()
->
coverage
&
T
::
COVERAGE_CHECK_FLAGS
)
==
T
::
COVERAGE_CHECK_HORIZONTAL
;
}
inline
bool
is_override
(
void
)
const
{
return
bool
(
thiz
()
->
coverage
&
T
::
COVERAGE_OVERRIDE_FLAG
);
}
inline
int
get_kerning
(
hb_codepoint_t
left
,
hb_codepoint_t
right
)
const
{
return
thiz
()
->
subtable
.
get_kerning
(
left
,
right
,
thiz
()
->
format
);
}
inline
int
get_h_kerning
(
hb_codepoint_t
left
,
hb_codepoint_t
right
)
const
{
return
is_horizontal
()
?
get_kerning
(
left
,
right
)
:
0
;
}
inline
unsigned
int
get_size
(
void
)
const
{
return
thiz
()
->
length
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
...
...
@@ -170,6 +197,21 @@ struct KernTable
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
inline
const
T
*
thiz
(
void
)
const
{
return
static_cast
<
const
T
*>
(
this
);
}
inline
int
get_h_kerning
(
hb_codepoint_t
left
,
hb_codepoint_t
right
)
const
{
int
v
=
0
;
const
typename
T
::
SubTableWrapper
*
st
=
CastP
<
typename
T
::
SubTableWrapper
>
(
thiz
()
->
data
);
unsigned
int
count
=
thiz
()
->
nTables
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
if
(
st
->
is_override
())
v
=
0
;
v
+=
st
->
get_h_kerning
(
left
,
right
);
st
=
&
StructAfter
<
typename
T
::
SubTableWrapper
>
(
*
st
);
}
return
v
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
...
...
@@ -200,6 +242,18 @@ struct KernOT : KernTable<KernOT>
{
friend
struct
KernSubTableWrapper
<
SubTableWrapper
>
;
enum
coverage_flags_t
{
COVERAGE_DIRECTION_FLAG
=
0x01u
,
COVERAGE_MINIMUM_FLAG
=
0x02u
,
COVERAGE_CROSSSTREAM_FLAG
=
0x04u
,
COVERAGE_OVERRIDE_FLAG
=
0x08u
,
COVERAGE_VARIATION_FLAG
=
0x00u
,
/* Not supported. */
COVERAGE_CHECK_FLAGS
=
0x07u
,
COVERAGE_CHECK_HORIZONTAL
=
0x01u
};
protected:
USHORT
versionZ
;
/* Unused. */
USHORT
length
;
/* Length of the subtable (including this header). */
...
...
@@ -228,6 +282,17 @@ struct KernAAT : KernTable<KernAAT>
{
friend
struct
KernSubTableWrapper
<
SubTableWrapper
>
;
enum
coverage_flags_t
{
COVERAGE_DIRECTION_FLAG
=
0x80u
,
COVERAGE_CROSSSTREAM_FLAG
=
0x40u
,
COVERAGE_VARIATION_FLAG
=
0x20u
,
COVERAGE_OVERRIDE_FLAG
=
0x00u
,
/* Not supported. */
COVERAGE_CHECK_FLAGS
=
0xE0u
,
COVERAGE_CHECK_HORIZONTAL
=
0x00u
};
protected:
ULONG
length
;
/* Length of the subtable (including this header). */
BYTE
coverage
;
/* Coverage bits. */
...
...
@@ -251,7 +316,15 @@ struct kern
{
static
const
hb_tag_t
tableTag
=
HB_OT_TAG_kern
;
private:
inline
int
get_h_kerning
(
hb_codepoint_t
left
,
hb_codepoint_t
right
)
const
{
switch
(
u
.
major
)
{
case
0
:
return
u
.
ot
.
get_h_kerning
(
left
,
right
);
case
1
:
return
u
.
aat
.
get_h_kerning
(
left
,
right
);
default:
return
0
;
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录