Skip to content

Commit 1d0f820

Browse files
authored
Fix autoscale for vertical overflow (#386)
1 parent e656ff2 commit 1d0f820

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/squib/graphics/text.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def text(embed, para, box, trans, draw, dpi)
136136
max_fitting_size = sizes.bsearch{ |sz|
137137
font_desc.size = sz
138138
extents = render_text(embed, para, box, trans, draw, dpi, font_desc, orig_font_size, true)
139-
!extents[:ellipsized]
139+
!extents[:ellipsized] && extents[:height] <= box.height
140140
}
141141

142142
if max_fitting_size.nil?
@@ -171,7 +171,7 @@ def render_text(embed, para, box, trans, draw, dpi, font_desc, orig_font_size, d
171171
end
172172

173173
set_font_rendering_opts!(layout)
174-
set_wh!(layout, box.width, box.height)
174+
set_wh!(layout, box.width, dummy_draw ? -1 : box.height)
175175
layout.wrap = para.wrap
176176
layout.ellipsize = para.ellipsize
177177
layout.alignment = para.align

0 commit comments

Comments
 (0)