Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
f212c050
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看板
提交
f212c050
编写于
9月 20, 2018
作者:
M
Michiharu Ariza
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added VORG struct and its subsetter
new file: hb-ot-vorg-table.hh
上级
1377adc8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
168 addition
and
1 deletion
+168
-1
src/Makefile.sources
src/Makefile.sources
+1
-0
src/hb-ot-vorg-table.hh
src/hb-ot-vorg-table.hh
+163
-0
src/hb-subset.cc
src/hb-subset.cc
+4
-1
未找到文件。
src/Makefile.sources
浏览文件 @
f212c050
...
...
@@ -30,6 +30,7 @@ HB_BASE_sources = \
hb-ot-cff1-table.hh
\
hb-ot-cff1-table.cc
\
hb-ot-cff2-table.hh
\
hb-ot-vorg-table.hh
\
hb-ot-hdmx-table.hh
\
hb-ot-head-table.hh
\
hb-ot-hhea-table.hh
\
...
...
src/hb-ot-vorg-table.hh
0 → 100644
浏览文件 @
f212c050
/*
* Copyright © 2018 Adobe Systems Incorporated.
*
* 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.
*
* Adobe Author(s): Michiharu Ariza
*/
#ifndef HB_OT_VORG_TABLE_HH
#define HB_OT_VORG_TABLE_HH
#include "hb-open-type.hh"
/*
* VORG -- Vertical Origin Table
* https://docs.microsoft.com/en-us/typography/opentype/spec/vorg
*/
#define HB_OT_TAG_VORG HB_TAG('V','O','R','G')
namespace
OT
{
struct
VertOriginMetric
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
HBUINT16
glyph
;
HBINT16
vertOriginY
;
public:
DEFINE_SIZE_STATIC
(
4
);
};
struct
VORG
{
static
const
hb_tag_t
tableTag
=
HB_OT_TAG_VORG
;
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
likely
(
version
.
major
==
1
)
&&
vertYOrigins
.
sanitize
(
c
));
}
inline
bool
_subset
(
const
hb_subset_plan_t
*
plan
,
const
VORG
*
vorg_table
,
const
hb_vector_t
<
VertOriginMetric
>
&
subset_metrics
,
unsigned
int
dest_sz
,
void
*
dest
)
const
{
hb_serialize_context_t
c
(
dest
,
dest_sz
);
VORG
*
subset_table
=
c
.
start_serialize
<
VORG
>
();
if
(
unlikely
(
!
c
.
extend_min
(
*
subset_table
)))
return
false
;
subset_table
->
version
.
major
.
set
(
1
);
subset_table
->
version
.
minor
.
set
(
0
);
subset_table
->
defaultVertOriginY
.
set
(
vorg_table
->
defaultVertOriginY
);
subset_table
->
vertYOrigins
.
len
.
set
(
subset_metrics
.
len
);
bool
success
=
true
;
if
(
subset_metrics
.
len
>
0
)
{
unsigned
int
size
=
VertOriginMetric
::
static_size
*
subset_metrics
.
len
;
VertOriginMetric
*
metrics
=
c
.
allocate_size
<
VertOriginMetric
>
(
size
);
if
(
likely
(
metrics
!=
nullptr
))
memcpy
(
metrics
,
&
subset_metrics
[
0
],
size
);
else
success
=
false
;
}
c
.
end_serialize
();
return
success
;
}
inline
bool
subset
(
hb_subset_plan_t
*
plan
)
const
{
hb_blob_t
*
vorg_blob
=
hb_sanitize_context_t
().
reference_table
<
VORG
>
(
plan
->
source
);
const
VORG
*
vorg_table
=
vorg_blob
->
as
<
VORG
>
();
/* count the number of glyphs to be included in the subset table */
hb_vector_t
<
VertOriginMetric
>
subset_metrics
;
subset_metrics
.
init
();
unsigned
int
glyph
=
0
;
unsigned
int
i
=
0
;
while
((
glyph
<
plan
->
glyphs
.
len
)
&&
(
i
<
vertYOrigins
.
len
))
{
if
(
plan
->
glyphs
[
glyph
]
>
vertYOrigins
[
i
].
glyph
)
i
++
;
else
if
(
plan
->
glyphs
[
glyph
]
<
vertYOrigins
[
i
].
glyph
)
glyph
++
;
else
{
VertOriginMetric
*
metrics
=
subset_metrics
.
push
();
metrics
->
glyph
.
set
(
glyph
);
metrics
->
vertOriginY
.
set
(
vertYOrigins
[
i
].
vertOriginY
);
glyph
++
;
i
++
;
}
}
/* alloc the new table */
unsigned
int
dest_sz
=
VORG
::
min_size
+
VertOriginMetric
::
static_size
*
subset_metrics
.
len
;
void
*
dest
=
(
void
*
)
malloc
(
dest_sz
);
if
(
unlikely
(
!
dest
))
{
subset_metrics
.
fini
();
return
false
;
}
/* serialize the new table */
if
(
!
_subset
(
plan
,
vorg_table
,
subset_metrics
,
dest_sz
,
dest
))
{
subset_metrics
.
fini
();
free
(
dest
);
return
false
;
}
hb_blob_t
*
result
=
hb_blob_create
((
const
char
*
)
dest
,
dest_sz
,
HB_MEMORY_MODE_READONLY
,
dest
,
free
);
bool
success
=
plan
->
add_table
(
HB_OT_TAG_VORG
,
result
);
hb_blob_destroy
(
result
);
subset_metrics
.
fini
();
return
success
;
}
FixedVersion
<>
version
;
/* Version of VORG table. set to 0x00010000u */
HBINT16
defaultVertOriginY
;
/* The default vertical origin */
ArrayOf
<
VertOriginMetric
>
vertYOrigins
;
/* The array of vertical origins */
public:
DEFINE_SIZE_ARRAY
(
8
,
vertYOrigins
);
};
}
/* namespace OT */
#endif
/* HB_OT_VORG_TABLE_HH */
src/hb-subset.cc
浏览文件 @
f212c050
...
...
@@ -42,6 +42,7 @@
#include "hb-ot-post-table.hh"
#include "hb-ot-cff1-table.hh"
#include "hb-ot-cff2-table.hh"
#include "hb-ot-vorg-table.hh"
#include "hb-ot-layout-gsub-table.hh"
#include "hb-ot-layout-gpos-table.hh"
...
...
@@ -185,7 +186,9 @@ _subset_table (hb_subset_plan_t *plan,
case
HB_OT_TAG_cff2
:
result
=
_subset
<
const
OT
::
cff2
>
(
plan
);
break
;
case
HB_OT_TAG_VORG
:
result
=
_subset
<
const
OT
::
VORG
>
(
plan
);
break
;
case
HB_OT_TAG_GSUB
:
result
=
_subset2
<
const
OT
::
GSUB
>
(
plan
);
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录