This week we examine a script that replaces Wingdings checkboxes with Unicode checkboxes. This is a very useful thing to do for cross-browser compatibility, as some web browsers do not display Wingdings font sets correctly. Our script iterates over the document and examines every HTML tag to determine if it’s a font tag. If it is, the script checks if the tag has Wingdings set as its font. If so, the script then checks if the font tag is bold or not and stores this information. If the font tag has bold tags inside of it, the script notes that before removing them. The script also removes any space characters and checks the contents of the font tag. If all that remains is an ‘x’ character, it replaces the ‘x’ with a Unicode checkbox. If all that’s left is a ¨ char or an ‘o’ character, it replaces it with a Unicode open box. The script then adds tags as appropriate to embolden the checkbox.
Continue reading "Legato Developers Corner #5: Converting..." »