Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
12360f7c
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看板
提交
12360f7c
编写于
1月 23, 2008
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor cleanup, add LIKELY and UNLIKELY annotations
上级
8dd1c8b8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
51 deletion
+63
-51
src/hb-ot-layout-gdef-private.h
src/hb-ot-layout-gdef-private.h
+36
-27
src/hb-ot-layout-open-private.h
src/hb-ot-layout-open-private.h
+12
-24
src/hb-private.h
src/hb-private.h
+15
-0
未找到文件。
src/hb-ot-layout-gdef-private.h
浏览文件 @
12360f7c
...
...
@@ -3,6 +3,15 @@
#include "hb-ot-layout-open-private.h"
#define DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP(Type, name) \
inline const Type& name (uint16_t glyph_id) { \
const Coverage &c = get_coverage (); \
int c_index = c.get_coverage (glyph_id); \
return (*this)[c_index]; \
}
struct
GlyphClassDef
:
ClassDef
{
static
const
uint16_t
BaseGlyph
=
0x0001u
;
static
const
uint16_t
LigatureGlyph
=
0x0002u
;
...
...
@@ -27,19 +36,15 @@ struct AttachPoint {
DEFINE_NULL_ASSERT_SIZE
(
AttachPoint
,
2
);
struct
AttachList
{
inline
const
AttachPoint
*
get_attach_points
(
uint16_t
glyph_id
)
{
const
Coverage
&
c
=
get_coverage
();
int
c_index
=
c
.
get_coverage
(
glyph_id
);
return
&
(
*
this
)[
c_index
];
}
/* const AttachPoint& get_attach_points (uint16_t glyph_id); */
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
AttachPoint
,
get_attach_points
);
private:
/* AttachPoint tables, in Coverage Index order */
DEFINE_OFFSET_ARRAY_TYPE
(
AttachPoint
,
attachPoint
,
glyphCount
);
DEFINE_ACCESSOR
(
Coverage
,
get_coverage
,
coverage
);
private:
private:
Offset
coverage
;
/* Offset to Coverage table -- from
* beginning of AttachList table */
USHORT
glyphCount
;
/* Number of glyphs with attachment
...
...
@@ -54,22 +59,6 @@ DEFINE_NULL_ASSERT_SIZE (AttachList, 4);
* Ligature Caret Table
*/
struct
CaretValue
;
struct
LigCaretList
{
/* TODO */
private:
Offset
coverage
;
/* Offset to Coverage table--from
* beginning of LigCaretList table */
USHORT
ligGlyphCount
;
/* Number of ligature glyphs */
Offset
ligGlyph
[];
/* Array of offsets to LigGlyph
* tables--from beginning of
* LigCaretList table--in Coverage
* Index order */
};
DEFINE_NULL_ASSERT_SIZE
(
LigCaretList
,
4
);
struct
CaretValueFormat1
{
inline
int
get_caret_value
(
int
ppem
)
const
{
...
...
@@ -80,7 +69,7 @@ struct CaretValueFormat1 {
USHORT
caretValueFormat
;
/* Format identifier--format = 1 */
SHORT
coordinate
;
/* X or Y value, in design units */
};
DEFINE_NULL_
ASSERT_SIZE
(
CaretValueFormat1
,
4
);
ASSERT_SIZE
(
CaretValueFormat1
,
4
);
struct
CaretValueFormat2
{
...
...
@@ -92,12 +81,12 @@ struct CaretValueFormat2 {
USHORT
caretValueFormat
;
/* Format identifier--format = 2 */
USHORT
caretValuePoint
;
/* Contour point index on glyph */
};
DEFINE_NULL_
ASSERT_SIZE
(
CaretValueFormat2
,
4
);
ASSERT_SIZE
(
CaretValueFormat2
,
4
);
struct
CaretValueFormat3
{
inline
const
Device
&
get_device
(
void
)
const
{
if
(
!
deviceTable
)
return
NullDevice
;
if
(
HB_UNLIKELY
(
!
deviceTable
)
)
return
NullDevice
;
return
*
(
const
Device
*
)((
const
char
*
)
this
+
deviceTable
);
}
...
...
@@ -112,7 +101,7 @@ struct CaretValueFormat3 {
* value--from beginning of CaretValue
* table */
};
DEFINE_NULL_
ASSERT_SIZE
(
CaretValueFormat3
,
6
);
ASSERT_SIZE
(
CaretValueFormat3
,
6
);
struct
CaretValue
{
DEFINE_NON_INSTANTIABLE
(
CaretValue
);
...
...
@@ -162,6 +151,26 @@ struct LigGlyph {
};
DEFINE_NULL_ASSERT_SIZE
(
LigGlyph
,
2
);
struct
LigCaretList
{
/* const LigGlyph& get_lig_glyph (uint16_t glyph_id); */
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
LigGlyph
,
get_lig_glyph
);
private:
/* AttachPoint tables, in Coverage Index order */
DEFINE_OFFSET_ARRAY_TYPE
(
LigGlyph
,
ligGlyph
,
ligGlyphCount
);
DEFINE_ACCESSOR
(
Coverage
,
get_coverage
,
coverage
);
private:
Offset
coverage
;
/* Offset to Coverage table--from
* beginning of LigCaretList table */
USHORT
ligGlyphCount
;
/* Number of ligature glyphs */
Offset
ligGlyph
[];
/* Array of offsets to LigGlyph
* tables--from beginning of
* LigCaretList table--in Coverage
* Index order */
};
DEFINE_NULL_ASSERT_SIZE
(
LigCaretList
,
4
);
/*
* GDEF Header
*/
...
...
src/hb-ot-layout-open-private.h
浏览文件 @
12360f7c
...
...
@@ -4,18 +4,6 @@
#include "hb-private.h"
#include "hb-ot-layout.h"
#include <glib.h>
/* Macros to convert to/from BigEndian */
#define hb_be_uint8_t
#define hb_be_int8_t
#define hb_be_uint16_t GUINT16_TO_BE
#define hb_be_int16_t GINT16_TO_BE
#define hb_be_uint32_t GUINT32_TO_BE
#define hb_be_int32_t GINT32_TO_BE
#define hb_be_uint64_t GUINT64_TO_BE
#define hb_be_int64_t GINT64_TO_BE
/*
* Int types
*/
...
...
@@ -57,7 +45,7 @@
DEFINE_LEN_AND_SIZE(Type, array, num)
#define DEFINE_INDEX_OPERATOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
if (
i >= num
) return Null##Type; \
if (
HB_UNLIKELY (i >= num)
) return Null##Type; \
return array[i]; \
}
...
...
@@ -69,8 +57,8 @@
DEFINE_LEN_AND_SIZE(Offset, array, num)
#define DEFINE_OFFSET_INDEX_OPERATOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
if (
i >= num
) return Null##Type; \
if (
!array[i]
) return Null##Type; \
if (
HB_UNLIKELY (i >= num)
) return Null##Type; \
if (
HB_UNLIKELY (!array[i])
) return Null##Type; \
return *(const Type *)((const char*)this + array[i]); \
}
...
...
@@ -79,12 +67,12 @@
DEFINE_LEN_AND_SIZE(Record, array, num)
#define DEFINE_RECORD_ACCESSOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
if (
i >= num
) return Null##Type; \
if (
!array[i].offset
) return Null##Type; \
if (
HB_UNLIKELY (i >= num)
) return Null##Type; \
if (
HB_UNLIKELY (!array[i].offset)
) return Null##Type; \
return *(const Type *)((const char*)this + array[i].offset); \
} \
inline const Tag& get_tag (unsigned int i) const { \
if (
i >= num
) return NullTag; \
if (
HB_UNLIKELY (i >= num)
) return NullTag; \
return array[i].tag; \
} \
/* TODO: implement find_tag() */
...
...
@@ -95,7 +83,7 @@
#define DEFINE_LIST_ACCESSOR(Type, name) \
inline const Type##List& get_##name##_list (void) const { \
if (
!name##List
) return Null##Type##List; \
if (
HB_UNLIKELY (!name##List)
) return Null##Type##List; \
return *(const Type##List *)((const char*)this + name##List); \
} \
inline const Type& get_##name (unsigned int i) const { \
...
...
@@ -140,7 +128,7 @@
#define DEFINE_ACCESSOR(Type, name, Name) \
inline const Type& name (void) const { \
if (
!Name
) return Null##Type; \
if (
HB_UNLIKELY (!Name)
) return Null##Type; \
return *(const Type*)((const char*)this + Name); \
}
...
...
@@ -368,7 +356,7 @@ struct OpenTypeFontFile {
}
}
inline
const
OpenTypeFontFace
&
operator
[]
(
unsigned
int
i
)
const
{
if
(
i
>=
get_len
(
))
return
NullOpenTypeFontFace
;
if
(
HB_UNLIKELY
(
i
>=
get_len
()
))
return
NullOpenTypeFontFace
;
switch
(
tag
)
{
default:
case
TrueTypeTag
:
case
CFFTag
:
return
(
const
OffsetTable
&
)
*
this
;
case
TTCTag
:
return
((
const
TTCHeader
&
)
*
this
)[
i
];
...
...
@@ -435,7 +423,7 @@ struct Script {
return
defaultLangSys
!=
0
;
}
inline
const
LangSys
&
get_default_language_system
(
void
)
const
{
if
(
!
defaultLangSys
)
if
(
HB_UNLIKELY
(
!
defaultLangSys
)
)
return
NullLangSys
;
return
*
(
LangSys
*
)((
const
char
*
)
this
+
defaultLangSys
);
}
...
...
@@ -557,7 +545,7 @@ struct CoverageFormat1 {
GlyphID
gid
;
gid
=
glyph_id
;
// TODO: bsearch
for
(
int
i
=
0
;
i
<
glyphCount
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
glyphCount
;
i
++
)
if
(
gid
==
glyphArray
[
i
])
return
i
;
return
-
1
;
...
...
@@ -592,7 +580,7 @@ struct CoverageFormat2 {
inline
int
get_coverage
(
uint16_t
glyph_id
)
const
{
// TODO: bsearch
for
(
int
i
=
0
;
i
<
rangeCount
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
rangeCount
;
i
++
)
{
int
coverage
=
rangeRecord
[
i
].
get_coverage
(
glyph_id
);
if
(
coverage
>=
0
)
return
coverage
;
...
...
src/hb-private.h
浏览文件 @
12360f7c
#ifndef HB_PRIVATE_H
#define HB_PRIVATE_H
#include <glib.h>
/* Macros to convert to/from BigEndian */
#define hb_be_uint8_t
#define hb_be_int8_t
#define hb_be_uint16_t GUINT16_TO_BE
#define hb_be_int16_t GINT16_TO_BE
#define hb_be_uint32_t GUINT32_TO_BE
#define hb_be_int32_t GINT32_TO_BE
#define hb_be_uint64_t GUINT64_TO_BE
#define hb_be_int64_t GINT64_TO_BE
#define HB_LIKELY G_LIKEYLY
#define HB_UNLIKELY G_UNLIKELY
#include <assert.h>
#define _ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录