From 06533d2c9e7b39b39007b15de34179a7668a9d77 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 19 Sep 2017 13:01:12 +0100 Subject: [PATCH] oop, proportion wrong --- libvips/create/text.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libvips/create/text.c b/libvips/create/text.c index b75d5430..8d12cb51 100644 --- a/libvips/create/text.c +++ b/libvips/create/text.c @@ -273,12 +273,13 @@ vips_text_autofit( VipsText *text ) /* Refine lower and upper until they are almost touching, or until we * fit exactly. */ - while( upper_dpi - lower_dpi > 2 && + while( upper_dpi - lower_dpi > 1 && lower_difference < 0 && upper_difference > 0 ) { int total_difference = upper_difference - lower_difference; - double x = (double) -lower_difference / total_difference; + double x = (double) upper_difference / total_difference; int guess_dpi = (upper_dpi - lower_dpi) * x + lower_dpi; + // guess_dpi = (upper_dpi + lower_dpi) / 2; text->dpi = guess_dpi; if( vips_text_get_extents( text, &extents ) )