@@ -132,12 +132,14 @@ static void draw_button_tooltip(tooltip_context *c)
132132 const uint8_t * text = get_tooltip_text (c );
133133
134134 int width = 200 ;
135- int lines = text_measure_multiline (text , width - 5 , FONT_SMALL_PLAIN );
135+ int largest_width ;
136+ int lines = text_measure_multiline (text , width - 16 , FONT_SMALL_PLAIN , & largest_width );
136137 if (lines > 2 ) {
137138 width = 300 ;
138- lines = text_measure_multiline (text , width - 5 , FONT_SMALL_PLAIN );
139+ lines = text_measure_multiline (text , width - 16 , FONT_SMALL_PLAIN , & largest_width );
139140 }
140141 int height = 16 * lines + 10 ;
142+ width = largest_width + 16 ;
141143
142144 int x , y ;
143145 if (c -> mouse_x < screen_dialog_offset_x () + width + 100 ) {
@@ -191,19 +193,21 @@ static void draw_button_tooltip(tooltip_context *c)
191193
192194 graphics_draw_rect (x , y , width , height , COLOR_BLACK );
193195 graphics_fill_rect (x + 1 , y + 1 , width - 2 , height - 2 , COLOR_WHITE );
194- text_draw_multiline (text , x + 5 , y + 7 , width - 5 , FONT_SMALL_PLAIN , COLOR_TOOLTIP );
196+ text_draw_multiline (text , x + 8 , y + 8 , width - 15 , FONT_SMALL_PLAIN , COLOR_TOOLTIP );
195197}
196198
197199static void draw_overlay_tooltip (tooltip_context * c )
198200{
199201 const uint8_t * text = get_tooltip_text (c );
200202 int width = 200 ;
201- int lines = text_measure_multiline (text , width - 5 , FONT_SMALL_PLAIN );
203+ int largest_width ;
204+ int lines = text_measure_multiline (text , width - 16 , FONT_SMALL_PLAIN , & largest_width );
202205 if (lines > 2 ) {
203206 width = 300 ;
204- lines = text_measure_multiline (text , width - 5 , FONT_SMALL_PLAIN );
207+ lines = text_measure_multiline (text , width - 16 , FONT_SMALL_PLAIN , & largest_width );
205208 }
206209 int height = 16 * lines + 10 ;
210+ width = largest_width + 16 ;
207211
208212 int x , y ;
209213 if (c -> mouse_x < width + 20 ) {
@@ -223,7 +227,7 @@ static void draw_overlay_tooltip(tooltip_context *c)
223227
224228 graphics_draw_rect (x , y , width , height , COLOR_BLACK );
225229 graphics_fill_rect (x + 1 , y + 1 , width - 2 , height - 2 , COLOR_WHITE );
226- text_draw_multiline (text , x + 5 , y + 7 , width - 5 , FONT_SMALL_PLAIN , COLOR_TOOLTIP );
230+ text_draw_multiline (text , x + 8 , y + 8 , width - 15 , FONT_SMALL_PLAIN , COLOR_TOOLTIP );
227231}
228232
229233static void draw_senate_tooltip (tooltip_context * c )
0 commit comments