Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
1c6eef1b
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
1c6eef1b
编写于
12月 18, 2017
作者:
J
Jason Simmons
提交者:
GitHub
12月 18, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libtxt: make minIntrinsicWidth match maxIntrinsicWidth if constraints prevent line wrapping (#4468)
上级
1cc9abb2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
3 deletion
+19
-3
third_party/txt/src/txt/paragraph.cc
third_party/txt/src/txt/paragraph.cc
+8
-3
third_party/txt/src/txt/paragraph_style.cc
third_party/txt/src/txt/paragraph_style.cc
+8
-0
third_party/txt/src/txt/paragraph_style.h
third_party/txt/src/txt/paragraph_style.h
+3
-0
未找到文件。
third_party/txt/src/txt/paragraph.cc
浏览文件 @
1c6eef1b
...
...
@@ -439,7 +439,7 @@ void Paragraph::Layout(double width, bool force) {
std
::
vector
<
uint16_t
>
ellipsized_text
;
if
(
ellipsis
.
length
()
&&
!
isinf
(
width_
)
&&
!
line_range
.
hard_break
&&
(
line_number
==
line_limit
-
1
||
paragraph_style_
.
max_lines
==
std
::
numeric_limits
<
size_t
>::
max
()))
{
paragraph_style_
.
unlimited_lines
()))
{
float
ellipsis_width
=
layout
.
measureText
(
reinterpret_cast
<
const
uint16_t
*>
(
ellipsis
.
data
()),
0
,
ellipsis
.
length
(),
ellipsis
.
length
(),
bidiFlags
,
font
,
...
...
@@ -471,7 +471,7 @@ void Paragraph::Layout(double width, bool force) {
// If there is no line limit, then skip all lines after the ellipsized
// line.
if
(
paragraph_style_
.
max_lines
==
std
::
numeric_limits
<
size_t
>::
max
())
{
if
(
paragraph_style_
.
unlimited_lines
())
{
line_limit
=
line_number
+
1
;
did_exceed_max_lines_
=
true
;
}
...
...
@@ -666,7 +666,12 @@ void Paragraph::Layout(double width, bool force) {
for
(
double
line_width
:
line_widths_
)
{
max_intrinsic_width_
+=
line_width
;
}
min_intrinsic_width_
=
std
::
min
(
max_word_width
,
max_intrinsic_width_
);
if
(
paragraph_style_
.
max_lines
==
1
||
(
paragraph_style_
.
unlimited_lines
()
&&
paragraph_style_
.
ellipsized
()))
{
min_intrinsic_width_
=
max_intrinsic_width_
;
}
else
{
min_intrinsic_width_
=
std
::
min
(
max_word_width
,
max_intrinsic_width_
);
}
std
::
sort
(
code_unit_runs_
.
begin
(),
code_unit_runs_
.
end
(),
[](
const
CodeUnitRun
&
a
,
const
CodeUnitRun
&
b
)
{
...
...
third_party/txt/src/txt/paragraph_style.cc
浏览文件 @
1c6eef1b
...
...
@@ -27,4 +27,12 @@ TextStyle ParagraphStyle::GetTextStyle() const {
return
result
;
}
bool
ParagraphStyle
::
unlimited_lines
()
const
{
return
max_lines
==
std
::
numeric_limits
<
size_t
>::
max
();
};
bool
ParagraphStyle
::
ellipsized
()
const
{
return
!
ellipsis
.
empty
();
}
}
// namespace txt
third_party/txt/src/txt/paragraph_style.h
浏览文件 @
1c6eef1b
...
...
@@ -61,6 +61,9 @@ class ParagraphStyle {
minikin
::
BreakStrategy
::
kBreakStrategy_Greedy
;
TextStyle
GetTextStyle
()
const
;
bool
unlimited_lines
()
const
;
bool
ellipsized
()
const
;
};
}
// namespace txt
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录