Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
3b59306b
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看板
提交
3b59306b
编写于
11月 04, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Finish FT glue. Rough and untested
上级
f8be443a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
55 deletion
+63
-55
src/hb-font.cc
src/hb-font.cc
+1
-1
src/hb-font.h
src/hb-font.h
+1
-1
src/hb-ft.c
src/hb-ft.c
+61
-53
未找到文件。
src/hb-font.cc
浏览文件 @
3b59306b
...
...
@@ -41,7 +41,7 @@
static
hb_codepoint_t
hb_font_get_glyph_nil
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
hb_codepoint_t
unicode
,
hb_codepoint_t
varia
nt
_selector
)
hb_codepoint_t
unicode
,
hb_codepoint_t
varia
tion
_selector
)
{
return
unicode
;
}
static
hb_bool_t
...
...
src/hb-font.h
浏览文件 @
3b59306b
...
...
@@ -103,7 +103,7 @@ typedef struct _hb_glyph_metrics_t
}
hb_glyph_metrics_t
;
typedef
hb_codepoint_t
(
*
hb_font_get_glyph_func_t
)
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
hb_codepoint_t
unicode
,
hb_codepoint_t
varia
nt
_selector
);
hb_codepoint_t
unicode
,
hb_codepoint_t
varia
tion
_selector
);
typedef
hb_bool_t
(
*
hb_font_get_contour_point_func_t
)
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
);
...
...
src/hb-ft.c
浏览文件 @
3b59306b
...
...
@@ -33,86 +33,93 @@
#include FT_TRUETYPE_TABLES_H
#if 0
extern hb_codepoint_t hb_GetGlyph
(hb_font_t *font, hb_face_t *face, const void *user_data,
hb_codepoint_t unicode, hb_codepoint_t variant
_selector)
static
hb_codepoint_t
hb_ft_get_glyph
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation
_selector
)
{
FT_Face fcFace = (FT_Face)user_data;
return FT_Get_Char_Index(fcFace, unicode);
FT_Face
ft_face
=
(
FT_Face
)
user_data
;
if
(
HB_UNLIKELY
(
variation_selector
))
{
hb_codepoint_t
glyph
=
FT_Face_GetCharVariantIndex
(
ft_face
,
unicode
,
variation_selector
);
if
(
glyph
)
return
glyph
;
}
return
FT_Get_Char_Index
(
ft_face
,
unicode
);
}
extern hb_bool_t hb_GetContourPoint(hb_font_t *font, hb_face_t *face, const void *user_data,
hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y)
static
hb_bool_t
hb_ft_get_contour_point
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
unsigned int point = 0; /* TODO this should be in API */
int load_flags = FT_LOAD_DEFAULT;
FT_Face
ft_face
=
(
FT_Face
)
user_data
;
int
load_flags
=
FT_LOAD_DEFAULT
;
FT_Face fcFace = (FT_Face)user_data;
if (FT_Load_Glyph(fcFace, glyph, load_flags))
return 0;
/* TODO: load_flags, embolden, etc */
if (fcFace->glyph->format != ft_glyph_format_outline
)
return 0
;
if
(
HB_UNLIKELY
(
FT_Load_Glyph
(
ft_face
,
glyph
,
load_flags
))
)
return
FALSE
;
unsigned int nPoints = fcFace->glyph->outline.n_points;
if (!(nPoints))
return 0;
if
(
HB_UNLIKELY
(
ft_face
->
glyph
->
format
!=
FT_GLYPH_FORMAT_OUTLINE
))
return
FALSE
;
if (point > nPoints
)
return 0
;
if
(
HB_UNLIKELY
(
point_index
>=
(
unsigned
int
)
ft_face
->
glyph
->
outline
.
n_points
)
)
return
FALSE
;
*x = fcFace->glyph->outline.points[point
].x;
*y = fcFace->glyph->outline.points[point
].y;
*
x
=
ft_face
->
glyph
->
outline
.
points
[
point_index
].
x
;
*
y
=
ft_face
->
glyph
->
outline
.
points
[
point_index
].
y
;
return 1
;
return
TRUE
;
}
extern void hb_GetGlyphMetrics(hb_font_t *font, hb_face_t *face, const void *user_data,
hb_codepoint_t glyph, hb_glyph_metrics_t *metrics)
static
void
hb_ft_get_glyph_metrics
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
hb_codepoint_t
glyph
,
hb_glyph_metrics_t
*
metrics
)
{
int load_flags = FT_LOAD_DEFAULT;
FT_Face fcFace = (FT_Face)user_data;
metrics->x = metrics->y = 0;
metrics->x_offset = metrics->y_offset = 0;
if (FT_Load_Glyph(fcFace, glyph, load_flags))
{
metrics->width = metrics->height = 0;
}
else
{
metrics->width = fcFace->glyph->metrics.width;
metrics->height = fcFace->glyph->metrics.height;
metrics->x_offset = fcFace->glyph->advance.x;
metrics->y_offset = fcFace->glyph->advance.y;
}
FT_Face
ft_face
=
(
FT_Face
)
user_data
;
int
load_flags
=
FT_LOAD_DEFAULT
;
/* TODO: load_flags, embolden, etc */
metrics
->
x_pos
=
metrics
->
y_pos
=
0
;
metrics
->
x_advance
=
metrics
->
y_advance
=
0
;
metrics
->
width
=
metrics
->
height
=
0
;
if
(
HB_LIKELY
(
!
FT_Load_Glyph
(
ft_face
,
glyph
,
load_flags
)))
{
/* TODO: A few negations should be in order here, not sure. */
metrics
->
x_pos
=
ft_face
->
glyph
->
metrics
.
horiBearingX
;
metrics
->
y_pos
=
ft_face
->
glyph
->
metrics
.
horiBearingY
;
metrics
->
width
=
ft_face
->
glyph
->
metrics
.
width
;
metrics
->
height
=
ft_face
->
glyph
->
metrics
.
height
;
metrics
->
x_advance
=
ft_face
->
glyph
->
advance
.
x
;
metrics
->
y_advance
=
ft_face
->
glyph
->
advance
.
y
;
}
}
extern hb_position_t hb_GetKerning(hb_font_t *font, hb_face_t *face, const void *user_data,
hb_codepoint_t first_glyph, hb_codepoint_t second_glyph)
static
hb_position_t
hb_ft_get_kerning
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
)
{
FT_Face fcFace = (FT_Face)
user_data;
FT_Vector aK
erning;
if (FT_Get_Kerning(fcFace, first_glyph, second_glyph, FT_KERNING_DEFAULT,
&aKerning))
{
return 0;
}
return aK
erning.x;
FT_Face
ft_face
=
(
FT_Face
)
user_data
;
FT_Vector
k
erning
;
/* TODO: Kern type? */
if
(
FT_Get_Kerning
(
ft_face
,
first_glyph
,
second_glyph
,
FT_KERNING_DEFAULT
,
&
kerning
))
return
0
;
return
k
erning
.
x
;
}
#endif
static
hb_font_funcs_t
ft_ffuncs
=
{
HB_REFERENCE_COUNT_INVALID
,
/* ref_count */
TRUE
,
/* immutable */
#if 0
hb_ft_get_glyph
,
hb_ft_get_contour_point
,
hb_ft_get_glyph_metrics
,
hb_ft_get_kerning
#endif
};
hb_font_funcs_t
*
...
...
@@ -134,6 +141,7 @@ _get_table (hb_tag_t tag, void *user_data)
if
(
error
)
return
hb_blob_create_empty
();
/* TODO Use FT_Memory? */
buffer
=
malloc
(
length
);
if
(
buffer
==
NULL
)
return
hb_blob_create_empty
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录