In the repeat loop set the attributes of the empty field and use measureText (or measureUnicodeText) to compute the textSize. As a last step fill the field.