+
+
+namespace {
+
+string fontToTag(html::FontTypes type)
+ {
+ switch(type) {
+ case FT_EMPH:
+ return "em";
+ case FT_BOLD:
+ return "b";
+ case FT_NOUN:
+ return "dfn";
+ case FT_UBAR:
+ case FT_WAVE:
+ case FT_DBAR:
+ return "u";
+ case FT_SOUT:
+ return "del";
+ case FT_ITALIC:
+ return "i";
+ case FT_SLANTED:
+ case FT_SMALLCAPS:
+ case FT_ROMAN:
+ case FT_SANS:
+ case FT_TYPER:
+ return "span";
+ }
+ // kill warning
+ return "";
+}
+
+StartTag fontToStartTag(html::FontTypes type)
+ {
+ string tag = fontToTag(type);
+ switch(type) {
+ case FT_EMPH:
+ return html::StartTag(tag);
+ case FT_BOLD:
+ return html::StartTag(tag);
+ case FT_NOUN:
+ return html::StartTag(tag, "class='lyxnoun'");
+ case FT_UBAR:
+ return html::StartTag(tag);
+ case FT_DBAR:
+ return html::StartTag(tag, "class='dline'");
+ case FT_SOUT:
+ return html::StartTag(tag, "class='strikeout'");
+ case FT_WAVE:
+ return html::StartTag(tag, "class='wline'");
+ case FT_ITALIC:
+ return html::StartTag(tag);
+ case FT_SLANTED:
+ return html::StartTag(tag, "style='font-style:oblique;'");
+ case FT_SMALLCAPS:
+ return html::StartTag(tag, "style='font-variant:small-caps;'");
+ case FT_ROMAN:
+ return html::StartTag(tag, "style='font-family:serif;'");
+ case FT_SANS:
+ return html::StartTag(tag, "style='font-family:sans-serif;'");
+ case FT_TYPER:
+ return html::StartTag(tag, "style='font-family:monospace;'");
+ }
+ // kill warning
+ return StartTag("");
+}
+
+} // end anonymous namespace
+
+
+FontTag::FontTag(FontTypes type)
+ : StartTag(fontToStartTag(type)), font_type_(type)
+{}
+
+
+bool FontTag::operator==(StartTag const & tag) const
+{
+ FontTag const * const ftag = tag.asFontTag();
+ if (!ftag)
+ return false;
+ return (font_type_ == ftag->font_type_);
+}
+
+
+EndFontTag::EndFontTag(FontTypes type)
+ : EndTag(fontToTag(type)), font_type_(type)
+{}
+