Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
600e5eb8
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
600e5eb8
编写于
1月 23, 2008
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Define get_for_data() factories
上级
b9d7688f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
19 deletion
+36
-19
src/harfbuzz-gdef-private.h
src/harfbuzz-gdef-private.h
+3
-0
src/harfbuzz-open-private.h
src/harfbuzz-open-private.h
+29
-13
src/main.cc
src/main.cc
+4
-6
未找到文件。
src/harfbuzz-gdef-private.h
浏览文件 @
600e5eb8
...
...
@@ -170,6 +170,9 @@ struct CaretValue {
DEFINE_ACCESSOR0( , Type, name, Name)
struct
GDEFHeader
{
static
const
hb_tag_t
GDEFTag
=
HB_TAG
(
'G'
,
'D'
,
'E'
,
'F'
);
STATIC_DEFINE_GET_FOR_DATA
(
GDEFHeader
);
DEFINE_ACCESSOR
(
ClassDef
,
get_glyph_class_def
,
glyphClassDef
);
DEFINE_ACCESSOR
(
AttachList
,
get_attach_list
,
attachList
);
...
...
src/harfbuzz-open-private.h
浏览文件 @
600e5eb8
...
...
@@ -49,10 +49,6 @@
DEFINE_LEN(Type, array, num) \
DEFINE_SIZE(Type, array, num)
#define DEFINE_NON_INSTANTIABLE(Type) \
private: inline Type() {}
/* cannot be instantiated */
\
public:
/* An array type is one that contains a variable number of objects
* as its last item. An array object is extended with len() and size()
* methods, as well as overloaded [] operator. */
...
...
@@ -98,6 +94,30 @@
/*
* Class features
*/
/* makes class uninstantiable. should be used for union classes that don't
* contain any complete type */
#define DEFINE_NON_INSTANTIABLE(Type) \
private: inline Type() {}
/* cannot be instantiated */
\
public:
/* get_for_data() is a static class method returning a reference to an
* instance of Type located at the input data location. It's just a
* fancy cast! */
#define STATIC_DEFINE_GET_FOR_DATA0(const, Type) \
static inline const Type& get_for_data (const char *data) { \
return *(const Type*)data; \
}
#define STATIC_DEFINE_GET_FOR_DATA(Type) \
STATIC_DEFINE_GET_FOR_DATA0(const, Type) \
STATIC_DEFINE_GET_FOR_DATA0( , Type)
/*
*
* The OpenType Font File
...
...
@@ -293,15 +313,7 @@ struct OpenTypeFontFile {
static
const
hb_tag_t
CFFTag
=
HB_TAG
(
'O'
,
'T'
,
'T'
,
'O'
);
static
const
hb_tag_t
TTCTag
=
HB_TAG
(
't'
,
't'
,
'c'
,
'f'
);
/* Factory: ::get(font_data)
* This is how you get a handle to one of these
*/
static
inline
const
OpenTypeFontFile
&
get
(
const
char
*
font_data
)
{
return
(
const
OpenTypeFontFile
&
)
*
font_data
;
}
static
inline
OpenTypeFontFile
&
get
(
char
*
font_data
)
{
return
(
OpenTypeFontFile
&
)
*
font_data
;
}
STATIC_DEFINE_GET_FOR_DATA
(
OpenTypeFontFile
);
/* This is how you get a table */
inline
const
char
*
get_table
(
const
OpenTypeTable
&
table
)
const
{
...
...
@@ -753,6 +765,10 @@ ASSERT_SIZE (Device, 6);
DEFINE_LIST_ACCESSOR0( , Type, name)
struct
GSUBGPOSHeader
{
static
const
hb_tag_t
GSUBTag
=
HB_TAG
(
'G'
,
'S'
,
'U'
,
'B'
);
static
const
hb_tag_t
GPOSTag
=
HB_TAG
(
'G'
,
'P'
,
'O'
,
'S'
);
STATIC_DEFINE_GET_FOR_DATA
(
GSUBGPOSHeader
);
DEFINE_LIST_ACCESSOR
(
Script
,
script
);
/* get_script_list, get_script(i) */
DEFINE_LIST_ACCESSOR
(
Feature
,
feature
);
/* get_feature_list, get_feature(i) */
...
...
src/main.cc
浏览文件 @
600e5eb8
...
...
@@ -18,7 +18,7 @@ main (int argc, char **argv)
printf
(
"Opened font file %s: %d bytes long
\n
"
,
argv
[
1
],
len
);
const
OpenTypeFontFile
&
ot
=
OpenTypeFontFile
::
get
(
font_data
);
const
OpenTypeFontFile
&
ot
=
OpenTypeFontFile
::
get
_for_data
(
font_data
);
switch
(
ot
.
get_tag
())
{
case
OpenTypeFontFile
::
TrueTypeTag
:
...
...
@@ -49,7 +49,7 @@ main (int argc, char **argv)
(
const
char
*
)
table
.
get_tag
(),
table
.
get_offset
(),
table
.
get_length
());
if
(
table
.
get_tag
()
==
"GSUB"
||
table
.
get_tag
()
==
"GPOS"
)
{
const
GSUBGPOSHeader
&
g
=
(
const
GSUBGPOSHeader
&
)
*
ot
[
table
]
;
const
GSUBGPOSHeader
&
g
=
GSUBGPOSHeader
::
get_for_data
(
ot
[
table
])
;
const
ScriptList
&
scripts
=
*
g
.
get_script_list
();
int
num_scripts
=
scripts
.
get_len
();
...
...
@@ -92,15 +92,13 @@ main (int argc, char **argv)
lookup
.
get_type
(),
lookup
.
get_flag
());
}
}
else
if
(
table
.
get_tag
()
==
"GDEF"
)
{
const
GDEFHeader
&
gdef
=
(
const
GDEFHeader
&
)
*
ot
[
table
]
;
const
GDEFHeader
&
gdef
=
GDEFHeader
::
get_for_data
(
ot
[
table
])
;
/*
for (int glyph = 0; glyph < 1000; glyph++)
for
(
int
glyph
=
0
;
glyph
<
1
;
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录