js version of FillText