Skip to content

Commit

Permalink
Extra large scale warning in find_weight_scale!
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yong-zhi committed Jul 18, 2021
1 parent 39026fc commit 2b7fc75
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/strategy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@ function find_weight_scale!(wc::WC; initialscale=0, density=0.3, maxiter=5, tole
while true
step = step + 1
if step > maxiter
@warn "find_weight_scale reach the `maxiter`. The `density` may be inaccurate. This may be caused by too small background, too many words or too big `minfontsize`."
@warn "find_weight_scale! reach the `maxiter`. The `density` may be inaccurate. This may be caused by too small background, too many words or too big `minfontsize`."
break
end
# cal tg1
@assert sc1 < 50initialscale #防止全空白words的输入,计算出sc过大渲染字体耗尽内存
setparameter!(wc, sc1, :scale)
tg1 = textoccupying(words, getfontsizes(wc), fonts)
dens = tg1 / ground_size
Expand Down Expand Up @@ -129,6 +128,10 @@ function find_weight_scale!(wc::WC; initialscale=0, density=0.3, maxiter=5, tole
error("find_weight_scale! failed")
end
end
if sc2 >= 50initialscale #防止空白words的输入,计算出sc过大渲染字体耗尽内存
@warn "Extra large font size detected. The density $density may be unreachable."
break
end
# next iter init
tg0 = tg1
sc0 = sc1
Expand Down

0 comments on commit 2b7fc75

Please sign in to comment.