Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
2cb9d4c1
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看板
提交
2cb9d4c1
编写于
12月 05, 2018
作者:
M
Michiharu Ariza
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into cff-fixbcd
上级
a5fa843c
8394a6cb
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
269 addition
and
30 deletion
+269
-30
src/Makefile.sources
src/Makefile.sources
+2
-0
src/hb-aat-fdsc-table.hh
src/hb-aat-fdsc-table.hh
+103
-0
src/hb-aat-layout.cc
src/hb-aat-layout.cc
+1
-0
src/hb-ot-cff1-table.hh
src/hb-ot-cff1-table.hh
+8
-5
src/hb-ot-cff2-table.hh
src/hb-ot-cff2-table.hh
+2
-1
src/hb-ot-gasp-table.hh
src/hb-ot-gasp-table.hh
+84
-0
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+3
-2
src/hb-ot-os2-table.hh
src/hb-ot-os2-table.hh
+66
-22
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5175735354916864
...rfuzz-testcase-minimized-hb-shape-fuzzer-5175735354916864
+0
-0
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5700264032468992
...rfuzz-testcase-minimized-hb-shape-fuzzer-5700264032468992
+0
-0
未找到文件。
src/Makefile.sources
浏览文件 @
2cb9d4c1
# Base and default-included sources and headers
HB_BASE_sources
=
\
hb-aat-fdsc-table.hh
\
hb-aat-layout-ankr-table.hh
\
hb-aat-layout-bsln-table.hh
\
hb-aat-layout-common.hh
\
...
...
@@ -59,6 +60,7 @@ HB_BASE_sources = \
hb-ot-face.cc
\
hb-ot-face.hh
\
hb-ot-font.cc
\
hb-ot-gasp-table.hh
\
hb-ot-glyf-table.hh
\
hb-ot-hdmx-table.hh
\
hb-ot-head-table.hh
\
...
...
src/hb-aat-fdsc-table.hh
0 → 100644
浏览文件 @
2cb9d4c1
/*
* Copyright © 2018 Ebrahim Byagowi
*
* 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.
*/
#ifndef HB_AAT_FDSC_TABLE_HH
#define HB_AAT_FDSC_TABLE_HH
#include "hb-aat-layout-common.hh"
/*
* fdsc -- Font descriptors
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fdsc.html
*/
#define HB_AAT_TAG_fdsc HB_TAG('f','d','s','c')
namespace
AAT
{
struct
GXFontDescriptor
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
public:
Tag
tag
;
/* The 4-byte table tag name. */
Fixed
value
;
/* The value for the descriptor tag. */
public:
DEFINE_SIZE_STATIC
(
8
);
};
struct
gasp
{
enum
{
tableTag
=
HB_AAT_TAG_fdsc
};
enum
{
Weight
=
HB_TAG
(
'w'
,
'g'
,
'h'
,
't'
),
/* Percent weight relative to regular weight.
* (defaul value: 1.0) */
Width
=
HB_TAG
(
'w'
,
'd'
,
't'
,
'h'
),
/* Percent width relative to regular width.
* (default value: 1.0) */
Slant
=
HB_TAG
(
's'
,
'l'
,
'n'
,
't'
),
/* Angle of slant in degrees, where positive
* is clockwise from straight up.
* (default value: 0.0) */
OpticalSize
=
HB_TAG
(
'o'
,
'p'
,
's'
,
'z'
),
/* Point size the font was designed for.
* (default value: 12.0) */
NonAlphabetic
=
HB_TAG
(
'n'
,
'a'
,
'l'
,
'f'
)
/* These values are treated as integers,
* not fixed32s. 0 means alphabetic, and greater
* integers mean the font is non-alphabetic (e.g. symbols).
* (default value: 0) */
};
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
descriptors
.
sanitize
(
c
));
}
protected:
Fixed
version
;
/* Version number of the font descriptors
* table (0x00010000 for the current version). */
LArrayOf
<
GXFontDescriptor
>
descriptors
;
/* List of tagged-coordinate pairs style descriptors
* that will be included to characterize this font.
* Each descriptor consists of a <tag, value> pair.
* These pairs are located in the gxFontDescriptor
* array that follows. */
public:
DEFINE_SIZE_ARRAY
(
8
,
descriptors
);
};
}
/* namespace AAT */
#endif
/* HB_AAT_FDSC_TABLE_HH */
src/hb-aat-layout.cc
浏览文件 @
2cb9d4c1
...
...
@@ -29,6 +29,7 @@
#include "hb-ot-face.hh"
#include "hb-aat-layout.hh"
#include "hb-aat-fdsc-table.hh" // Just so we compile it; unused otherwise.
#include "hb-aat-layout-ankr-table.hh"
#include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise.
#include "hb-aat-layout-feat-table.hh"
...
...
src/hb-ot-cff1-table.hh
浏览文件 @
2cb9d4c1
...
...
@@ -392,13 +392,15 @@ struct Charset1_2 {
return
0
;
}
inline
hb_codepoint_t
get_glyph
(
hb_codepoint_t
sid
)
const
inline
hb_codepoint_t
get_glyph
(
hb_codepoint_t
sid
,
unsigned
int
num_glyphs
)
const
{
if
(
sid
==
0
)
return
0
;
hb_codepoint_t
glyph
=
1
;
for
(
unsigned
int
i
=
0
;;
i
++
)
{
if
((
ranges
[
i
].
first
<=
sid
)
&&
sid
<=
ranges
[
i
].
first
+
ranges
[
i
].
nLeft
)
if
(
glyph
>=
num_glyphs
)
return
0
;
if
((
ranges
[
i
].
first
<=
sid
)
&&
(
sid
<=
ranges
[
i
].
first
+
ranges
[
i
].
nLeft
))
return
glyph
+
(
sid
-
ranges
[
i
].
first
);
glyph
+=
(
ranges
[
i
].
nLeft
+
1
);
}
...
...
@@ -550,9 +552,9 @@ struct Charset {
if
(
format
==
0
)
return
u
.
format0
.
get_glyph
(
sid
,
num_glyphs
);
else
if
(
format
==
1
)
return
u
.
format1
.
get_glyph
(
sid
);
return
u
.
format1
.
get_glyph
(
sid
,
num_glyphs
);
else
return
u
.
format2
.
get_glyph
(
sid
);
return
u
.
format2
.
get_glyph
(
sid
,
num_glyphs
);
}
HBUINT8
format
;
...
...
@@ -1092,6 +1094,7 @@ struct cff1
CFF1FontDict_Interpreter
font_interp
;
font_interp
.
env
.
init
(
fontDictStr
);
font
=
fontDicts
.
push
();
if
(
unlikely
(
font
==
&
Crap
(
CFF1FontDictValues
)))
{
fini
();
return
;
}
font
->
init
();
if
(
unlikely
(
!
font_interp
.
interpret
(
*
font
)))
{
fini
();
return
;
}
PRIVDICTVAL
*
priv
=
&
privateDicts
[
i
];
...
...
@@ -1131,7 +1134,7 @@ struct cff1
{
sc
.
end_processing
();
topDict
.
fini
();
fontDicts
.
fini
();
fontDicts
.
fini
_deep
();
privateDicts
.
fini_deep
();
hb_blob_destroy
(
blob
);
blob
=
nullptr
;
...
...
src/hb-ot-cff2-table.hh
浏览文件 @
2cb9d4c1
...
...
@@ -486,6 +486,7 @@ struct cff2
CFF2FontDict_Interpreter
font_interp
;
font_interp
.
env
.
init
(
fontDictStr
);
font
=
fontDicts
.
push
();
if
(
unlikely
(
font
==
&
Crap
(
CFF2FontDictValues
)))
{
fini
();
return
;
}
font
->
init
();
if
(
unlikely
(
!
font_interp
.
interpret
(
*
font
)))
{
fini
();
return
;
}
...
...
@@ -506,7 +507,7 @@ struct cff2
inline
void
fini
(
void
)
{
sc
.
end_processing
();
fontDicts
.
fini
();
fontDicts
.
fini
_deep
();
privateDicts
.
fini_deep
();
hb_blob_destroy
(
blob
);
blob
=
nullptr
;
...
...
src/hb-ot-gasp-table.hh
0 → 100644
浏览文件 @
2cb9d4c1
/*
* Copyright © 2018 Ebrahim Byagowi
*
* 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.
*/
#ifndef HB_OT_GASP_TABLE_HH
#define HB_OT_GASP_TABLE_HH
#include "hb-open-type.hh"
#include "hb-ot-hhea-table.hh"
#include "hb-ot-os2-table.hh"
#include "hb-ot-var-hvar-table.hh"
/*
* gasp -- Grid-fitting and Scan-conversion Procedure
* https://docs.microsoft.com/en-us/typography/opentype/spec/gasp
*/
#define HB_OT_TAG_gasp HB_TAG('g','a','s','p')
namespace
OT
{
struct
GaspRange
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
public:
HBUINT16
rangeMaxPPEM
;
/* Upper limit of range, in PPEM */
HBUINT16
rangeGaspBehavior
;
/* Flags describing desired rasterizer behavior. */
public:
DEFINE_SIZE_STATIC
(
4
);
};
struct
gasp
{
enum
{
tableTag
=
HB_OT_TAG_gasp
};
inline
const
GaspRange
&
get_gasp_range
(
unsigned
int
i
)
const
{
return
gaspRanges
[
i
];
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
gaspRanges
.
sanitize
(
c
));
}
protected:
HBUINT16
version
;
/* Version number (set to 1) */
ArrayOf
<
GaspRange
>
gaspRanges
;
/* Number of records to follow
* Sorted by ppem */
public:
DEFINE_SIZE_ARRAY
(
4
,
gaspRanges
);
};
}
/* namespace OT */
#endif
/* HB_OT_GASP_TABLE_HH */
src/hb-ot-layout.cc
浏览文件 @
2cb9d4c1
...
...
@@ -35,11 +35,12 @@
#include "hb-map.hh"
#include "hb-ot-kern-table.hh"
#include "hb-ot-gasp-table.hh" // Just so we compile it; unused otherwise.
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-gsub-table.hh"
#include "hb-ot-layout-gpos-table.hh"
#include "hb-ot-layout-base-table.hh" // Just so we compile it; unused otherwise
#include "hb-ot-layout-jstf-table.hh" // Just so we compile it; unused otherwise
#include "hb-ot-layout-base-table.hh" // Just so we compile it; unused otherwise
.
#include "hb-ot-layout-jstf-table.hh" // Just so we compile it; unused otherwise
.
#include "hb-ot-name-table.hh"
#include "hb-ot-os2-table.hh"
...
...
src/hb-ot-os2-table.hh
浏览文件 @
2cb9d4c1
...
...
@@ -30,7 +30,7 @@
#include "hb-open-type.hh"
#include "hb-ot-os2-unicode-ranges.hh"
namespace
OT
{
#include "hb-set.hh"
/*
* OS/2 and Windows Metrics
...
...
@@ -38,16 +38,65 @@ namespace OT {
*/
#define HB_OT_TAG_OS2 HB_TAG('O','S','/','2')
struct
OS2
namespace
OT
{
struct
OS2V1Tail
{
enum
{
tableTag
=
HB_OT_TAG_OS2
};
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
public:
HBUINT32
ulCodePageRange1
;
HBUINT32
ulCodePageRange2
;
public:
DEFINE_SIZE_STATIC
(
8
);
};
struct
OS2V2Tail
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
public:
HBINT16
sxHeight
;
HBINT16
sCapHeight
;
HBUINT16
usDefaultChar
;
HBUINT16
usBreakChar
;
HBUINT16
usMaxContext
;
public:
DEFINE_SIZE_STATIC
(
10
);
};
struct
OS2V5Tail
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
public:
HBUINT16
usLowerOpticalPointSize
;
HBUINT16
usUpperOpticalPointSize
;
public:
DEFINE_SIZE_STATIC
(
4
);
};
struct
OS2
{
enum
{
tableTag
=
HB_OT_TAG_OS2
};
inline
const
OS2V1Tail
&
v1
(
void
)
const
{
return
version
>=
1
?
v1X
:
Null
(
OS2V1Tail
);
}
inline
const
OS2V2Tail
&
v2
(
void
)
const
{
return
version
>=
2
?
v2X
:
Null
(
OS2V2Tail
);
}
inline
const
OS2V5Tail
&
v5
(
void
)
const
{
return
version
>=
5
?
v5X
:
Null
(
OS2V5Tail
);
}
inline
bool
subset
(
hb_subset_plan_t
*
plan
)
const
{
hb_blob_t
*
os2_blob
=
hb_sanitize_context_t
().
reference_table
<
OS2
>
(
plan
->
source
);
...
...
@@ -125,10 +174,18 @@ struct OS2
return
(
font_page_t
)
(
fsSelection
&
0xFF00
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
c
->
check_struct
(
this
)))
return_trace
(
false
);
if
(
unlikely
(
version
>=
1
&&
!
v1X
.
sanitize
(
c
)))
return_trace
(
false
);
if
(
unlikely
(
version
>=
2
&&
!
v2X
.
sanitize
(
c
)))
return_trace
(
false
);
if
(
unlikely
(
version
>=
5
&&
!
v5X
.
sanitize
(
c
)))
return_trace
(
false
);
return_trace
(
true
);
}
public:
HBUINT16
version
;
/* Version 0 */
HBINT16
xAvgCharWidth
;
HBUINT16
usWeightClass
;
HBUINT16
usWidthClass
;
...
...
@@ -155,24 +212,11 @@ struct OS2
HBINT16
sTypoLineGap
;
HBUINT16
usWinAscent
;
HBUINT16
usWinDescent
;
/* Version 1 */
//HBUINT32 ulCodePageRange1;
//HBUINT32 ulCodePageRange2;
/* Version 2 */
//HBINT16 sxHeight;
//HBINT16 sCapHeight;
//HBUINT16 usDefaultChar;
//HBUINT16 usBreakChar;
//HBUINT16 usMaxContext;
/* Version 5 */
//HBUINT16 usLowerOpticalPointSize;
//HBUINT16 usUpperOpticalPointSize;
OS2V1Tail
v1X
;
OS2V2Tail
v2X
;
OS2V5Tail
v5X
;
public:
DEFINE_SIZE_
STATIC
(
78
);
DEFINE_SIZE_
MIN
(
78
);
};
}
/* namespace OT */
...
...
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5175735354916864
0 → 100644
浏览文件 @
2cb9d4c1
文件已添加
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5700264032468992
0 → 100644
浏览文件 @
2cb9d4c1
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录