In case its of interest to anyone else I have created the below script while we await a bug fix for copy fit. Thanks to Marten @ support for pointing out a few of my inaccuracies
The idea being you have a positioned box #AddressBox the address Text Script inside wrapped in a span #AddressSpan. When the span gets to big it will shrink until it fits, height and width wise. Seems to be working ok
var addressBoxHeight = query(“#AddressBox”).height();
var addressSpanHeight = query(“#AddressSpan”).height();
var fontSize = 10;
var minFontSize = 5;
results.css({
“flex-wrap”: “nowrap”,
“display”: “flex”,
“flex-direction”: “column-reverse”
});
while((fontSize > minFontSize) && ((addressBoxHeight < addressSpanHeight) || true == results.overflows()) ){
fontSize = fontSize-1;
query("#AddressBox").css("font-size", fontSize + "pt");
addressBoxHeight = query("#AddressBox").height();
addressSpanHeight = query("#AddressSpan").height();
}
if(fontSize == minFontSize || true == results.overflows()){
logger.error("Record “+ record.index.toString() + " to big for window INVESTIGATE NOW”);
}