+ FontState curstate = font.fontInfo().emph();
+ if (font_old.emph() != curstate)
+ doFontSwitch(tagsToOpen, tagsToClose, emph_flag, curstate, html::FT_EMPH);
+
+ // noun
+ curstate = font.fontInfo().noun();
+ if (font_old.noun() != curstate)
+ doFontSwitch(tagsToOpen, tagsToClose, noun_flag, curstate, html::FT_NOUN);
+
+ // underbar
+ curstate = font.fontInfo().underbar();
+ if (font_old.underbar() != curstate)
+ doFontSwitch(tagsToOpen, tagsToClose, ubar_flag, curstate, html::FT_UBAR);
+
+ // strikeout
+ curstate = font.fontInfo().strikeout();
+ if (font_old.strikeout() != curstate)
+ doFontSwitch(tagsToOpen, tagsToClose, sout_flag, curstate, html::FT_SOUT);
+
+ // xout
+ curstate = font.fontInfo().xout();
+ if (font_old.xout() != curstate)
+ doFontSwitch(tagsToOpen, tagsToClose, xout_flag, curstate, html::FT_XOUT);
+
+ // double underbar
+ curstate = font.fontInfo().uuline();
+ if (font_old.uuline() != curstate)
+ doFontSwitch(tagsToOpen, tagsToClose, dbar_flag, curstate, html::FT_DBAR);
+
+ // wavy line
+ curstate = font.fontInfo().uwave();
+ if (font_old.uwave() != curstate)
+ doFontSwitch(tagsToOpen, tagsToClose, wave_flag, curstate, html::FT_WAVE);
+
+ // bold
+ // a little hackish, but allows us to reuse what we have.
+ curstate = (font.fontInfo().series() == BOLD_SERIES ? FONT_ON : FONT_OFF);
+ if (font_old.series() != font.fontInfo().series())
+ doFontSwitch(tagsToOpen, tagsToClose, bold_flag, curstate, html::FT_BOLD);
+
+ // Font shape
+ curr_fs = font.fontInfo().shape();
+ FontShape old_fs = font_old.shape();
+ if (old_fs != curr_fs) {
+ if (shap_flag) {
+ switch (old_fs) {
+ case ITALIC_SHAPE:
+ tagsToClose.push_back(html::EndFontTag(html::FT_ITALIC));
+ break;
+ case SLANTED_SHAPE:
+ tagsToClose.push_back(html::EndFontTag(html::FT_SLANTED));
+ break;
+ case SMALLCAPS_SHAPE:
+ tagsToClose.push_back(html::EndFontTag(html::FT_SMALLCAPS));
+ break;
+ case UP_SHAPE:
+ case INHERIT_SHAPE:
+ break;
+ default:
+ // the other tags are for internal use
+ LATTEST(false);
+ break;
+ }
+ shap_flag = false;
+ }
+ switch (curr_fs) {
+ case ITALIC_SHAPE:
+ tagsToOpen.push_back(html::FontTag(html::FT_ITALIC));
+ shap_flag = true;
+ break;
+ case SLANTED_SHAPE:
+ tagsToOpen.push_back(html::FontTag(html::FT_SLANTED));
+ shap_flag = true;
+ break;
+ case SMALLCAPS_SHAPE:
+ tagsToOpen.push_back(html::FontTag(html::FT_SMALLCAPS));
+ shap_flag = true;
+ break;
+ case UP_SHAPE:
+ case INHERIT_SHAPE:
+ break;
+ default:
+ // the other tags are for internal use
+ LATTEST(false);
+ break;