Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
b9d7688f
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
b9d7688f
编写于
1月 23, 2008
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Finish and test GDEF
上级
303fe628
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
77 addition
and
32 deletion
+77
-32
src/harfbuzz-gdef-private.h
src/harfbuzz-gdef-private.h
+51
-21
src/harfbuzz-open-private.h
src/harfbuzz-open-private.h
+12
-11
src/harfbuzz-open.h
src/harfbuzz-open.h
+4
-0
src/main.cc
src/main.cc
+10
-0
未找到文件。
src/harfbuzz-gdef-private.h
浏览文件 @
b9d7688f
...
...
@@ -3,27 +3,6 @@
#include "harfbuzz-open-private.h"
struct
GDEFHeader
{
/* TODO */
private:
Fixed
version
;
/* Version of the GDEF table--initially
* 0x00010000 */
Offset
glyphClassDef
;
/* Offset to class definition table
* for glyph type--from beginning of
* GDEF header (may be NULL) */
Offset
attachList
;
/* Offset to list of glyphs with
* attachment points--from beginning
* of GDEF header (may be NULL) */
Offset
ligCaretList
;
/* Offset to list of positioning points
* for ligature carets--from beginning
* of GDEF header (may be NULL) */
Offset
markAttachClassDef
;
/* Offset to class definition table for
* mark attachment type--from beginning
* of GDEF header (may be NULL) */
};
ASSERT_SIZE
(
GDEFHeader
,
12
);
struct
GlyphClassDef
:
ClassDef
{
static
const
uint16_t
BaseGlyph
=
0x0001u
;
static
const
uint16_t
LigatureGlyph
=
0x0002u
;
...
...
@@ -180,4 +159,55 @@ struct CaretValue {
}
u
;
};
#define DEFINE_ACCESSOR0(const, Type, name, Name) \
inline const Type* name (void) const { \
if (!Name) return NULL; \
return (const Type *)((const char*)this + Name); \
}
#define DEFINE_ACCESSOR(Type, name, Name) \
DEFINE_ACCESSOR0(const, Type, name, Name) \
DEFINE_ACCESSOR0( , Type, name, Name)
struct
GDEFHeader
{
DEFINE_ACCESSOR
(
ClassDef
,
get_glyph_class_def
,
glyphClassDef
);
DEFINE_ACCESSOR
(
AttachList
,
get_attach_list
,
attachList
);
DEFINE_ACCESSOR
(
LigCaretList
,
get_lig_caret_list
,
ligCaretList
);
DEFINE_ACCESSOR
(
ClassDef
,
get_mark_attach_class_def
,
markAttachClassDef
);
/* Returns 0 if not found. */
inline
int
get_glyph_class
(
uint16_t
glyph_id
)
const
{
const
ClassDef
*
class_def
=
get_glyph_class_def
();
if
(
!
class_def
)
return
0
;
return
class_def
->
get_class
(
glyph_id
);
}
/* Returns 0 if not found. */
inline
int
get_mark_attachment_type
(
uint16_t
glyph_id
)
const
{
const
ClassDef
*
class_def
=
get_mark_attach_class_def
();
if
(
!
class_def
)
return
0
;
return
class_def
->
get_class
(
glyph_id
);
}
/* TODO get_attach and get_lig_caret */
private:
Fixed
version
;
/* Version of the GDEF table--initially
* 0x00010000 */
Offset
glyphClassDef
;
/* Offset to class definition table
* for glyph type--from beginning of
* GDEF header (may be NULL) */
Offset
attachList
;
/* Offset to list of glyphs with
* attachment points--from beginning
* of GDEF header (may be NULL) */
Offset
ligCaretList
;
/* Offset to list of positioning points
* for ligature carets--from beginning
* of GDEF header (may be NULL) */
Offset
markAttachClassDef
;
/* Offset to class definition table for
* mark attachment type--from beginning
* of GDEF header (may be NULL) */
};
ASSERT_SIZE
(
GDEFHeader
,
12
);
#endif
/* HARFBUZZ_GDEF_PRIVATE_H */
src/harfbuzz-open-private.h
浏览文件 @
b9d7688f
...
...
@@ -175,6 +175,7 @@ struct Tag {
inline
Tag
(
const
char
*
c
)
{
v
[
0
]
=
c
[
0
];
v
[
1
]
=
c
[
1
];
v
[
2
]
=
c
[
2
];
v
[
3
]
=
c
[
3
];
}
inline
bool
operator
==
(
Tag
o
)
const
{
return
v
[
0
]
==
o
.
v
[
0
]
&&
v
[
1
]
==
o
.
v
[
1
]
&&
v
[
2
]
==
o
.
v
[
2
]
&&
v
[
3
]
==
o
.
v
[
3
];
}
inline
bool
operator
==
(
const
char
*
c
)
const
{
return
v
[
0
]
==
c
[
0
]
&&
v
[
1
]
==
c
[
1
]
&&
v
[
2
]
==
c
[
2
]
&&
v
[
3
]
==
c
[
3
];
}
inline
bool
operator
==
(
uint32_t
i
)
const
{
return
i
==
(
uint32_t
)
*
this
;
}
inline
operator
uint32_t
(
void
)
const
{
return
(
v
[
0
]
<<
24
)
+
(
v
[
1
]
<<
16
)
+
(
v
[
2
]
<<
8
)
+
v
[
3
];
}
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
inline
operator
const
char
*
(
void
)
const
{
return
(
const
char
*
)
this
;
}
...
...
@@ -399,6 +400,8 @@ struct Script {
return
(
LangSys
*
)((
char
*
)
this
+
defaultLangSys
);
}
/* TODO implement find_language_system based on find_tag */
private:
Offset
defaultLangSys
;
/* Offset to DefaultLangSys table--from
* beginning of Script table--may be NULL */
...
...
@@ -420,6 +423,8 @@ struct LangSys {
return
reqFeatureIndex
;;
}
/* TODO implement find_feature */
private:
Offset
lookupOrder
;
/* = NULL (reserved for an offset to a
* reordering table) */
...
...
@@ -674,8 +679,8 @@ struct ClassDef {
/* Returns 0 if not found. */
inline
int
get_class
(
uint16_t
glyph_id
)
const
{
switch
(
u
.
classFormat
)
{
case
1
:
u
.
format1
.
get_class
(
glyph_id
);
case
2
:
u
.
format2
.
get_class
(
glyph_id
);
case
1
:
return
u
.
format1
.
get_class
(
glyph_id
);
case
2
:
return
u
.
format2
.
get_class
(
glyph_id
);
default:
return
0
;
}
}
...
...
@@ -740,7 +745,7 @@ ASSERT_SIZE (Device, 6);
assert (name##List); \
return (const Type##List *)((const char*)this + name##List); \
} \
inline const Type& name (unsigned int i) const { \
inline const Type&
get_##
name (unsigned int i) const { \
return (*get_##name##_list())[i]; \
}
#define DEFINE_LIST_ACCESSOR(Type, name) \
...
...
@@ -749,15 +754,11 @@ ASSERT_SIZE (Device, 6);
struct
GSUBGPOSHeader
{
/*
inline unsigned int get_size (void) const {
return offsetof (GSUBGPOSHeader, padding);
}
*/
DEFINE_LIST_ACCESSOR
(
Script
,
script
);
/* get_script_list, get_script(i) */
DEFINE_LIST_ACCESSOR
(
Feature
,
feature
);
/* get_feature_list, get_feature(i) */
DEFINE_LIST_ACCESSOR
(
Lookup
,
lookup
);
/* get_lookup_list, get_lookup(i) */
DEFINE_LIST_ACCESSOR
(
Script
,
script
);
/* get_script_list and script(i) */
DEFINE_LIST_ACCESSOR
(
Feature
,
feature
);
/* get_feature_list and feature(i) */
DEFINE_LIST_ACCESSOR
(
Lookup
,
lookup
);
/* get_lookup_list and lookup(i) */
/* TODO implement find_script */
private:
Fixed_Version
version
;
/* Version of the GSUB/GPOS table--initially set
...
...
src/harfbuzz-open.h
浏览文件 @
b9d7688f
...
...
@@ -7,6 +7,10 @@ HARFBUZZ_BEGIN_DECLS();
typedef
uint32_t
hb_tag_t
;
#define HB_TAG(a,b,c,d) ((hb_tag_t)(((uint8_t)a<<24)|((uint8_t)b<<16)|((uint8_t)c<<8)|(uint8_t)d))
#define HB_TAG_STR(s) (HB_TAG(((const char *) s)[0], \
((const char *) s)[1], \
((const char *) s)[2], \
((const char *) s)[3]))
HARFBUZZ_END_DECLS
();
...
...
src/main.cc
浏览文件 @
b9d7688f
...
...
@@ -91,6 +91,16 @@ main (int argc, char **argv)
printf
(
" Lookup %2d of %2d: type %d, flags %04x
\n
"
,
n_lookup
+
1
,
num_lookups
,
lookup
.
get_type
(),
lookup
.
get_flag
());
}
}
else
if
(
table
.
get_tag
()
==
"GDEF"
)
{
const
GDEFHeader
&
gdef
=
(
const
GDEFHeader
&
)
*
ot
[
table
];
/*
for (int glyph = 0; glyph < 1000; glyph++)
printf (" glyph %d has class %d and mark attachment type %d\n",
glyph,
gdef.get_glyph_class (glyph),
gdef.get_mark_attachment_type (glyph));
*/
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录