Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
087733dd
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看板
提交
087733dd
编写于
4月 18, 2014
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[coretext] Use CGFont as face_data
上级
d277c3d7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
17 deletion
+9
-17
src/hb-coretext.cc
src/hb-coretext.cc
+9
-17
未找到文件。
src/hb-coretext.cc
浏览文件 @
087733dd
...
...
@@ -27,6 +27,7 @@
*/
#define HB_SHAPER coretext
#define hb_coretext_shaper_face_data_t CGFont
#include "hb-shaper-impl-private.hh"
#include "hb-coretext.h"
...
...
@@ -77,10 +78,6 @@ HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font)
* shaper face data
*/
struct
hb_coretext_shaper_face_data_t
{
CGFontRef
cg_font
;
};
static
void
release_data
(
void
*
info
,
const
void
*
data
,
size_t
size
)
{
...
...
@@ -93,13 +90,11 @@ release_data (void *info, const void *data, size_t size)
hb_coretext_shaper_face_data_t
*
_hb_coretext_shaper_face_data_create
(
hb_face_t
*
face
)
{
hb_coretext_shaper_face_data_t
*
data
=
(
hb_coretext_shaper_face_data_t
*
)
calloc
(
1
,
sizeof
(
hb_coretext_shaper_face_data_t
));
if
(
unlikely
(
!
data
))
return
NULL
;
hb_coretext_shaper_face_data_t
*
data
=
NULL
;
if
(
face
->
destroy
==
(
hb_destroy_func_t
)
CGFontRelease
)
{
data
->
cg_font
=
CGFontRetain
((
CGFontRef
)
face
->
user_data
);
data
=
CGFontRetain
((
CGFontRef
)
face
->
user_data
);
}
else
{
...
...
@@ -110,14 +105,12 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face)
DEBUG_MSG
(
CORETEXT
,
face
,
"Face has empty blob"
);
CGDataProviderRef
provider
=
CGDataProviderCreateWithData
(
blob
,
blob_data
,
blob_length
,
&
release_data
);
data
->
cg_font
=
CGFontCreateWithDataProvider
(
provider
);
data
=
CGFontCreateWithDataProvider
(
provider
);
CGDataProviderRelease
(
provider
);
}
if
(
unlikely
(
!
data
->
cg_font
))
{
if
(
unlikely
(
!
data
))
{
DEBUG_MSG
(
CORETEXT
,
face
,
"Face CGFontCreateWithDataProvider() failed"
);
free
(
data
);
return
NULL
;
}
return
data
;
...
...
@@ -126,8 +119,7 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face)
void
_hb_coretext_shaper_face_data_destroy
(
hb_coretext_shaper_face_data_t
*
data
)
{
CFRelease
(
data
->
cg_font
);
free
(
data
);
CFRelease
(
data
);
}
CGFontRef
...
...
@@ -135,7 +127,7 @@ hb_coretext_face_get_cg_font (hb_face_t *face)
{
if
(
unlikely
(
!
hb_coretext_shaper_face_data_ensure
(
face
)))
return
NULL
;
hb_coretext_shaper_face_data_t
*
face_data
=
HB_SHAPER_DATA_GET
(
face
);
return
face_data
->
cg_font
;
return
face_data
;
}
...
...
@@ -159,7 +151,7 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font)
hb_face_t
*
face
=
font
->
face
;
hb_coretext_shaper_face_data_t
*
face_data
=
HB_SHAPER_DATA_GET
(
face
);
data
->
ct_font
=
CTFontCreateWithGraphicsFont
(
face_data
->
cg_font
,
font
->
y_scale
,
NULL
,
NULL
);
data
->
ct_font
=
CTFontCreateWithGraphicsFont
(
face_data
,
font
->
y_scale
,
NULL
,
NULL
);
if
(
unlikely
(
!
data
->
ct_font
))
{
DEBUG_MSG
(
CORETEXT
,
font
,
"Font CTFontCreateWithGraphicsFont() failed"
);
free
(
data
);
...
...
@@ -698,7 +690,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
CFDictionaryRef
attributes
=
CTRunGetAttributes
(
run
);
CTFontRef
run_ct_font
=
static_cast
<
CTFontRef
>
(
CFDictionaryGetValue
(
attributes
,
kCTFontAttributeName
));
CGFontRef
run_cg_font
=
CTFontCopyGraphicsFont
(
run_ct_font
,
0
);
if
(
!
CFEqual
(
run_cg_font
,
face_data
->
cg_font
))
if
(
!
CFEqual
(
run_cg_font
,
face_data
))
{
CFRelease
(
run_cg_font
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录