Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
5f810363
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5f810363
编写于
5月 17, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[HB] Add ArrayOf<>
上级
238c855f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
71 addition
and
68 deletion
+71
-68
src/hb-ot-layout-gdef-private.h
src/hb-ot-layout-gdef-private.h
+14
-48
src/hb-ot-layout-open-private.h
src/hb-ot-layout-open-private.h
+57
-20
未找到文件。
src/hb-ot-layout-gdef-private.h
浏览文件 @
5f810363
...
...
@@ -32,9 +32,9 @@
#include "hb-ot-layout-open-private.h"
#define DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP(Type, name) \
#define DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP(Type,
array,
name) \
inline const Type& name (hb_codepoint_t glyph) { \
return
(*this)
[(this+coverage)(glyph)]; \
return
this+array
[(this+coverage)(glyph)]; \
}
...
...
@@ -50,42 +50,23 @@ struct GlyphClassDef : ClassDef {
*/
struct
AttachPoint
{
friend
struct
AttachList
;
private:
/* countour point indices, in increasing numerical order */
DEFINE_ARRAY_TYPE
(
USHORT
,
pointIndex
,
pointCount
);
private:
USHORT
pointCount
;
/* Number of attachment points on
* this glyph */
USHORT
pointIndex
[];
/* Array of contour point indices--in
Array
pointIndex
;
/* Array of contour point indices--in
* increasing numerical order */
};
ASSERT_SIZE
(
AttachPoint
,
2
);
struct
AttachList
{
friend
struct
GDEF
;
private:
/* const AttachPoint& get_attach_points (hb_codepoint_t glyph); */
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
AttachPoint
,
get_attach_points
);
private:
/* AttachPoint tables, in Coverage Index order */
DEFINE_OFFSET_ARRAY_TYPE
(
AttachPoint
,
attachPoint
,
glyphCount
);
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
AttachPoint
,
attachPoint
,
get_attach_points
);
private:
OffsetTo
<
Coverage
>
coverage
;
/* Offset to Coverage table -- from
* beginning of AttachList table */
USHORT
glyphCount
;
/* Number of glyphs with attachment
* points */
Offset
attachPoint
[];
/* Array of offsets to AttachPoint
* tables--from beginning of AttachList
* table--in Coverage Index order */
OffsetArrayOf
<
AttachPoint
>
attachPoint
;
/* Array of AttachPoint tables
* in Coverage Index order */
};
ASSERT_SIZE
(
AttachList
,
4
);
...
...
@@ -171,18 +152,9 @@ struct LigGlyph {
friend
struct
LigCaretList
;
private:
/* Caret value tables, in increasing coordinate order */
DEFINE_OFFSET_ARRAY_TYPE
(
CaretValue
,
caretValue
,
caretCount
);
/* TODO */
private:
USHORT
caretCount
;
/* Number of CaretValues for this
* ligature (components - 1) */
Offset
caretValue
[];
/* Array of offsets to CaretValue
* tables--from beginning of LigGlyph
* table--in increasing coordinate
* order */
OffsetArrayOf
<
CaretValue
>
caret
;
/* Array of CaretValue tables
* in increasing coordinate order */
};
ASSERT_SIZE
(
LigGlyph
,
2
);
...
...
@@ -192,21 +164,15 @@ struct LigCaretList {
private:
/* const LigGlyph& get_lig_glyph (hb_codepoint_t glyph); */
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
LigGlyph
,
get_lig_glyph
);
private:
/* LigGlyph tables, in Coverage Index order */
DEFINE_OFFSET_ARRAY_TYPE
(
LigGlyph
,
ligGlyph
,
ligGlyphCount
);
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
LigGlyph
,
ligGlyph
,
get_lig_glyph
);
private:
OffsetTo
<
Coverage
>
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 */
OffsetArrayOf
<
LigGlyph
>
ligGlyph
;
/* Array of LigGlyph tables
* in Coverage Index order */
};
ASSERT_SIZE
(
LigCaretList
,
4
);
...
...
src/hb-ot-layout-open-private.h
浏览文件 @
5f810363
...
...
@@ -40,26 +40,6 @@
#define MAX_NESTING_LEVEL 32
/*
* Int types
*/
/* XXX define these as structs of chars on machines that do not allow
* unaligned access (using templates?). */
#define DEFINE_INT_TYPE1(NAME, TYPE, BIG_ENDIAN) \
inline NAME& operator = (TYPE i) { v = BIG_ENDIAN(i); return *this; } \
inline operator TYPE(void) const { return BIG_ENDIAN(v); } \
inline bool operator== (NAME o) const { return v == o.v; } \
private: TYPE v; \
public:
#define DEFINE_INT_TYPE0(NAME, type) DEFINE_INT_TYPE1 (NAME, type, hb_be_##type)
#define DEFINE_INT_TYPE(NAME, u, w) DEFINE_INT_TYPE0 (NAME, u##int##w##_t)
#define DEFINE_INT_TYPE_STRUCT(NAME, u, w) \
struct NAME { \
DEFINE_INT_TYPE(NAME, u, w) \
}; \
ASSERT_SIZE (NAME, w / 8)
/*
* Array types
*/
...
...
@@ -254,6 +234,26 @@ struct Null <Type> { \
/* "The following data types are used in the OpenType font file.
* All OpenType fonts use Motorola-style byte ordering (Big Endian):" */
/*
* Int types
*/
/* XXX define these as structs of chars on machines that do not allow
* unaligned access (using templates?). */
#define DEFINE_INT_TYPE1(NAME, TYPE, BIG_ENDIAN) \
inline NAME& operator = (TYPE i) { v = BIG_ENDIAN(i); return *this; } \
inline operator TYPE(void) const { return BIG_ENDIAN(v); } \
inline bool operator== (NAME o) const { return v == o.v; } \
private: TYPE v; \
public:
#define DEFINE_INT_TYPE0(NAME, type) DEFINE_INT_TYPE1 (NAME, type, hb_be_##type)
#define DEFINE_INT_TYPE(NAME, u, w) DEFINE_INT_TYPE0 (NAME, u##int##w##_t)
#define DEFINE_INT_TYPE_STRUCT(NAME, u, w) \
struct NAME { \
DEFINE_INT_TYPE(NAME, u, w) \
}; \
ASSERT_SIZE (NAME, w / 8)
DEFINE_INT_TYPE_STRUCT
(
BYTE
,
u
,
8
);
/* 8-bit unsigned integer. */
DEFINE_INT_TYPE_STRUCT
(
CHAR
,
,
8
);
/* 8-bit signed integer. */
...
...
@@ -371,6 +371,43 @@ struct Fixed_Version : Fixed {
};
ASSERT_SIZE
(
Fixed_Version
,
4
);
/*
* Array Types
*/
/* An array with a USHORT number of elements. */
template
<
typename
Type
>
struct
ArrayOf
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
if
(
HB_UNLIKELY
(
i
>=
len
))
return
Null
(
Type
);
return
array
[
i
];
}
USHORT
len
;
private:
Type
array
[];
};
/* Array of USHORT's */
typedef
ArrayOf
<
USHORT
>
Array
;
/* Array of Offset's */
template
<
typename
Type
>
struct
OffsetArrayOf
:
ArrayOf
<
OffsetTo
<
Type
>
>
{
};
/* An array type is one that contains a variable number of objects
* as its last item. An array object is extended with get_len()
* methods, as well as overloaded [] operator. */
#define DEFINE_ARRAY_TYPE(Type, array, num) \
DEFINE_INDEX_OPERATOR(Type, array, num) \
DEFINE_LEN(Type, array, num)
#define DEFINE_INDEX_OPERATOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
if (HB_UNLIKELY (i >= num)) return Null(Type); \
return array[i]; \
}
/*
* Organization of an OpenType Font
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录