make width type stable, and all kwargs typed

prior code allows for too much type uncertainty so when there is a problem (such as in constructing the c-format string), it is hard to know where it goes wrong.