Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
d4907e83
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,发现更多精彩内容 >>
未验证
提交
d4907e83
编写于
3月 14, 2018
作者:
E
Ebrahim Byagowi
提交者:
GitHub
3月 14, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[dwrite] GCC/mingw/msys2 compatibility (#884)
上级
93f8f89d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
16 deletion
+21
-16
src/hb-directwrite.cc
src/hb-directwrite.cc
+21
-16
未找到文件。
src/hb-directwrite.cc
浏览文件 @
d4907e83
/*
* Copyright © 2015-201
6
Ebrahim Byagowi
* Copyright © 2015-201
8
Ebrahim Byagowi
*
* This is part of HarfBuzz, a text shaping library.
*
...
...
@@ -48,7 +48,8 @@ class DWriteFontFileLoader : public IDWriteFontFileLoader
private:
IDWriteFontFileStream
*
mFontFileStream
;
public:
DWriteFontFileLoader
(
IDWriteFontFileStream
*
fontFileStream
)
{
void
init
(
IDWriteFontFileStream
*
fontFileStream
)
{
mFontFileStream
=
fontFileStream
;
}
...
...
@@ -73,7 +74,7 @@ private:
uint8_t
*
mData
;
uint32_t
mSize
;
public:
DWriteFontFileStream
(
uint8_t
*
aData
,
uint32_t
aSize
)
void
init
(
uint8_t
*
aData
,
uint32_t
aSize
)
{
mData
=
aData
;
mSize
=
aSize
;
...
...
@@ -150,10 +151,14 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
HRESULT
hr
;
hb_blob_t
*
blob
=
hb_face_reference_blob
(
face
);
IDWriteFontFileStream
*
fontFileStream
=
new
DWriteFontFileStream
(
(
uint8_t
*
)
hb_blob_get_data
(
blob
,
nullptr
),
hb_blob_get_length
(
blob
));
IDWriteFontFileLoader
*
fontFileLoader
=
new
DWriteFontFileLoader
(
fontFileStream
);
DWriteFontFileStream
*
fontFileStream
=
(
DWriteFontFileStream
*
)
malloc
(
sizeof
(
DWriteFontFileStream
));
fontFileStream
->
init
((
uint8_t
*
)
hb_blob_get_data
(
blob
,
nullptr
),
hb_blob_get_length
(
blob
));
DWriteFontFileLoader
*
fontFileLoader
=
(
DWriteFontFileLoader
*
)
malloc
(
sizeof
(
DWriteFontFileLoader
));
fontFileLoader
->
init
(
fontFileStream
);
dwriteFactory
->
RegisterFontFileLoader
(
fontFileLoader
);
IDWriteFontFile
*
fontFile
;
...
...
@@ -164,12 +169,12 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
#define FAIL(...) \
HB_STMT_START { \
DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \
return
false
; \
return
nullptr
; \
} HB_STMT_END;
if
(
FAILED
(
hr
))
{
FAIL
(
"Failed to load font file from data!"
);
return
false
;
return
nullptr
;
}
BOOL
isSupported
;
...
...
@@ -179,7 +184,7 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
hr
=
fontFile
->
Analyze
(
&
isSupported
,
&
fileType
,
&
faceType
,
&
numberOfFaces
);
if
(
FAILED
(
hr
)
||
!
isSupported
)
{
FAIL
(
"Font file is not supported."
);
return
false
;
return
nullptr
;
}
#undef FAIL
...
...
@@ -211,9 +216,9 @@ _hb_directwrite_shaper_face_data_destroy(hb_directwrite_shaper_face_data_t *data
data
->
dwriteFactory
->
Release
();
}
if
(
data
->
fontFileLoader
)
delete
data
->
fontFileLoader
;
free
(
data
->
fontFileLoader
)
;
if
(
data
->
fontFileStream
)
delete
data
->
fontFileStream
;
free
(
data
->
fontFileStream
)
;
if
(
data
->
faceBlob
)
hb_blob_destroy
(
data
->
faceBlob
);
if
(
data
)
...
...
@@ -280,14 +285,14 @@ public:
IFACEMETHOD_
(
ULONG
,
AddRef
)()
{
return
1
;
}
IFACEMETHOD_
(
ULONG
,
Release
)()
{
return
1
;
}
// A single contiguous run of characters containing the same analysis
// A single contiguous run of characters containing the same analysis
// results.
struct
Run
{
uint32_t
mTextStart
;
// starting text position of this run
uint32_t
mTextLength
;
// number of contiguous code units covered
uint32_t
mGlyphStart
;
// starting glyph in the glyphs array
uint32_t
mGlyphCount
;
// number of glyphs associated with this run
of
uint32_t
mGlyphCount
;
// number of glyphs associated with this run
// text
DWRITE_SCRIPT_ANALYSIS
mScript
;
uint8_t
mBidiLevel
;
...
...
@@ -604,7 +609,7 @@ _hb_directwrite_shape_full(hb_shape_plan_t *shape_plan,
// TODO: Handle TEST_DISABLE_OPTIONAL_LIGATURES
DWRITE_READING_DIRECTION
readingDirection
=
buffer
->
props
.
direction
?
DWRITE_READING_DIRECTION
readingDirection
=
buffer
->
props
.
direction
?
DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
:
DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
;
...
...
@@ -919,7 +924,7 @@ hb_directwrite_shape_experimental_width(hb_font_t *font,
unsigned
int
num_features
,
float
width
)
{
static
char
*
shapers
=
"directwrite"
;
static
char
*
shapers
=
(
char
*
)
"directwrite"
;
hb_shape_plan_t
*
shape_plan
=
hb_shape_plan_create_cached
(
font
->
face
,
&
buffer
->
props
,
features
,
num_features
,
&
shapers
);
hb_bool_t
res
=
_hb_directwrite_shape_full
(
shape_plan
,
font
,
buffer
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录