move text scale computation and some other funcs into root