Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
0b08adb3
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,发现更多精彩内容 >>
提交
0b08adb3
编写于
4月 23, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add hb_set_t
上级
5b93e8d9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
313 addition
and
49 deletion
+313
-49
TODO
TODO
+2
-0
src/Makefile.am
src/Makefile.am
+3
-0
src/hb-ot-layout-common-private.hh
src/hb-ot-layout-common-private.hh
+1
-0
src/hb-ot-layout-private.hh
src/hb-ot-layout-private.hh
+0
-47
src/hb-ot-layout.h
src/hb-ot-layout.h
+0
-2
src/hb-set-private.hh
src/hb-set-private.hh
+95
-0
src/hb-set.cc
src/hb-set.cc
+120
-0
src/hb-set.h
src/hb-set.h
+91
-0
src/hb.h
src/hb.h
+1
-0
未找到文件。
TODO
浏览文件 @
0b08adb3
...
...
@@ -85,6 +85,8 @@ Tests to write:
- GObject, FreeType, etc
- hb_set_t
Optimizations:
=============
...
...
src/Makefile.am
浏览文件 @
0b08adb3
...
...
@@ -34,6 +34,8 @@ HBSOURCES = \
hb-ot-name-table.hh
\
hb-ot-tag.cc
\
hb-private.hh
\
hb-set-private.hh
\
hb-set.cc
\
hb-shape.cc
\
hb-tt-font.cc
\
hb-unicode-private.hh
\
...
...
@@ -46,6 +48,7 @@ HBHEADERS = \
hb-buffer.h
\
hb-common.h
\
hb-font.h
\
hb-set.h
\
hb-shape.h
\
hb-unicode.h
\
hb-version.h
\
...
...
src/hb-ot-layout-common-private.hh
浏览文件 @
0b08adb3
...
...
@@ -31,6 +31,7 @@
#include "hb-ot-layout-private.hh"
#include "hb-open-type-private.hh"
#include "hb-set-private.hh"
#define NO_CONTEXT ((unsigned int) 0x110000)
...
...
src/hb-ot-layout-private.hh
浏览文件 @
0b08adb3
...
...
@@ -95,51 +95,4 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout);
struct
_hb_set_t
{
void
clear
(
void
)
{
memset
(
elts
,
0
,
sizeof
elts
);
}
bool
add
(
hb_codepoint_t
g
)
{
if
(
unlikely
(
g
>
MAX_G
))
return
false
;
elt_t
&
e
=
elt
(
g
);
elt_t
m
=
mask
(
g
);
bool
ret
=
!!
(
e
&
m
);
e
|=
m
;
return
ret
;
}
bool
has
(
hb_codepoint_t
g
)
const
{
if
(
unlikely
(
g
>
MAX_G
))
return
false
;
return
!!
(
elt
(
g
)
&
mask
(
g
));
}
bool
intersects
(
hb_codepoint_t
first
,
hb_codepoint_t
last
)
const
{
if
(
unlikely
(
first
>
MAX_G
))
return
false
;
if
(
unlikely
(
last
>
MAX_G
))
last
=
MAX_G
;
unsigned
int
end
=
last
+
1
;
for
(
hb_codepoint_t
i
=
first
;
i
<
end
;
i
++
)
if
(
has
(
i
))
return
true
;
return
false
;
}
private:
typedef
uint32_t
elt_t
;
static
const
unsigned
int
MAX_G
=
65536
-
1
;
static
const
unsigned
int
SHIFT
=
5
;
static
const
unsigned
int
BITS
=
(
1
<<
SHIFT
);
static
const
unsigned
int
MASK
=
BITS
-
1
;
elt_t
&
elt
(
hb_codepoint_t
g
)
{
return
elts
[
g
>>
SHIFT
];
}
elt_t
elt
(
hb_codepoint_t
g
)
const
{
return
elts
[
g
>>
SHIFT
];
}
elt_t
mask
(
hb_codepoint_t
g
)
const
{
return
elt_t
(
1
)
<<
(
g
&
MASK
);
}
elt_t
elts
[(
MAX_G
+
1
+
(
BITS
-
1
))
/
BITS
];
/* 8kb */
ASSERT_STATIC
(
sizeof
(
elt_t
)
*
8
==
BITS
);
ASSERT_STATIC
(
sizeof
(
elts
)
*
8
>
MAX_G
);
};
#endif
/* HB_OT_LAYOUT_PRIVATE_HH */
src/hb-ot-layout.h
浏览文件 @
0b08adb3
...
...
@@ -183,8 +183,6 @@ void
hb_ot_layout_substitute_finish
(
hb_buffer_t
*
buffer
);
typedef
struct
_hb_set_t
hb_set_t
;
hb_bool_t
hb_ot_layout_substitute_closure_lookup
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
,
...
...
src/hb-set-private.hh
0 → 100644
浏览文件 @
0b08adb3
/*
* Copyright © 2012 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
#ifndef HB_SET_PRIVATE_HH
#define HB_SET_PRIVATE_HH
#include "hb-private.hh"
#include "hb-set.h"
#include "hb-object-private.hh"
struct
_hb_set_t
{
inline
void
clear
(
void
)
{
memset
(
elts
,
0
,
sizeof
elts
);
}
inline
bool
add
(
hb_codepoint_t
g
)
{
if
(
unlikely
(
g
>
MAX_G
))
return
false
;
elt_t
&
e
=
elt
(
g
);
elt_t
m
=
mask
(
g
);
bool
ret
=
!
(
e
&
m
);
e
|=
m
;
return
ret
;
}
inline
bool
del
(
hb_codepoint_t
g
)
{
if
(
unlikely
(
g
>
MAX_G
))
return
false
;
elt_t
&
e
=
elt
(
g
);
elt_t
m
=
mask
(
g
);
bool
ret
=
!!
(
e
&
m
);
e
&=
~
m
;
return
ret
;
}
inline
bool
has
(
hb_codepoint_t
g
)
const
{
if
(
unlikely
(
g
>
MAX_G
))
return
false
;
return
!!
(
elt
(
g
)
&
mask
(
g
));
}
inline
bool
intersects
(
hb_codepoint_t
first
,
hb_codepoint_t
last
)
const
{
if
(
unlikely
(
first
>
MAX_G
))
return
false
;
if
(
unlikely
(
last
>
MAX_G
))
last
=
MAX_G
;
unsigned
int
end
=
last
+
1
;
for
(
hb_codepoint_t
i
=
first
;
i
<
end
;
i
++
)
if
(
has
(
i
))
return
true
;
return
false
;
}
typedef
uint32_t
elt_t
;
static
const
unsigned
int
MAX_G
=
65536
-
1
;
static
const
unsigned
int
SHIFT
=
5
;
static
const
unsigned
int
BITS
=
(
1
<<
SHIFT
);
static
const
unsigned
int
MASK
=
BITS
-
1
;
elt_t
&
elt
(
hb_codepoint_t
g
)
{
return
elts
[
g
>>
SHIFT
];
}
elt_t
elt
(
hb_codepoint_t
g
)
const
{
return
elts
[
g
>>
SHIFT
];
}
elt_t
mask
(
hb_codepoint_t
g
)
const
{
return
elt_t
(
1
)
<<
(
g
&
MASK
);
}
hb_object_header_t
header
;
elt_t
elts
[(
MAX_G
+
1
+
(
BITS
-
1
))
/
BITS
];
/* 8kb */
ASSERT_STATIC
(
sizeof
(
elt_t
)
*
8
==
BITS
);
ASSERT_STATIC
(
sizeof
(
elts
)
*
8
>
MAX_G
);
};
#endif
/* HB_SET_PRIVATE_HH */
src/hb-set.cc
0 → 100644
浏览文件 @
0b08adb3
/*
* Copyright © 2012 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
#include "hb-set-private.hh"
static
hb_set_t
_hb_set_nil
=
{
HB_OBJECT_HEADER_STATIC
,
{
0
}
/* elts */
};
hb_set_t
*
hb_set_create
()
{
hb_set_t
*
set
;
if
(
!
(
set
=
hb_object_create
<
hb_set_t
>
()))
return
&
_hb_set_nil
;
set
->
clear
();
return
set
;
}
hb_set_t
*
hb_set_get_empty
(
void
)
{
return
&
_hb_set_nil
;
}
hb_set_t
*
hb_set_reference
(
hb_set_t
*
set
)
{
return
hb_object_reference
(
set
);
}
void
hb_set_destroy
(
hb_set_t
*
set
)
{
if
(
!
hb_object_destroy
(
set
))
return
;
free
(
set
);
}
hb_bool_t
hb_set_set_user_data
(
hb_set_t
*
set
,
hb_user_data_key_t
*
key
,
void
*
data
,
hb_destroy_func_t
destroy
,
hb_bool_t
replace
)
{
return
hb_object_set_user_data
(
set
,
key
,
data
,
destroy
,
replace
);
}
void
*
hb_set_get_user_data
(
hb_set_t
*
set
,
hb_user_data_key_t
*
key
)
{
return
hb_object_get_user_data
(
set
,
key
);
}
hb_bool_t
hb_set_allocation_successful
(
hb_set_t
*
set
)
{
return
TRUE
;
}
void
hb_set_clear
(
hb_set_t
*
set
)
{
set
->
clear
();
}
hb_bool_t
hb_set_has
(
hb_set_t
*
set
,
hb_codepoint_t
codepoint
)
{
return
set
->
has
(
codepoint
);
}
void
hb_set_add
(
hb_set_t
*
set
,
hb_codepoint_t
codepoint
)
{
set
->
add
(
codepoint
);
}
void
hb_set_del
(
hb_set_t
*
set
,
hb_codepoint_t
codepoint
)
{
set
->
del
(
codepoint
);
}
src/hb-set.h
0 → 100644
浏览文件 @
0b08adb3
/*
* Copyright © 2012 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
#ifndef HB_H_IN
#error "Include <hb.h> instead."
#endif
#ifndef HB_SET_H
#define HB_SET_H
#include "hb-common.h"
HB_BEGIN_DECLS
typedef
struct
_hb_set_t
hb_set_t
;
hb_set_t
*
hb_set_create
(
void
);
hb_set_t
*
hb_set_get_empty
(
void
);
hb_set_t
*
hb_set_reference
(
hb_set_t
*
set
);
void
hb_set_destroy
(
hb_set_t
*
set
);
hb_bool_t
hb_set_set_user_data
(
hb_set_t
*
set
,
hb_user_data_key_t
*
key
,
void
*
data
,
hb_destroy_func_t
destroy
,
hb_bool_t
replace
);
void
*
hb_set_get_user_data
(
hb_set_t
*
set
,
hb_user_data_key_t
*
key
);
/* Returns FALSE if allocation has failed before */
hb_bool_t
hb_set_allocation_successful
(
hb_set_t
*
set
);
void
hb_set_clear
(
hb_set_t
*
set
);
hb_bool_t
hb_set_has
(
hb_set_t
*
set
,
hb_codepoint_t
codepoint
);
void
hb_set_add
(
hb_set_t
*
set
,
hb_codepoint_t
codepoint
);
void
hb_set_del
(
hb_set_t
*
set
,
hb_codepoint_t
codepoint
);
/* TODO: add union, intersect, subtract, equal, empty, min, max, iter, etc */
HB_END_DECLS
#endif
/* HB_SET_H */
src/hb.h
浏览文件 @
0b08adb3
...
...
@@ -32,6 +32,7 @@
#include "hb-buffer.h"
#include "hb-common.h"
#include "hb-font.h"
#include "hb-set.h"
#include "hb-shape.h"
#include "hb-unicode.h"
#include "hb-version.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录