Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
a0175e75
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看板
提交
a0175e75
编写于
8月 17, 2017
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[aat] Start implementing common table formats
上级
c71b55a2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
175 addition
and
0 deletion
+175
-0
src/Makefile.sources
src/Makefile.sources
+2
-0
src/hb-aat-layout-common-private.hh
src/hb-aat-layout-common-private.hh
+134
-0
src/hb-aat-layout-morx-table.hh
src/hb-aat-layout-morx-table.hh
+1
-0
src/hb-aat-layout-private.hh
src/hb-aat-layout-private.hh
+37
-0
src/hb-aat-layout.cc
src/hb-aat-layout.cc
+1
-0
未找到文件。
src/Makefile.sources
浏览文件 @
a0175e75
...
...
@@ -83,7 +83,9 @@ HB_FALLBACK_sources = \
HB_OT_sources
=
\
hb-aat-layout.cc
\
hb-aat-layout-common-private.hh
\
hb-aat-layout-morx-table.hh
\
hb-aat-layout-private.hh
\
hb-ot-font.cc
\
hb-ot-layout.cc
\
hb-ot-layout-common-private.hh
\
...
...
src/hb-aat-layout-common-private.hh
0 → 100644
浏览文件 @
a0175e75
/*
* Copyright © 2017 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
#ifndef HB_AAT_LAYOUT_COMMON_PRIVATE_HH
#define HB_AAT_LAYOUT_COMMON_PRIVATE_HH
#include "hb-aat-layout-private.hh"
namespace
AAT
{
using
namespace
OT
;
/*
* Binary Searching Tables
*/
struct
BinSearchHeader
{
friend
struct
BinSearchArray
;
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
protected:
USHORT
unitSize
;
/* Size of a lookup unit for this search in bytes. */
USHORT
nUnits
;
/* Number of units of the preceding size to be searched. */
USHORT
searchRange
;
/* The value of unitSize times the largest power of 2
* that is less than or equal to the value of nUnits. */
USHORT
entrySelector
;
/* The log base 2 of the largest power of 2 less than
* or equal to the value of nUnits. */
USHORT
rangeShift
;
/* The value of unitSize times the difference of the
* value of nUnits minus the largest power of 2 less
* than or equal to the value of nUnits. */
public:
DEFINE_SIZE_STATIC
(
10
);
};
template
<
typename
Type
>
struct
BinSearchArrayOf
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
if
(
unlikely
(
i
>=
header
.
nUnits
))
return
Null
(
Type
);
return
StructAtOffset
<
Type
>
(
bytes
,
i
*
header
.
unitSize
);
}
inline
Type
&
operator
[]
(
unsigned
int
i
)
{
return
StructAtOffset
<
Type
>
(
bytes
,
i
*
header
.
unitSize
);
}
inline
unsigned
int
get_size
(
void
)
const
{
return
header
.
static_size
+
header
.
nUnits
*
header
.
unitSize
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return_trace
(
false
);
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size. We just include
* a small unreachable expression to make sure the structs
* pointed to do have a simple sanitize(), ie. they do not
* reference other structs via offsets.
*/
(
void
)
(
false
&&
StructAtOffset
<
Type
>
(
bytes
,
0
).
sanitize
(
c
));
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return_trace
(
false
);
unsigned
int
count
=
header
.
nUnits
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
(
*
this
)[
i
].
sanitize
(
c
,
base
)))
return_trace
(
false
);
return_trace
(
true
);
}
template
<
typename
T
>
inline
Type
*
bsearch
(
const
T
&
key
)
const
{
return
::
bsearch
(
&
key
,
bytes
,
header
.
nUnits
,
header
.
unitSize
,
(
hb_compare_func_t
)
Type
::
cmp
);
}
private:
inline
bool
sanitize_shallow
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
header
.
sanitize
(
c
)
&&
Type
::
static_size
>=
header
.
unitSize
&&
c
->
check_array
(
bytes
,
header
.
unitSize
,
header
.
nUnits
));
}
protected:
BinSearchHeader
header
;
BYTE
bytes
[
VAR
];
public:
DEFINE_SIZE_ARRAY
(
10
,
bytes
);
};
}
/* namespace AAT */
#endif
/* HB_AAT_LAYOUT_COMMON_PRIVATE_HH */
src/hb-aat-layout-morx-table.hh
浏览文件 @
a0175e75
...
...
@@ -28,6 +28,7 @@
#define HB_AAT_LAYOUT_MORX_TABLE_HH
#include <hb-open-type-private.hh>
#include <hb-aat-layout-common-private.hh>
#define HB_AAT_TAG_MORT HB_TAG('m','o','r','t')
#define HB_AAT_TAG_MORX HB_TAG('m','o','r','x')
...
...
src/hb-aat-layout-private.hh
0 → 100644
浏览文件 @
a0175e75
/*
* Copyright © 2017 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
#ifndef HB_AAT_LAYOUT_PRIVATE_HH
#define HB_AAT_LAYOUT_PRIVATE_HH
#include "hb-private.hh"
#include "hb-font-private.hh"
#include "hb-buffer-private.hh"
#include "hb-open-type-private.hh"
#endif
/* HB_AAT_LAYOUT_PRIVATE_HH */
src/hb-aat-layout.cc
浏览文件 @
a0175e75
...
...
@@ -27,6 +27,7 @@
#include "hb-open-type-private.hh"
#include "hb-ot-layout-private.hh"
#include "hb-aat-layout-private.hh"
#include "hb-aat-layout-morx-table.hh"
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录