width and height calculation