Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
977ddff1
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
12 个月 前同步成功
通知
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
977ddff1
编写于
11月 14, 2017
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ot] Move hb_ot_face_cmap_accelerator_t
上级
a7f15959
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
142 addition
and
137 deletion
+142
-137
src/hb-ot-cmap-table.hh
src/hb-ot-cmap-table.hh
+141
-8
src/hb-ot-font.cc
src/hb-ot-font.cc
+1
-129
未找到文件。
src/hb-ot-cmap-table.hh
浏览文件 @
977ddff1
...
...
@@ -496,6 +496,146 @@ struct cmap
{
static
const
hb_tag_t
tableTag
=
HB_OT_TAG_cmap
;
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
likely
(
version
==
0
)
&&
encodingRecord
.
sanitize
(
c
,
this
));
}
struct
accelerator_t
{
inline
void
init
(
hb_face_t
*
face
)
{
this
->
blob
=
OT
::
Sanitizer
<
OT
::
cmap
>::
sanitize
(
face
->
reference_table
(
HB_OT_TAG_cmap
));
const
OT
::
cmap
*
cmap
=
OT
::
Sanitizer
<
OT
::
cmap
>::
lock_instance
(
this
->
blob
);
const
OT
::
CmapSubtable
*
subtable
=
nullptr
;
const
OT
::
CmapSubtableFormat14
*
subtable_uvs
=
nullptr
;
bool
symbol
=
false
;
/* 32-bit subtables. */
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
3
,
10
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
6
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
4
);
/* 16-bit subtables. */
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
3
,
1
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
3
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
2
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
1
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
0
);
if
(
!
subtable
)
{
subtable
=
cmap
->
find_subtable
(
3
,
0
);
if
(
subtable
)
symbol
=
true
;
}
/* Meh. */
if
(
!
subtable
)
subtable
=
&
OT
::
Null
(
OT
::
CmapSubtable
);
/* UVS subtable. */
if
(
!
subtable_uvs
)
{
const
OT
::
CmapSubtable
*
st
=
cmap
->
find_subtable
(
0
,
5
);
if
(
st
&&
st
->
u
.
format
==
14
)
subtable_uvs
=
&
st
->
u
.
format14
;
}
/* Meh. */
if
(
!
subtable_uvs
)
subtable_uvs
=
&
OT
::
Null
(
OT
::
CmapSubtableFormat14
);
this
->
uvs_table
=
subtable_uvs
;
this
->
get_glyph_data
=
subtable
;
if
(
unlikely
(
symbol
))
this
->
get_glyph_func
=
get_glyph_from_symbol
<
OT
::
CmapSubtable
>
;
else
switch
(
subtable
->
u
.
format
)
{
/* Accelerate format 4 and format 12. */
default:
this
->
get_glyph_func
=
get_glyph_from
<
OT
::
CmapSubtable
>
;
break
;
case
12
:
this
->
get_glyph_func
=
get_glyph_from
<
OT
::
CmapSubtableFormat12
>
;
break
;
case
4
:
{
this
->
format4_accel
.
init
(
&
subtable
->
u
.
format4
);
this
->
get_glyph_data
=
&
this
->
format4_accel
;
this
->
get_glyph_func
=
this
->
format4_accel
.
get_glyph_func
;
}
break
;
}
}
inline
void
fini
(
void
)
{
hb_blob_destroy
(
this
->
blob
);
}
inline
bool
get_nominal_glyph
(
hb_codepoint_t
unicode
,
hb_codepoint_t
*
glyph
)
const
{
return
this
->
get_glyph_func
(
this
->
get_glyph_data
,
unicode
,
glyph
);
}
inline
bool
get_variation_glyph
(
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
hb_codepoint_t
*
glyph
)
const
{
switch
(
this
->
uvs_table
->
get_glyph_variant
(
unicode
,
variation_selector
,
glyph
))
{
case
OT
::
GLYPH_VARIANT_NOT_FOUND
:
return
false
;
case
OT
::
GLYPH_VARIANT_FOUND
:
return
true
;
case
OT
::
GLYPH_VARIANT_USE_DEFAULT
:
break
;
}
return
get_nominal_glyph
(
unicode
,
glyph
);
}
protected:
typedef
bool
(
*
hb_cmap_get_glyph_func_t
)
(
const
void
*
obj
,
hb_codepoint_t
codepoint
,
hb_codepoint_t
*
glyph
);
template
<
typename
Type
>
static
inline
bool
get_glyph_from
(
const
void
*
obj
,
hb_codepoint_t
codepoint
,
hb_codepoint_t
*
glyph
)
{
const
Type
*
typed_obj
=
(
const
Type
*
)
obj
;
return
typed_obj
->
get_glyph
(
codepoint
,
glyph
);
}
template
<
typename
Type
>
static
inline
bool
get_glyph_from_symbol
(
const
void
*
obj
,
hb_codepoint_t
codepoint
,
hb_codepoint_t
*
glyph
)
{
const
Type
*
typed_obj
=
(
const
Type
*
)
obj
;
if
(
likely
(
typed_obj
->
get_glyph
(
codepoint
,
glyph
)))
return
true
;
if
(
codepoint
<=
0x00FFu
)
{
/* For symbol-encoded OpenType fonts, we duplicate the
* U+F000..F0FF range at U+0000..U+00FF. That's what
* Windows seems to do, and that's hinted about at:
* http://www.microsoft.com/typography/otspec/recom.htm
* under "Non-Standard (Symbol) Fonts". */
return
typed_obj
->
get_glyph
(
0xF000u
+
codepoint
,
glyph
);
}
return
false
;
}
private:
hb_cmap_get_glyph_func_t
get_glyph_func
;
const
void
*
get_glyph_data
;
OT
::
CmapSubtableFormat4
::
accelerator_t
format4_accel
;
const
OT
::
CmapSubtableFormat14
*
uvs_table
;
hb_blob_t
*
blob
;
};
protected:
inline
const
CmapSubtable
*
find_subtable
(
unsigned
int
platform_id
,
unsigned
int
encoding_id
)
const
{
...
...
@@ -513,14 +653,7 @@ struct cmap
return
&
(
this
+
encodingRecord
[
result
].
subtable
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
likely
(
version
==
0
)
&&
encodingRecord
.
sanitize
(
c
,
this
));
}
protected:
USHORT
version
;
/* Table version number (0). */
SortedArrayOf
<
EncodingRecord
>
encodingRecord
;
/* Encoding tables. */
...
...
src/hb-ot-font.cc
浏览文件 @
977ddff1
...
...
@@ -40,137 +40,9 @@
#include "hb-ot-post-table.hh"
typedef
bool
(
*
hb_cmap_get_glyph_func_t
)
(
const
void
*
obj
,
hb_codepoint_t
codepoint
,
hb_codepoint_t
*
glyph
);
template
<
typename
Type
>
static
inline
bool
get_glyph_from
(
const
void
*
obj
,
hb_codepoint_t
codepoint
,
hb_codepoint_t
*
glyph
)
{
const
Type
*
typed_obj
=
(
const
Type
*
)
obj
;
return
typed_obj
->
get_glyph
(
codepoint
,
glyph
);
}
template
<
typename
Type
>
static
inline
bool
get_glyph_from_symbol
(
const
void
*
obj
,
hb_codepoint_t
codepoint
,
hb_codepoint_t
*
glyph
)
{
const
Type
*
typed_obj
=
(
const
Type
*
)
obj
;
if
(
likely
(
typed_obj
->
get_glyph
(
codepoint
,
glyph
)))
return
true
;
if
(
codepoint
<=
0x00FFu
)
{
/* For symbol-encoded OpenType fonts, we duplicate the
* U+F000..F0FF range at U+0000..U+00FF. That's what
* Windows seems to do, and that's hinted about at:
* http://www.microsoft.com/typography/otspec/recom.htm
* under "Non-Standard (Symbol) Fonts". */
return
typed_obj
->
get_glyph
(
0xF000u
+
codepoint
,
glyph
);
}
return
false
;
}
struct
hb_ot_face_cmap_accelerator_t
{
hb_cmap_get_glyph_func_t
get_glyph_func
;
const
void
*
get_glyph_data
;
OT
::
CmapSubtableFormat4
::
accelerator_t
format4_accel
;
const
OT
::
CmapSubtableFormat14
*
uvs_table
;
hb_blob_t
*
blob
;
inline
void
init
(
hb_face_t
*
face
)
{
this
->
blob
=
OT
::
Sanitizer
<
OT
::
cmap
>::
sanitize
(
face
->
reference_table
(
HB_OT_TAG_cmap
));
const
OT
::
cmap
*
cmap
=
OT
::
Sanitizer
<
OT
::
cmap
>::
lock_instance
(
this
->
blob
);
const
OT
::
CmapSubtable
*
subtable
=
nullptr
;
const
OT
::
CmapSubtableFormat14
*
subtable_uvs
=
nullptr
;
bool
symbol
=
false
;
/* 32-bit subtables. */
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
3
,
10
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
6
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
4
);
/* 16-bit subtables. */
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
3
,
1
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
3
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
2
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
1
);
if
(
!
subtable
)
subtable
=
cmap
->
find_subtable
(
0
,
0
);
if
(
!
subtable
)
{
subtable
=
cmap
->
find_subtable
(
3
,
0
);
if
(
subtable
)
symbol
=
true
;
}
/* Meh. */
if
(
!
subtable
)
subtable
=
&
OT
::
Null
(
OT
::
CmapSubtable
);
/* UVS subtable. */
if
(
!
subtable_uvs
)
{
const
OT
::
CmapSubtable
*
st
=
cmap
->
find_subtable
(
0
,
5
);
if
(
st
&&
st
->
u
.
format
==
14
)
subtable_uvs
=
&
st
->
u
.
format14
;
}
/* Meh. */
if
(
!
subtable_uvs
)
subtable_uvs
=
&
OT
::
Null
(
OT
::
CmapSubtableFormat14
);
this
->
uvs_table
=
subtable_uvs
;
this
->
get_glyph_data
=
subtable
;
if
(
unlikely
(
symbol
))
this
->
get_glyph_func
=
get_glyph_from_symbol
<
OT
::
CmapSubtable
>
;
else
switch
(
subtable
->
u
.
format
)
{
/* Accelerate format 4 and format 12. */
default:
this
->
get_glyph_func
=
get_glyph_from
<
OT
::
CmapSubtable
>
;
break
;
case
12
:
this
->
get_glyph_func
=
get_glyph_from
<
OT
::
CmapSubtableFormat12
>
;
break
;
case
4
:
{
this
->
format4_accel
.
init
(
&
subtable
->
u
.
format4
);
this
->
get_glyph_data
=
&
this
->
format4_accel
;
this
->
get_glyph_func
=
this
->
format4_accel
.
get_glyph_func
;
}
break
;
}
}
inline
void
fini
(
void
)
{
hb_blob_destroy
(
this
->
blob
);
}
inline
bool
get_nominal_glyph
(
hb_codepoint_t
unicode
,
hb_codepoint_t
*
glyph
)
const
{
return
this
->
get_glyph_func
(
this
->
get_glyph_data
,
unicode
,
glyph
);
}
inline
bool
get_variation_glyph
(
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
hb_codepoint_t
*
glyph
)
const
{
switch
(
this
->
uvs_table
->
get_glyph_variant
(
unicode
,
variation_selector
,
glyph
))
{
case
OT
::
GLYPH_VARIANT_NOT_FOUND
:
return
false
;
case
OT
::
GLYPH_VARIANT_FOUND
:
return
true
;
case
OT
::
GLYPH_VARIANT_USE_DEFAULT
:
break
;
}
return
get_nominal_glyph
(
unicode
,
glyph
);
}
};
struct
hb_ot_font_t
{
hb_ot_face_cmap_
accelerator_t
cmap
;
OT
::
cmap
::
accelerator_t
cmap
;
OT
::
hmtxvmtx
::
accelerator_t
h_metrics
;
OT
::
hmtxvmtx
::
accelerator_t
v_metrics
;
OT
::
hb_lazy_loader_t
<
OT
::
glyf
::
accelerator_t
>
glyf
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录