Open adambundy opened 5 years ago
Thanks for this! Great plugin. Would be nice to be able to specify the size of the font-size 'steps', so that, for instance, half-pixel values could result. I've been trying to modify the plugin to do this without much success.
Try this for better precision ('steps')
// Binary search for highest best fit
var size = low;
while (low <= high) {
mid = (high + low) / 2;
innerSpan.style.fontSize = mid + 'px';
if(innerSpan.scrollWidth <= originalWidth && (settings.widthOnly || innerSpan.scrollHeight <= originalHeight)){
size = mid;
low = mid + 0.1;
} else {
high = mid - 0.1;
}
// await injection point
}
Thanks for this! Great plugin. Would be nice to be able to specify the size of the font-size 'steps', so that, for instance, half-pixel values could result. I've been trying to modify the plugin to do this without much success.