Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
c35d1dd8
S
stb
项目概览
itdan3344
/
stb
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c35d1dd8
编写于
2月 07, 2019
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stb_truetype: runtime selection of skipping missing codepoints
上级
eaf78c10
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
3 deletion
+15
-3
stb_truetype.h
stb_truetype.h
+15
-3
未找到文件。
stb_truetype.h
浏览文件 @
c35d1dd8
...
...
@@ -643,6 +643,12 @@ STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h
// To use with PackFontRangesGather etc., you must set it before calls
// call to PackFontRangesGatherRects.
// If skip != 0, this tells stb_truetype to skip any codepoints for which
// there is no corresponding glyph. If skip=0, which is the default, then
// codepoints without a glyph recived the font's "missing character" glyph,
// typically an empty box by convention.
STBTT_DEF
void
stbtt_PackSetSkipMissingGlyphs
(
stbtt_pack_context
*
spc
,
int
skip
);
STBTT_DEF
void
stbtt_GetPackedQuad
(
const
stbtt_packedchar
*
chardata
,
int
pw
,
int
ph
,
// same data as above
int
char_index
,
// character to display
float
*
xpos
,
float
*
ypos
,
// pointers to current position in screen pixel space
...
...
@@ -671,6 +677,7 @@ struct stbtt_pack_context {
int
height
;
int
stride_in_bytes
;
int
padding
;
int
skip_empty
;
unsigned
int
h_oversample
,
v_oversample
;
unsigned
char
*
pixels
;
void
*
nodes
;
...
...
@@ -3824,6 +3831,11 @@ STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h
spc
->
v_oversample
=
v_oversample
;
}
STBTT_DEF
void
stbtt_PackSetSkipMissingGlyphs
(
stbtt_pack_context
*
spc
,
int
skip
)
{
spc
->
skip_empty
=
skip
;
}
#define STBTT__OVER_MASK (STBTT_MAX_OVERSAMPLE-1)
static
void
stbtt__h_prefilter
(
unsigned
char
*
pixels
,
int
w
,
int
h
,
int
stride_in_bytes
,
unsigned
int
kernel_width
)
...
...
@@ -3977,7 +3989,9 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stb
int
x0
,
y0
,
x1
,
y1
;
int
codepoint
=
ranges
[
i
].
array_of_unicode_codepoints
==
NULL
?
ranges
[
i
].
first_unicode_codepoint_in_range
+
j
:
ranges
[
i
].
array_of_unicode_codepoints
[
j
];
int
glyph
=
stbtt_FindGlyphIndex
(
info
,
codepoint
);
if
(
glyph
!=
0
)
{
if
(
glyph
==
0
&&
spc
->
skip_empty
)
{
rects
[
k
].
w
=
rects
[
k
].
h
=
0
;
}
else
{
stbtt_GetGlyphBitmapBoxSubpixel
(
info
,
glyph
,
scale
*
spc
->
h_oversample
,
scale
*
spc
->
v_oversample
,
...
...
@@ -3985,8 +3999,6 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stb
&
x0
,
&
y0
,
&
x1
,
&
y1
);
rects
[
k
].
w
=
(
stbrp_coord
)
(
x1
-
x0
+
spc
->
padding
+
spc
->
h_oversample
-
1
);
rects
[
k
].
h
=
(
stbrp_coord
)
(
y1
-
y0
+
spc
->
padding
+
spc
->
v_oversample
-
1
);
}
else
{
rects
[
k
].
w
=
rects
[
k
].
h
=
0
;
}
++
k
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录