It might be clearer to name `72 / 96` as ptPerPx or something.  And then I'd be tempted only to apply it below where you call `setAttributeNS` below (that is, don't scale height or width to pt or convert to a string until the last moment).