Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
3506672c
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看板
提交
3506672c
编写于
8月 06, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Port _nil objects to Null() machinery
Finally, unified!
上级
1abd427a
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
137 addition
and
113 deletion
+137
-113
src/hb-blob-private.hh
src/hb-blob-private.hh
+1
-0
src/hb-blob.cc
src/hb-blob.cc
+15
-14
src/hb-buffer-private.hh
src/hb-buffer-private.hh
+3
-1
src/hb-buffer.cc
src/hb-buffer.cc
+23
-21
src/hb-face-private.hh
src/hb-face-private.hh
+3
-3
src/hb-face.cc
src/hb-face.cc
+3
-2
src/hb-font-private.hh
src/hb-font-private.hh
+6
-4
src/hb-font.cc
src/hb-font.cc
+35
-31
src/hb-null.hh
src/hb-null.hh
+10
-1
src/hb-ot-shape-complex-arabic-fallback.hh
src/hb-ot-shape-complex-arabic-fallback.hh
+5
-6
src/hb-shape-plan-private.hh
src/hb-shape-plan-private.hh
+1
-0
src/hb-shape-plan.cc
src/hb-shape-plan.cc
+26
-24
src/hb-unicode-private.hh
src/hb-unicode-private.hh
+3
-4
src/hb-unicode.cc
src/hb-unicode.cc
+3
-2
未找到文件。
src/hb-blob-private.hh
浏览文件 @
3506672c
...
...
@@ -76,6 +76,7 @@ struct hb_blob_t
void
*
user_data
;
hb_destroy_func_t
destroy
;
};
DECLARE_NULL_INSTANCE
(
hb_blob_t
);
#endif
/* HB_BLOB_PRIVATE_HH */
src/hb-blob.cc
浏览文件 @
3506672c
...
...
@@ -45,6 +45,20 @@
#include <stdlib.h>
DEFINE_NULL_INSTANCE
(
hb_blob_t
)
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
nullptr
,
/* data */
0
,
/* length */
HB_MEMORY_MODE_READONLY
,
/* mode */
nullptr
,
/* user_data */
nullptr
/* destroy */
};
/**
* hb_blob_create: (skip)
* @data: Pointer to blob data.
...
...
@@ -182,20 +196,7 @@ hb_blob_copy_writable_or_fail (hb_blob_t *blob)
hb_blob_t
*
hb_blob_get_empty
(
void
)
{
static
const
hb_blob_t
_hb_blob_nil
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
nullptr
,
/* data */
0
,
/* length */
HB_MEMORY_MODE_READONLY
,
/* mode */
nullptr
,
/* user_data */
nullptr
/* destroy */
};
return
const_cast
<
hb_blob_t
*>
(
&
_hb_blob_nil
);
return
const_cast
<
hb_blob_t
*>
(
&
Null
(
hb_blob_t
));
}
/**
...
...
src/hb-buffer-private.hh
浏览文件 @
3506672c
...
...
@@ -83,7 +83,8 @@ HB_MARK_AS_FLAG_T (hb_buffer_scratch_flags_t);
* hb_buffer_t
*/
struct
hb_buffer_t
{
struct
hb_buffer_t
{
hb_object_header_t
header
;
ASSERT_POD
();
...
...
@@ -352,6 +353,7 @@ struct hb_buffer_t {
info
[
i
].
mask
&=
~
HB_GLYPH_FLAG_UNSAFE_TO_BREAK
;
}
};
DECLARE_NULL_INSTANCE
(
hb_buffer_t
);
/* Loop over clusters. Duplicated in foreach_syllable(). */
...
...
src/hb-buffer.cc
浏览文件 @
3506672c
...
...
@@ -701,6 +701,28 @@ hb_buffer_t::guess_segment_properties (void)
/* Public API */
DEFINE_NULL_INSTANCE
(
hb_buffer_t
)
=
{
HB_OBJECT_HEADER_STATIC
,
const_cast
<
hb_unicode_funcs_t
*>
(
&
_hb_Null_hb_unicode_funcs_t
),
HB_BUFFER_FLAG_DEFAULT
,
HB_BUFFER_CLUSTER_LEVEL_DEFAULT
,
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT
,
HB_BUFFER_SCRATCH_FLAG_DEFAULT
,
HB_BUFFER_MAX_LEN_DEFAULT
,
HB_BUFFER_MAX_OPS_DEFAULT
,
HB_BUFFER_CONTENT_TYPE_INVALID
,
HB_SEGMENT_PROPERTIES_DEFAULT
,
false
,
/* successful */
true
,
/* have_output */
true
/* have_positions */
/* Zero is good enough for everything else. */
};
/**
* hb_buffer_create: (Xconstructor)
*
...
...
@@ -743,27 +765,7 @@ hb_buffer_create (void)
hb_buffer_t
*
hb_buffer_get_empty
(
void
)
{
static
const
hb_buffer_t
_hb_buffer_nil
=
{
HB_OBJECT_HEADER_STATIC
,
const_cast
<
hb_unicode_funcs_t
*>
(
&
_hb_unicode_funcs_nil
),
HB_BUFFER_FLAG_DEFAULT
,
HB_BUFFER_CLUSTER_LEVEL_DEFAULT
,
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT
,
HB_BUFFER_SCRATCH_FLAG_DEFAULT
,
HB_BUFFER_MAX_LEN_DEFAULT
,
HB_BUFFER_MAX_OPS_DEFAULT
,
HB_BUFFER_CONTENT_TYPE_INVALID
,
HB_SEGMENT_PROPERTIES_DEFAULT
,
false
,
/* successful */
true
,
/* have_output */
true
/* have_positions */
/* Zero is good enough for everything else. */
};
return
const_cast
<
hb_buffer_t
*>
(
&
_hb_buffer_nil
);
return
const_cast
<
hb_buffer_t
*>
(
&
Null
(
hb_buffer_t
));
}
/**
...
...
src/hb-face-private.hh
浏览文件 @
3506672c
...
...
@@ -39,7 +39,8 @@
* hb_face_t
*/
struct
hb_face_t
{
struct
hb_face_t
{
hb_object_header_t
header
;
ASSERT_POD
();
...
...
@@ -94,8 +95,7 @@ struct hb_face_t {
HB_INTERNAL
void
load_upem
(
void
)
const
;
HB_INTERNAL
void
load_num_glyphs
(
void
)
const
;
};
extern
HB_INTERNAL
const
hb_face_t
_hb_face_nil
;
DECLARE_NULL_INSTANCE
(
hb_face_t
);
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, face);
...
...
src/hb-face.cc
浏览文件 @
3506672c
...
...
@@ -63,7 +63,8 @@ hb_face_count (hb_blob_t *blob)
* hb_face_t
*/
const
hb_face_t
_hb_face_nil
=
{
DEFINE_NULL_INSTANCE
(
hb_face_t
)
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
...
...
@@ -215,7 +216,7 @@ hb_face_create (hb_blob_t *blob,
hb_face_t
*
hb_face_get_empty
(
void
)
{
return
const_cast
<
hb_face_t
*>
(
&
_hb_face_nil
);
return
const_cast
<
hb_face_t
*>
(
&
Null
(
hb_face_t
)
);
}
...
...
src/hb-font-private.hh
浏览文件 @
3506672c
...
...
@@ -35,7 +35,6 @@
#include "hb-shaper-private.hh"
/*
* hb_font_funcs_t
*/
...
...
@@ -57,7 +56,8 @@
HB_FONT_FUNC_IMPLEMENT (glyph_from_name) \
/* ^--- Add new callbacks here */
struct
hb_font_funcs_t
{
struct
hb_font_funcs_t
{
hb_object_header_t
header
;
ASSERT_POD
();
...
...
@@ -89,14 +89,15 @@ struct hb_font_funcs_t {
])
(
void
);
}
get
;
};
DECLARE_NULL_INSTANCE
(
hb_font_funcs_t
);
/*
* hb_font_t
*/
struct
hb_font_t
{
struct
hb_font_t
{
hb_object_header_t
header
;
ASSERT_POD
();
...
...
@@ -553,6 +554,7 @@ struct hb_font_t {
return
(
float
)
v
*
scale
/
face
->
get_upem
();
}
};
DECLARE_NULL_INSTANCE
(
hb_font_t
);
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, font);
...
...
src/hb-font.cc
浏览文件 @
3506672c
...
...
@@ -341,7 +341,8 @@ hb_font_get_glyph_from_name_parent (hb_font_t *font,
return
font
->
parent
->
get_glyph_from_name
(
name
,
len
,
glyph
);
}
static
const
hb_font_funcs_t
_hb_font_funcs_nil
=
{
DEFINE_NULL_INSTANCE
(
hb_font_funcs_t
)
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
...
...
@@ -364,6 +365,7 @@ static const hb_font_funcs_t _hb_font_funcs_nil = {
}
}
};
static
const
hb_font_funcs_t
_hb_font_funcs_parent
=
{
HB_OBJECT_HEADER_STATIC
,
...
...
@@ -1100,6 +1102,37 @@ hb_font_glyph_from_string (hb_font_t *font,
* hb_font_t
*/
DEFINE_NULL_INSTANCE
(
hb_font_t
)
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
nullptr
,
/* parent */
const_cast
<
hb_face_t
*>
(
&
_hb_Null_hb_face_t
),
1000
,
/* x_scale */
1000
,
/* y_scale */
0
,
/* x_ppem */
0
,
/* y_ppem */
0
,
/* ptem */
0
,
/* num_coords */
nullptr
,
/* coords */
const_cast
<
hb_font_funcs_t
*>
(
&
_hb_Null_hb_font_funcs_t
),
/* klass */
nullptr
,
/* user_data */
nullptr
,
/* destroy */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
}
};
/**
* hb_font_create: (Xconstructor)
* @face: a face.
...
...
@@ -1187,36 +1220,7 @@ hb_font_create_sub_font (hb_font_t *parent)
hb_font_t
*
hb_font_get_empty
(
void
)
{
static
const
hb_font_t
_hb_font_nil
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
nullptr
,
/* parent */
const_cast
<
hb_face_t
*>
(
&
_hb_face_nil
),
1000
,
/* x_scale */
1000
,
/* y_scale */
0
,
/* x_ppem */
0
,
/* y_ppem */
0
,
/* ptem */
0
,
/* num_coords */
nullptr
,
/* coords */
const_cast
<
hb_font_funcs_t
*>
(
&
_hb_font_funcs_nil
),
/* klass */
nullptr
,
/* user_data */
nullptr
,
/* destroy */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
}
};
return
const_cast
<
hb_font_t
*>
(
&
_hb_font_nil
);
return
const_cast
<
hb_font_t
*>
(
&
Null
(
hb_font_t
));
}
/**
...
...
src/hb-null.hh
浏览文件 @
3506672c
...
...
@@ -59,10 +59,19 @@ template <> \
} \
namespace Namespace { \
static_assert (true, "Just so we take semicolon after.")
#define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type) \
const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size]
/* Specializaitons for arbitrary-content Null objects expressed as struct initializer. */
#define DECLARE_NULL_INSTANCE(Type) \
extern HB_INTERNAL const Type _hb_Null_##Type; \
template <> \
/*static*/
inline const Type& Null<Type> (void) { \
return _hb_Null_##Type; \
} \
static_assert (true, "Just so we take semicolon after.")
#define DEFINE_NULL_INSTANCE(Type) \
const Type _hb_Null_##Type
/* Global writable pool. Enlarge as necessary. */
...
...
src/hb-ot-shape-complex-arabic-fallback.hh
浏览文件 @
3506672c
...
...
@@ -205,8 +205,6 @@ struct arabic_fallback_plan_t
hb_ot_layout_lookup_accelerator_t
accel_array
[
ARABIC_FALLBACK_MAX_LOOKUPS
];
};
static
const
arabic_fallback_plan_t
arabic_fallback_plan_nil
=
{};
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_WIN1256)
#define HB_WITH_WIN1256
#endif
...
...
@@ -215,7 +213,8 @@ static const arabic_fallback_plan_t arabic_fallback_plan_nil = {};
#include "hb-ot-shape-complex-arabic-win1256.hh"
#endif
struct
ManifestLookup
{
struct
ManifestLookup
{
OT
::
Tag
tag
;
OT
::
OffsetTo
<
OT
::
SubstLookup
>
lookupOffset
;
};
...
...
@@ -299,7 +298,7 @@ arabic_fallback_plan_create (const hb_ot_shape_plan_t *plan,
{
arabic_fallback_plan_t
*
fallback_plan
=
(
arabic_fallback_plan_t
*
)
calloc
(
1
,
sizeof
(
arabic_fallback_plan_t
));
if
(
unlikely
(
!
fallback_plan
))
return
const_cast
<
arabic_fallback_plan_t
*>
(
&
arabic_fallback_plan_nil
);
return
const_cast
<
arabic_fallback_plan_t
*>
(
&
Null
(
arabic_fallback_plan_t
)
);
fallback_plan
->
num_lookups
=
0
;
fallback_plan
->
free_lookups
=
false
;
...
...
@@ -315,13 +314,13 @@ arabic_fallback_plan_create (const hb_ot_shape_plan_t *plan,
return
fallback_plan
;
free
(
fallback_plan
);
return
const_cast
<
arabic_fallback_plan_t
*>
(
&
arabic_fallback_plan_nil
);
return
const_cast
<
arabic_fallback_plan_t
*>
(
&
Null
(
arabic_fallback_plan_t
)
);
}
static
void
arabic_fallback_plan_destroy
(
arabic_fallback_plan_t
*
fallback_plan
)
{
if
(
!
fallback_plan
||
fallback_plan
==
&
arabic_fallback_plan_nil
)
if
(
!
fallback_plan
||
fallback_plan
==
&
Null
(
arabic_fallback_plan_t
)
)
return
;
for
(
unsigned
int
i
=
0
;
i
<
fallback_plan
->
num_lookups
;
i
++
)
...
...
src/hb-shape-plan-private.hh
浏览文件 @
3506672c
...
...
@@ -51,6 +51,7 @@ struct hb_shape_plan_t
struct
hb_shaper_data_t
shaper_data
;
};
DECLARE_NULL_INSTANCE
(
hb_shape_plan_t
);
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS \
, const hb_feature_t *user_features \
...
...
src/hb-shape-plan.cc
浏览文件 @
3506672c
...
...
@@ -88,6 +88,31 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
* hb_shape_plan_t
*/
DEFINE_NULL_INSTANCE
(
hb_shape_plan_t
)
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* default_shaper_list */
nullptr
,
/* face */
HB_SEGMENT_PROPERTIES_DEFAULT
,
/* props */
nullptr
,
/* shaper_func */
nullptr
,
/* shaper_name */
nullptr
,
/* user_features */
0
,
/* num_user_featurs */
nullptr
,
/* coords */
0
,
/* num_coords */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
}
};
/**
* hb_shape_plan_create: (Xconstructor)
* @face:
...
...
@@ -188,30 +213,7 @@ hb_shape_plan_create2 (hb_face_t *face,
hb_shape_plan_t
*
hb_shape_plan_get_empty
(
void
)
{
static
const
hb_shape_plan_t
_hb_shape_plan_nil
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* default_shaper_list */
nullptr
,
/* face */
HB_SEGMENT_PROPERTIES_DEFAULT
,
/* props */
nullptr
,
/* shaper_func */
nullptr
,
/* shaper_name */
nullptr
,
/* user_features */
0
,
/* num_user_featurs */
nullptr
,
/* coords */
0
,
/* num_coords */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
}
};
return
const_cast
<
hb_shape_plan_t
*>
(
&
_hb_shape_plan_nil
);
return
const_cast
<
hb_shape_plan_t
*>
(
&
Null
(
hb_shape_plan_t
));
}
/**
...
...
src/hb-unicode-private.hh
浏览文件 @
3506672c
...
...
@@ -60,7 +60,8 @@ extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256];
HB_UNICODE_FUNC_IMPLEMENT (hb_script_t, script) \
/* ^--- Add new simple callbacks here */
struct
hb_unicode_funcs_t
{
struct
hb_unicode_funcs_t
{
hb_object_header_t
header
;
ASSERT_POD
();
...
...
@@ -263,9 +264,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
#undef HB_UNICODE_FUNC_IMPLEMENT
}
destroy
;
};
extern
HB_INTERNAL
const
hb_unicode_funcs_t
_hb_unicode_funcs_nil
;
DECLARE_NULL_INSTANCE
(
hb_unicode_funcs_t
);
/* Modified combining marks */
...
...
src/hb-unicode.cc
浏览文件 @
3506672c
...
...
@@ -185,7 +185,8 @@ hb_unicode_funcs_create (hb_unicode_funcs_t *parent)
}
const
hb_unicode_funcs_t
_hb_unicode_funcs_nil
=
{
DEFINE_NULL_INSTANCE
(
hb_unicode_funcs_t
)
=
{
HB_OBJECT_HEADER_STATIC
,
nullptr
,
/* parent */
...
...
@@ -209,7 +210,7 @@ const hb_unicode_funcs_t _hb_unicode_funcs_nil = {
hb_unicode_funcs_t
*
hb_unicode_funcs_get_empty
(
void
)
{
return
const_cast
<
hb_unicode_funcs_t
*>
(
&
_hb_unicode_funcs_nil
);
return
const_cast
<
hb_unicode_funcs_t
*>
(
&
Null
(
hb_unicode_funcs_t
)
);
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录