hf_height function

Calculate desired header or footer height for the document