Friday, 27 November 2009

Making titles look right

A mixed-case title presents problems with vertical alignment: if none of the letters have a "descender" -ie the title does not include any of g j p q y - then you may want to sit the title lower on the page than if it does.

Here is a simple php function to check whether a string includes a descender:
function hasDescender($thisString){
    return (preg_match("/[gjpqy]/", $thisString));
}

No comments: