public static string CreateStyle(int id, ArticleFontStyle style) { string backgroundColor = GetColor(style.BackgroundColor); string backgroundColorStyle = string.Empty; if (backgroundColor != "#FFFFFF") { backgroundColorStyle = string.Format("background-color: {0};", backgroundColor); } return(string.Format("span.s{0} {{ color: {1}; vertical-align: {2}; font-family: {3}; font-size: {4}pt; font-weight: {5}; font-style: {6}; text-decoration: {7}; {8} }}\n", id, GetColor(style.Color), GetVerticalAlign(style.VerticalAlign), GetFontFamily(style.FontFamily), GetFontSize(style.FontSize, style.FontSizeModificator), GetFontWeight(style.IsBold), GetFontStyle(style.IsItalic), GetTextDecoration(style.IsUnderline, style.IsStrikethrough), backgroundColorStyle)); }
private bool CanAddPartToBuffer(TextPart part) { if (_textBuffer.Count == 0) { return(true); } ArticleFontStyle a = _allStyles[_textBuffer[0].StyleId]; ArticleFontStyle b = _allStyles[part.StyleId]; if (a.FontSize == b.FontSize && a.FontSizeModificator == b.FontSizeModificator && a.VerticalAlign == b.VerticalAlign) { return(true); } return(false); }
public void SetStyle(uint aIndex, EngineWrapper.WSldStyleInfo aCurrentStyle, double fontSize) { ArticleFontStyle style = new ArticleFontStyle(); style.Color = aCurrentStyle.GetColor(); style.BackgroundColor = aCurrentStyle.GetBackgroundColor(); style.VerticalAlign = aCurrentStyle.GetLevel(); style.FontFamily = aCurrentStyle.GetStyleFontFamily(); style.FontSize = fontSize * _scale; style.FontSizeModificator = (WSldStyleSizeEnum)aCurrentStyle.GetTextSize(); style.IsBold = aCurrentStyle.IsBold() == 0 ? false : true; style.IsItalic = aCurrentStyle.IsItalic() == 0 ? false : true; style.IsUnderline = aCurrentStyle.IsUnderline() == 0 ? false : true; style.IsStrikethrough = aCurrentStyle.IsStrikethrough() == 0 ? false : true; _allStyles.Add((int)aIndex, style); }