Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
b929100f
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看板
提交
b929100f
编写于
8月 26, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ot-face] Unify GSUB/GPOS accelerators in the table accelerator framework
上级
963413fc
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
66 addition
and
86 deletion
+66
-86
src/hb-aat-layout.cc
src/hb-aat-layout.cc
+1
-3
src/hb-ot-face.cc
src/hb-ot-face.cc
+2
-38
src/hb-ot-face.hh
src/hb-ot-face.hh
+11
-14
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gpos-table.hh
+1
-1
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+3
-3
src/hb-ot-layout-gsubgpos.hh
src/hb-ot-layout-gsubgpos.hh
+13
-11
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+17
-16
src/hb-ot-layout.hh
src/hb-ot-layout.hh
+17
-0
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+1
-0
未找到文件。
src/hb-aat-layout.cc
浏览文件 @
b929100f
...
...
@@ -26,9 +26,7 @@
#include "hb-open-type.hh"
#include "hb-ot-layout.hh"
#include "hb-ot-layout-gsubgpos.hh"
#include "hb-ot-face.hh"
#include "hb-aat-layout.hh"
#include "hb-aat-layout-ankr-table.hh"
#include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise.
...
...
src/hb-ot-face.cc
浏览文件 @
b929100f
...
...
@@ -26,10 +26,6 @@
#include "hb-ot-face.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-gsub-table.hh"
#include "hb-ot-layout-gpos-table.hh"
static
bool
_hb_ot_blacklist_gdef
(
unsigned
int
gdef_len
,
...
...
@@ -161,50 +157,18 @@ _hb_ot_face_data_create (hb_face_t *face)
data
->
table
.
init0
(
face
);
const
OT
::
GSUB
&
gsub
=
*
data
->
table
.
GSUB
;
const
OT
::
GPOS
&
gpos
=
*
data
->
table
.
GPOS
;
if
(
unlikely
(
_hb_ot_blacklist_gdef
(
data
->
table
.
GDEF
.
get_blob
()
->
length
,
data
->
table
.
GSUB
.
get_blob
()
->
length
,
data
->
table
.
GPOS
.
get_blob
()
->
length
)))
data
->
table
.
GSUB
->
blob
->
length
,
data
->
table
.
GPOS
->
blob
->
length
)))
data
->
table
.
GDEF
.
set_stored
(
hb_blob_get_empty
());
unsigned
int
gsub_lookup_count
=
data
->
gsub_lookup_count
=
gsub
.
get_lookup_count
();
unsigned
int
gpos_lookup_count
=
data
->
gpos_lookup_count
=
gpos
.
get_lookup_count
();
data
->
gsub_accels
=
(
hb_ot_layout_lookup_accelerator_t
*
)
calloc
(
gsub_lookup_count
,
sizeof
(
hb_ot_layout_lookup_accelerator_t
));
data
->
gpos_accels
=
(
hb_ot_layout_lookup_accelerator_t
*
)
calloc
(
gpos_lookup_count
,
sizeof
(
hb_ot_layout_lookup_accelerator_t
));
if
(
unlikely
((
gsub_lookup_count
&&
!
data
->
gsub_accels
)
||
(
gpos_lookup_count
&&
!
data
->
gpos_accels
)))
{
_hb_ot_face_data_destroy
(
data
);
return
nullptr
;
}
for
(
unsigned
int
i
=
0
;
i
<
gsub_lookup_count
;
i
++
)
data
->
gsub_accels
[
i
].
init
(
gsub
.
get_lookup
(
i
));
for
(
unsigned
int
i
=
0
;
i
<
gpos_lookup_count
;
i
++
)
data
->
gpos_accels
[
i
].
init
(
gpos
.
get_lookup
(
i
));
return
data
;
}
void
_hb_ot_face_data_destroy
(
hb_ot_face_data_t
*
data
)
{
if
(
data
->
gsub_accels
)
for
(
unsigned
int
i
=
0
;
i
<
data
->
gsub_lookup_count
;
i
++
)
data
->
gsub_accels
[
i
].
fini
();
if
(
data
->
gpos_accels
)
for
(
unsigned
int
i
=
0
;
i
<
data
->
gpos_lookup_count
;
i
++
)
data
->
gpos_accels
[
i
].
fini
();
free
(
data
->
gsub_accels
);
free
(
data
->
gpos_accels
);
data
->
table
.
fini
();
free
(
data
);
}
src/hb-ot-face.hh
浏览文件 @
b929100f
...
...
@@ -33,12 +33,19 @@
#include "hb-machinery.hh"
#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ())
#include "hb-ot-cmap-table.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-kern-table.hh"
#include "hb-ot-post-table.hh"
#include "hb-ot-color-cbdt-table.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-gsub-table.hh"
#include "hb-ot-layout-gpos-table.hh"
/*
...
...
@@ -50,8 +57,6 @@
#define HB_OT_LAYOUT_TABLES \
/* OpenType shaping. */
\
HB_OT_LAYOUT_TABLE(OT, GDEF) \
HB_OT_LAYOUT_TABLE(OT, GSUB) \
HB_OT_LAYOUT_TABLE(OT, GPOS) \
HB_OT_LAYOUT_TABLE(OT, JSTF) \
HB_OT_LAYOUT_TABLE(OT, BASE) \
/* AAT shaping. */
\
...
...
@@ -66,6 +71,8 @@
/* OpenType math. */
\
HB_OT_LAYOUT_TABLE(OT, MATH) \
/* OpenType fundamentals. */
\
HB_OT_LAYOUT_ACCELERATOR(OT, GSUB) \
HB_OT_LAYOUT_ACCELERATOR(OT, GPOS) \
HB_OT_LAYOUT_ACCELERATOR(OT, cmap) \
HB_OT_LAYOUT_ACCELERATOR(OT, hmtx) \
HB_OT_LAYOUT_ACCELERATOR(OT, vmtx) \
...
...
@@ -104,19 +111,13 @@ struct hb_ot_face_data_t
hb_face_t
*
face
;
/* MUST be JUST before the lazy loaders. */
#define HB_OT_LAYOUT_TABLE(Namespace, Type) \
hb_table_lazy_loader_t<
struct
Namespace::Type, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type;
hb_table_lazy_loader_t<Namespace::Type, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type;
#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \
hb_face_lazy_loader_t<
struct
Namespace::Type::accelerator_t, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type;
hb_face_lazy_loader_t<Namespace::Type::accelerator_t, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type;
HB_OT_LAYOUT_TABLES
#undef HB_OT_LAYOUT_ACCELERATOR
#undef HB_OT_LAYOUT_TABLE
}
table
;
/* More accelerators. Merge into previous. */
unsigned
int
gsub_lookup_count
;
unsigned
int
gpos_lookup_count
;
hb_ot_layout_lookup_accelerator_t
*
gsub_accels
;
hb_ot_layout_lookup_accelerator_t
*
gpos_accels
;
};
...
...
@@ -127,8 +128,4 @@ HB_INTERNAL void
_hb_ot_face_data_destroy
(
hb_ot_face_data_t
*
data
);
#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ())
#endif
/* HB_OT_FACE_HH */
src/hb-ot-layout-gpos-table.hh
浏览文件 @
b929100f
...
...
@@ -1636,7 +1636,7 @@ template <typename context_t>
/*static*/
inline
bool
PosLookup
::
apply_recurse_func
(
hb_ot_apply_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
PosLookup
&
l
=
hb_ot_face_data
(
c
->
face
)
->
table
.
GPOS
->
get_lookup
(
lookup_index
);
const
PosLookup
&
l
=
_get_gpos
(
c
->
face
).
get_lookup
(
lookup_index
);
unsigned
int
saved_lookup_props
=
c
->
lookup_props
;
unsigned
int
saved_lookup_index
=
c
->
lookup_index
;
c
->
set_lookup_index
(
lookup_index
);
...
...
src/hb-ot-layout-gsub-table.hh
浏览文件 @
b929100f
...
...
@@ -1327,7 +1327,7 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer)
{
_hb_buffer_assert_gsubgpos_vars
(
buffer
);
const
GDEF
&
gdef
=
*
hb_ot_face_data
(
font
->
face
)
->
table
.
GDEF
;
const
GDEF
&
gdef
=
_get_gdef
(
font
->
face
)
;
unsigned
int
count
=
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -1351,13 +1351,13 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer)
template
<
typename
context_t
>
/*static*/
inline
typename
context_t
::
return_t
SubstLookup
::
dispatch_recurse_func
(
context_t
*
c
,
unsigned
int
lookup_index
)
{
const
SubstLookup
&
l
=
hb_ot_face_data
(
c
->
face
)
->
table
.
GSUB
->
get_lookup
(
lookup_index
);
const
SubstLookup
&
l
=
_get_gsub
(
c
->
face
).
get_lookup
(
lookup_index
);
return
l
.
dispatch
(
c
);
}
/*static*/
inline
bool
SubstLookup
::
apply_recurse_func
(
hb_ot_apply_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
SubstLookup
&
l
=
hb_ot_face_data
(
c
->
face
)
->
table
.
GSUB
->
get_lookup
(
lookup_index
);
const
SubstLookup
&
l
=
_get_gsub
(
c
->
face
).
get_lookup
(
lookup_index
);
unsigned
int
saved_lookup_props
=
c
->
lookup_props
;
unsigned
int
saved_lookup_index
=
c
->
lookup_index
;
c
->
set_lookup_index
(
lookup_index
);
...
...
src/hb-ot-layout-gsubgpos.hh
浏览文件 @
b929100f
...
...
@@ -32,9 +32,9 @@
#include "hb.hh"
#include "hb-buffer.hh"
#include "hb-map.hh"
#include "hb-ot-face.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-set.hh"
#include "hb-ot-layout-common.hh"
#include "hb-ot-layout-gdef-table.hh"
namespace
OT
{
...
...
@@ -481,7 +481,7 @@ struct hb_ot_apply_context_t :
iter_input
(),
iter_context
(),
font
(
font_
),
face
(
font
->
face
),
buffer
(
buffer_
),
recurse_func
(
nullptr
),
gdef
(
*
hb_ot_face_data
(
face
)
->
table
.
GDEF
),
gdef
(
_get_gdef
(
face
)
),
var_store
(
gdef
.
get_var_store
()),
direction
(
buffer_
->
props
.
direction
),
lookup_mask
(
1
),
...
...
@@ -2387,28 +2387,30 @@ struct GSUBGPOS
inline
void
init
(
hb_face_t
*
face
)
{
this
->
blob
=
hb_sanitize_context_t
().
reference_table
<
T
>
(
face
);
const
T
&
table
=
*
this
->
blob
->
as
<
T
>
();
table
=
this
->
blob
->
as
<
T
>
();
this
->
lookup_count
=
table
.
get_lookup_count
();
this
->
lookup_count
=
table
->
get_lookup_count
();
this
->
accels
=
(
hb_ot_layout_lookup_accelerator_t
*
)
calloc
(
this
->
lookup_count
,
sizeof
(
hb_ot_layout_lookup_accelerator_t
));
if
(
unlikely
(
!
this
->
accels
))
this
->
lookup_count
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
lookup_count
;
i
++
)
this
->
accels
[
i
].
init
(
table
.
get_lookup
(
i
));
this
->
accels
[
i
].
init
(
table
->
get_lookup
(
i
));
}
inline
void
fini
(
void
)
{
for
(
unsigned
int
i
=
0
;
i
<
this
->
lookup_count
;
i
++
)
this
->
accels
[
i
].
fini
();
free
(
this
->
accels
);
hb_blob_destroy
(
this
->
blob
);
free
(
accels
);
}
private:
hb_blob_t
*
blob
;
unsigned
int
lookup_count
;
hb_ot_layout_lookup_accelerator_t
*
accels
;
hb_blob_t
*
blob
;
const
T
*
table
;
unsigned
int
lookup_count
;
hb_ot_layout_lookup_accelerator_t
*
accels
;
};
protected:
...
...
src/hb-ot-layout.cc
浏览文件 @
b929100f
...
...
@@ -30,6 +30,7 @@
#include "hb-open-type.hh"
#include "hb-ot-layout.hh"
#include "hb-ot-face.hh"
#include "hb-ot-map.hh"
#include "hb-map.hh"
...
...
@@ -55,23 +56,23 @@
// return *(data->base.get ());
// }
static
inline
const
OT
::
GDEF
&
inline
const
OT
::
GDEF
&
_get_gdef
(
hb_face_t
*
face
)
{
if
(
unlikely
(
!
hb_ot_shaper_face_data_ensure
(
face
)))
return
Null
(
OT
::
GDEF
);
return
*
hb_ot_face_data
(
face
)
->
table
.
GDEF
;
}
static
inline
const
OT
::
GSUB
&
inline
const
OT
::
GSUB
&
_get_gsub
(
hb_face_t
*
face
)
{
if
(
unlikely
(
!
hb_ot_shaper_face_data_ensure
(
face
)))
return
Null
(
OT
::
GSUB
);
return
*
hb_ot_face_data
(
face
)
->
table
.
GSUB
;
return
*
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
table
;
}
static
inline
const
OT
::
GPOS
&
inline
const
OT
::
GPOS
&
_get_gpos
(
hb_face_t
*
face
)
{
if
(
unlikely
(
!
hb_ot_shaper_face_data_ensure
(
face
)))
return
Null
(
OT
::
GPOS
);
return
*
hb_ot_face_data
(
face
)
->
table
.
GPOS
;
return
*
hb_ot_face_data
(
face
)
->
table
.
GPOS
->
table
;
}
/*
...
...
@@ -461,11 +462,11 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face,
{
case
HB_OT_TAG_GSUB
:
{
return
hb_ot_face_data
(
face
)
->
gsub_
lookup_count
;
return
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
lookup_count
;
}
case
HB_OT_TAG_GPOS
:
{
return
hb_ot_face_data
(
face
)
->
gpos_
lookup_count
;
return
hb_ot_face_data
(
face
)
->
table
.
GPOS
->
lookup_count
;
}
}
return
0
;
...
...
@@ -679,13 +680,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
{
case
HB_OT_TAG_GSUB
:
{
const
OT
::
SubstLookup
&
l
=
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
get_lookup
(
lookup_index
);
const
OT
::
SubstLookup
&
l
=
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
table
->
get_lookup
(
lookup_index
);
l
.
collect_glyphs
(
&
c
);
return
;
}
case
HB_OT_TAG_GPOS
:
{
const
OT
::
PosLookup
&
l
=
hb_ot_face_data
(
face
)
->
table
.
GPOS
->
get_lookup
(
lookup_index
);
const
OT
::
PosLookup
&
l
=
hb_ot_face_data
(
face
)
->
table
.
GPOS
->
table
->
get_lookup
(
lookup_index
);
l
.
collect_glyphs
(
&
c
);
return
;
}
...
...
@@ -758,12 +759,12 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face,
unsigned
int
glyphs_length
,
hb_bool_t
zero_context
)
{
if
(
unlikely
(
lookup_index
>=
hb_ot_face_data
(
face
)
->
gsub_
lookup_count
))
return
false
;
if
(
unlikely
(
lookup_index
>=
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
lookup_count
))
return
false
;
OT
::
hb_would_apply_context_t
c
(
face
,
glyphs
,
glyphs_length
,
(
bool
)
zero_context
);
const
OT
::
SubstLookup
&
l
=
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
get_lookup
(
lookup_index
);
const
OT
::
SubstLookup
&
l
=
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
table
->
get_lookup
(
lookup_index
);
return
l
.
would_apply
(
&
c
,
&
hb_ot_face_data
(
face
)
->
gsub_
accels
[
lookup_index
]);
return
l
.
would_apply
(
&
c
,
&
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
accels
[
lookup_index
]);
}
void
...
...
@@ -919,8 +920,8 @@ struct GSUBProxy
typedef
OT
::
SubstLookup
Lookup
;
GSUBProxy
(
hb_face_t
*
face
)
:
table
(
*
hb_ot_face_data
(
face
)
->
table
.
GSUB
),
accels
(
hb_ot_face_data
(
face
)
->
gsub_
accels
)
{}
table
(
*
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
table
),
accels
(
hb_ot_face_data
(
face
)
->
table
.
GSUB
->
accels
)
{}
const
OT
::
GSUB
&
table
;
const
hb_ot_layout_lookup_accelerator_t
*
accels
;
...
...
@@ -933,8 +934,8 @@ struct GPOSProxy
typedef
OT
::
PosLookup
Lookup
;
GPOSProxy
(
hb_face_t
*
face
)
:
table
(
*
hb_ot_face_data
(
face
)
->
table
.
GPOS
),
accels
(
hb_ot_face_data
(
face
)
->
gpos_
accels
)
{}
table
(
*
hb_ot_face_data
(
face
)
->
table
.
GPOS
->
table
),
accels
(
hb_ot_face_data
(
face
)
->
table
.
GPOS
->
accels
)
{}
const
OT
::
GPOS
&
table
;
const
hb_ot_layout_lookup_accelerator_t
*
accels
;
...
...
src/hb-ot-layout.hh
浏览文件 @
b929100f
...
...
@@ -37,6 +37,23 @@
#include "hb-set-digest.hh"
namespace
OT
{
struct
GDEF
;
struct
GSUB
;
struct
GPOS
;
}
HB_INTERNAL
const
OT
::
GDEF
&
_get_gdef
(
hb_face_t
*
face
);
HB_INTERNAL
const
OT
::
GSUB
&
_get_gsub
(
hb_face_t
*
face
);
HB_INTERNAL
const
OT
::
GPOS
&
_get_gpos
(
hb_face_t
*
face
);
/* Private API corresponding to hb-ot-layout.h: */
HB_INTERNAL
hb_bool_t
...
...
src/hb-ot-shape.cc
浏览文件 @
b929100f
...
...
@@ -35,6 +35,7 @@
#include "hb-ot-shape-fallback.hh"
#include "hb-ot-shape-normalize.hh"
#include "hb-ot-face.hh"
#include "hb-ot-layout.hh"
#include "hb-unicode.hh"
#include "hb-set.hh"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录