Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
90364843
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
90364843
编写于
3月 24, 2014
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start fleshing out builtin font functions
上级
343a0e4e
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
283 addition
and
53 deletion
+283
-53
src/Makefile.am
src/Makefile.am
+2
-1
src/hb-glib.cc
src/hb-glib.cc
+1
-1
src/hb-icu.cc
src/hb-icu.cc
+1
-1
src/hb-ot-font.cc
src/hb-ot-font.cc
+260
-0
src/hb-ot-font.h
src/hb-ot-font.h
+10
-46
src/hb-ot-hhea-table.hh
src/hb-ot-hhea-table.hh
+1
-1
src/hb-ot-hmtx-table.hh
src/hb-ot-hmtx-table.hh
+1
-1
src/hb-ot.h
src/hb-ot.h
+1
-0
util/Makefile.am
util/Makefile.am
+2
-2
util/options.cc
util/options.cc
+4
-0
未找到文件。
src/Makefile.am
浏览文件 @
90364843
...
...
@@ -51,7 +51,6 @@ HBSOURCES = \
hb-shaper-impl-private.hh
\
hb-shaper-private.hh
\
hb-shaper.cc
\
hb-tt-font.cc
\
hb-unicode-private.hh
\
hb-unicode.cc
\
hb-utf-private.hh
\
...
...
@@ -76,6 +75,7 @@ HBNODISTHEADERS = \
if
HAVE_OT
HBSOURCES
+=
\
hb-ot-font.cc
\
hb-ot-layout.cc
\
hb-ot-layout-common-private.hh
\
hb-ot-layout-gdef-table.hh
\
...
...
@@ -112,6 +112,7 @@ HBSOURCES += \
$(NULL)
HBHEADERS
+=
\
hb-ot.h
\
hb-ot-font.h
\
hb-ot-layout.h
\
hb-ot-shape.h
\
hb-ot-tag.h
\
...
...
src/hb-glib.cc
浏览文件 @
90364843
...
...
@@ -340,7 +340,7 @@ hb_glib_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED,
void
*
user_data
HB_UNUSED
)
{
#if GLIB_CHECK_VERSION(2,29,12)
return
g_unichar_fully_decompose
(
u
,
TRUE
,
decomposed
,
HB_UNICODE_MAX_DECOMPOSITION_LEN
);
return
g_unichar_fully_decompose
(
u
,
true
,
decomposed
,
HB_UNICODE_MAX_DECOMPOSITION_LEN
);
#endif
/* If the user doesn't have GLib >= 2.29.12 we have to perform
...
...
src/hb-icu.cc
浏览文件 @
90364843
...
...
@@ -323,7 +323,7 @@ hb_icu_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED,
/* Copy @u into a UTF-16 array to be passed to ICU. */
len
=
0
;
err
=
FALSE
;
err
=
false
;
U16_APPEND
(
utf16
,
len
,
ARRAY_LENGTH
(
utf16
),
u
,
err
);
if
(
err
)
return
0
;
...
...
src/hb-ot-font.cc
0 → 100644
浏览文件 @
90364843
/*
* Copyright © 2011,2014 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, Roozbeh Pournader
*/
#include "hb-private.hh"
#include "hb-ot.h"
#include "hb-font-private.hh"
#include "hb-ot-hhea-table.hh"
#include "hb-ot-hmtx-table.hh"
struct
hb_ot_font_t
{
unsigned
int
num_glyphs
;
unsigned
int
num_hmetrics
;
const
OT
::
hmtx
*
hmtx
;
hb_blob_t
*
hmtx_blob
;
};
static
hb_ot_font_t
*
_hb_ot_font_create
(
hb_font_t
*
font
)
{
hb_ot_font_t
*
ot_font
=
(
hb_ot_font_t
*
)
calloc
(
1
,
sizeof
(
hb_ot_font_t
));
if
(
unlikely
(
!
ot_font
))
return
NULL
;
ot_font
->
num_glyphs
=
font
->
face
->
get_num_glyphs
();
{
hb_blob_t
*
hhea_blob
=
OT
::
Sanitizer
<
OT
::
hhea
>::
sanitize
(
font
->
face
->
reference_table
(
HB_OT_TAG_hhea
));
const
OT
::
hhea
*
hhea
=
OT
::
Sanitizer
<
OT
::
hhea
>::
lock_instance
(
hhea_blob
);
ot_font
->
num_hmetrics
=
hhea
->
numberOfHMetrics
;
hb_blob_destroy
(
hhea_blob
);
}
ot_font
->
hmtx_blob
=
OT
::
Sanitizer
<
OT
::
hmtx
>::
sanitize
(
font
->
face
->
reference_table
(
HB_OT_TAG_hmtx
));
if
(
unlikely
(
!
ot_font
->
num_hmetrics
||
2
*
(
ot_font
->
num_hmetrics
+
ot_font
->
num_glyphs
)
<
hb_blob_get_length
(
ot_font
->
hmtx_blob
)))
{
hb_blob_destroy
(
ot_font
->
hmtx_blob
);
free
(
ot_font
);
return
NULL
;
}
ot_font
->
hmtx
=
OT
::
Sanitizer
<
OT
::
hmtx
>::
lock_instance
(
ot_font
->
hmtx_blob
);
return
ot_font
;
}
static
void
_hb_ot_font_destroy
(
hb_ot_font_t
*
ot_font
)
{
hb_blob_destroy
(
ot_font
->
hmtx_blob
);
free
(
ot_font
);
}
static
hb_bool_t
hb_ot_get_glyph
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
hb_codepoint_t
*
glyph
,
void
*
user_data
HB_UNUSED
)
{
#if 0
FT_Face ft_face = (FT_Face) font_data;
#ifdef HAVE_FT_FACE_GETCHARVARIANTINDEX
if (unlikely (variation_selector)) {
*glyph = FT_Face_GetCharVariantIndex (ft_face, unicode, variation_selector);
return *glyph != 0;
}
#endif
*glyph = FT_Get_Char_Index (ft_face, unicode);
return *glyph != 0;
#endif
return
true
;
}
static
hb_position_t
hb_ot_get_glyph_h_advance
(
hb_font_t
*
font
,
void
*
font_data
,
hb_codepoint_t
glyph
,
void
*
user_data
HB_UNUSED
)
{
const
hb_ot_font_t
*
ot_font
=
(
const
hb_ot_font_t
*
)
font_data
;
if
(
unlikely
(
glyph
>=
ot_font
->
num_glyphs
))
return
0
;
/* Maybe better to return notdef's advance instead? */
if
(
glyph
>=
ot_font
->
num_hmetrics
)
glyph
=
ot_font
->
num_hmetrics
-
1
;
return
font
->
em_scale_x
(
ot_font
->
hmtx
->
longHorMetric
[
glyph
].
advanceWidth
);
}
static
hb_position_t
hb_ot_get_glyph_v_advance
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_codepoint_t
glyph
,
void
*
user_data
HB_UNUSED
)
{
/* TODO */
return
0
;
}
static
hb_bool_t
hb_ot_get_glyph_h_origin
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
HB_UNUSED
,
hb_codepoint_t
glyph
HB_UNUSED
,
hb_position_t
*
x
HB_UNUSED
,
hb_position_t
*
y
HB_UNUSED
,
void
*
user_data
HB_UNUSED
)
{
/* We always work in the horizontal coordinates. */
return
true
;
}
static
hb_bool_t
hb_ot_get_glyph_v_origin
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
,
void
*
user_data
HB_UNUSED
)
{
/* TODO */
return
false
;
}
static
hb_position_t
hb_ot_get_glyph_h_kerning
(
hb_font_t
*
font
,
void
*
font_data
,
hb_codepoint_t
left_glyph
,
hb_codepoint_t
right_glyph
,
void
*
user_data
HB_UNUSED
)
{
/* TODO */
return
0
;
}
static
hb_position_t
hb_ot_get_glyph_v_kerning
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
HB_UNUSED
,
hb_codepoint_t
top_glyph
HB_UNUSED
,
hb_codepoint_t
bottom_glyph
HB_UNUSED
,
void
*
user_data
HB_UNUSED
)
{
return
0
;
}
static
hb_bool_t
hb_ot_get_glyph_extents
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
,
void
*
user_data
HB_UNUSED
)
{
/* TODO */
return
false
;
}
static
hb_bool_t
hb_ot_get_glyph_contour_point
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_codepoint_t
glyph
,
unsigned
int
point_index
,
hb_position_t
*
x
,
hb_position_t
*
y
,
void
*
user_data
HB_UNUSED
)
{
/* TODO */
return
false
;
}
static
hb_bool_t
hb_ot_get_glyph_name
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_codepoint_t
glyph
,
char
*
name
,
unsigned
int
size
,
void
*
user_data
HB_UNUSED
)
{
/* TODO */
return
false
;
}
static
hb_bool_t
hb_ot_get_glyph_from_name
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
const
char
*
name
,
int
len
,
/* -1 means nul-terminated */
hb_codepoint_t
*
glyph
,
void
*
user_data
HB_UNUSED
)
{
/* TODO */
return
false
;
}
static
hb_font_funcs_t
*
_hb_ot_get_font_funcs
(
void
)
{
static
const
hb_font_funcs_t
ot_ffuncs
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
{
#define HB_FONT_FUNC_IMPLEMENT(name) hb_ot_get_##name,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
}
};
return
const_cast
<
hb_font_funcs_t
*>
(
&
ot_ffuncs
);
}
void
hb_ot_font_set_funcs
(
hb_font_t
*
font
)
{
hb_ot_font_t
*
ot_font
=
_hb_ot_font_create
(
font
);
if
(
unlikely
(
!
ot_font
))
return
;
hb_font_set_funcs
(
font
,
_hb_ot_get_font_funcs
(),
ot_font
,
(
hb_destroy_func_t
)
_hb_ot_font_destroy
);
}
src/hb-
tt-font.cc
→
src/hb-
ot-font.h
浏览文件 @
90364843
/*
* Copyright © 201
1
Google, Inc.
* Copyright © 201
4
Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
...
...
@@ -21,57 +21,21 @@
* 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
* Google Author(s): Behdad Esfahbod
, Roozbeh Pournader
*/
#include "hb-font-private.hh"
/* Shall be first since may include windows.h */
#ifndef HB_OT_FONT_H
#define HB_OT_FONT_H
#include "hb
-open-type-private.h
h"
#include "hb
.
h"
#include "hb-ot-hhea-table.hh"
#include "hb-ot-hmtx-table.hh"
HB_BEGIN_DECLS
#include <string.h>
void
hb_ot_font_set_funcs
(
hb_font_t
*
font
);
#if 0
struct hb_tt_font_t
{
const struct hhea *hhea;
hb_blob_t *hhea_blob;
};
HB_END_DECLS
static hb_tt_font_t *
_hb_tt_font_create (hb_font_t *font)
{
/* TODO Remove this object altogether */
hb_tt_font_t *tt = (hb_tt_font_t *) calloc (1, sizeof (hb_tt_font_t));
tt->hhea_blob = Sanitizer<hhea>::sanitize (font->face->reference_table (HB_OT_TAG_hhea));
tt->hhea = Sanitizer<hhea>::lock_instance (tt->hhea_blob);
return tt;
}
static void
_hb_tt_font_destroy (hb_tt_font_t *tt)
{
hb_blob_destroy (tt->hhea_blob);
free (tt);
}
static inline const hhea&
_get_hhea (hb_face_t *face)
{
return likely (face->tt && face->tt->hhea) ? *face->tt->hhea : Null(hhea);
}
/*
* hb_tt_font_funcs_t
*/
#endif
#endif
/* HB_OT_FONT_H */
src/hb-ot-hhea-table.hh
浏览文件 @
90364843
...
...
@@ -49,7 +49,7 @@ struct hhea
return
TRACE_RETURN
(
c
->
check_struct
(
this
)
&&
likely
(
version
.
major
==
1
));
}
p
rotected
:
p
ublic
:
FixedVersion
version
;
/* 0x00010000 for version 1.0. */
FWORD
ascender
;
/* Typographic ascent. <a
* href="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html">
...
...
src/hb-ot-hmtx-table.hh
浏览文件 @
90364843
...
...
@@ -59,7 +59,7 @@ struct hmtx
return
TRACE_RETURN
(
true
);
}
p
rotected
:
p
ublic
:
LongHorMetric
longHorMetric
[
VAR
];
/* Paired advance width and left side
* bearing values for each glyph. The
* value numOfHMetrics comes from
...
...
src/hb-ot.h
浏览文件 @
90364843
...
...
@@ -30,6 +30,7 @@
#include "hb.h"
#include "hb-ot-font.h"
#include "hb-ot-layout.h"
#include "hb-ot-tag.h"
#include "hb-ot-shape.h"
...
...
util/Makefile.am
浏览文件 @
90364843
...
...
@@ -24,8 +24,8 @@ LDADD = \
$(NULL)
if
HAVE_GLIB
if
HAVE_FREETYPE
if
HAVE_FREETYPE
if
HAVE_CAIRO_FT
hb_view_SOURCES
=
\
hb-view.cc
\
...
...
@@ -49,6 +49,7 @@ hb_view_LDADD = \
$(NULL)
bin_PROGRAMS
+=
hb-view
endif
# HAVE_CAIRO_FT
endif
# HAVE_FREETYPE
hb_shape_SOURCES
=
\
hb-shape.cc
\
...
...
@@ -69,7 +70,6 @@ hb_ot_shape_closure_SOURCES = \
bin_PROGRAMS
+=
hb-ot-shape-closure
endif
# HAVE_OT
endif
# HAVE_FREETYPE
endif
# HAVE_GLIB
-include
$(top_srcdir)/git.mk
util/options.cc
浏览文件 @
90364843
...
...
@@ -28,6 +28,8 @@
#ifdef HAVE_FREETYPE
#include <hb-ft.h>
#else
#include <hb-ot-font.h>
#endif
...
...
@@ -486,6 +488,8 @@ font_options_t::get_font (void) const
#ifdef HAVE_FREETYPE
hb_ft_font_set_funcs
(
font
);
#else
hb_ot_font_set_funcs
(
font
);
#endif
return
font
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录