Fixing the Cufon Sub-menu Whitespace Error
Update: January 7, 2011
I noticed this bug happening again on another template I was working on and after some debugging I found out that wp_nav_menu also adds some tab characters. So make sure you take out these characters as well.
$menu = str_replace("\t", "", $menu);
I just came across this annoying error when using Cufon in WordPress with the wp_nav_menu function that adds an extra line-break with submenus. This causes Cufon to wrap canvas tags around the character and add extra spacing where it’s not needed. So here’s a quick little fix with wp_nav_menu to strip out all newline characters.
$menu = wp_nav_menu(
array(
'menu'=>'Nav',
'container_id'=>'nav',
'echo'=>0
)
);
$menu = str_replace("\n", "", $menu);
$menu = str_replace("\r", "", $menu);
echo $menu;

Congruent Style
Diggity Digital
Whole Kids Adventure