RichText: Fixed underline problem, .uppbox

This commit is contained in:
Mirek Fidler 2023-09-28 11:28:38 +02:00
parent 2e003b932e
commit e2c50183e6
4 changed files with 27 additions and 27 deletions

View file

@ -17,8 +17,6 @@ String HtmlFontStyle(Font f, Font base)
style << (f.IsBold() ? "font-weight:bold;" : "font-weight:normal;");
if(f.IsItalic() != base.IsItalic())
style << (f.IsItalic() ? "font-style:italic;" : "font-style:normal;");
if(f.IsUnderline() != base.IsUnderline())
style << (f.IsUnderline() ? "text-decoration:underline;" : "text-decoration:none;");
return style;
}
@ -33,18 +31,6 @@ String HtmlFontStyle(Font f)
style << Sprintf("font-size:%dpt;", f.GetHeight() * 72 / 600);
style << (f.IsBold() ? "font-weight:bold;" : "font-weight:normal;");
style << (f.IsItalic() ? "font-style:italic;" : "font-style:normal;");
if(f.IsUnderline() || f.IsStrikeout()) {
style << "text-decoration:";
if(f.IsUnderline())
style << "underline";
if(f.IsStrikeout()) {
if(f.IsUnderline())
style << ' ';
style << "line-through";
}
}
else
style << "text-decoration:none;";
return style;
}
@ -270,9 +256,13 @@ String AsHtml(const RichTxt& text, const RichStyles& styles, Index<String>& css,
html << "<sub>";
endtag = "</sub>" + endtag;
}
if(part.format.IsUnderline()) {
html << "<u>";
endtag = "</u>" + endtag;
}
if(part.format.IsStrikeout()) {
html << "<strike>";
endtag = "</strike>" + endtag;
html << "<del>";
endtag = "</del>" + endtag;
}
if(part.format.capitals) {
html << "<span style=\"font-variant: small-caps;\">";