public static void AddCharactersProperties(CharacterRun characterRun, StringBuilder style) { AddBorder(characterRun.GetBorder(), string.Empty, style); if (characterRun.IsCapitalized()) { style.Append("text-transform:uppercase;"); } if (characterRun.GetIco24() != -1) { style.Append("color:" + GetColor24(characterRun.GetIco24()) + ";"); } if (characterRun.IsHighlighted()) { style.Append("background-color:" + GetColor(characterRun.GetHighlightedColor()) + ";"); } if (characterRun.IsStrikeThrough()) { style.Append("text-decoration:line-through;"); } if (characterRun.IsShadowed()) { style.Append("text-shadow:" + characterRun.GetFontSize() / 24 + "pt;"); } if (characterRun.IsSmallCaps()) { style.Append("font-variant:small-caps;"); } if (characterRun.GetSubSuperScriptIndex() == 1) { style.Append("vertical-align:super;"); style.Append("font-size:smaller;"); } if (characterRun.GetSubSuperScriptIndex() == 2) { style.Append("vertical-align:sub;"); style.Append("font-size:smaller;"); } if (characterRun.GetUnderlineCode() > 0) { style.Append("text-decoration:underline;"); } if (characterRun.IsVanished()) { style.Append("visibility:hidden;"); } }
public static void SetCharactersProperties(CharacterRun characterRun, XmlElement inline) { StringBuilder textDecorations = new StringBuilder(); SetBorder(inline, characterRun.GetBorder(), string.Empty); if (characterRun.GetIco24() != -1) { inline.SetAttribute("color", GetColor24(characterRun.GetIco24())); } int opacity = (int)(characterRun.GetIco24() & 0xFF000000L) >> 24; if (opacity != 0 && opacity != 0xFF) { inline.SetAttribute("opacity", GetOpacity(characterRun.GetIco24())); } if (characterRun.IsCapitalized()) { inline.SetAttribute("text-transform", "uppercase"); } if (characterRun.isHighlighted()) { inline.SetAttribute("background-color", GetColor(characterRun.GetHighlightedColor())); } if (characterRun.IsStrikeThrough()) { if (textDecorations.Length > 0) { textDecorations.Append(" "); } textDecorations.Append("line-through"); } if (characterRun.IsShadowed()) { inline.SetAttribute("text-shadow", characterRun.GetFontSize() / 24 + "pt"); } if (characterRun.IsSmallCaps()) { inline.SetAttribute("font-variant", "small-caps"); } if (characterRun.GetSubSuperScriptIndex() == 1) { inline.SetAttribute("baseline-shift", "super"); inline.SetAttribute("font-size", "smaller"); } if (characterRun.GetSubSuperScriptIndex() == 2) { inline.SetAttribute("baseline-shift", "sub"); inline.SetAttribute("font-size", "smaller"); } if (characterRun.GetUnderlineCode() > 0) { if (textDecorations.Length > 0) { textDecorations.Append(" "); } textDecorations.Append("underline"); } if (characterRun.IsVanished()) { inline.SetAttribute("visibility", "hidden"); } if (textDecorations.Length > 0) { inline.SetAttribute("text-decoration", textDecorations.ToString()); } }