public Node(StyleAttributes styleAttributes) { firstChild = null; lastChild = null; nextSibling = null; prevSibling = null; parent_ = null; upperNode = null; lowerNode = null; glyph = null; namespaceURI = ""; isVisible = true; isGlyph = false; skip = false; literalCaret = 0; literalStart = 0; isAppend = false; fontFamily = ""; tokenType = Tokens.ID; yOffset = 0; displayStyle = false; scriptLevel_ = 0; style_ = null; literalText = ""; type_ = null; attrs = null; tagDeleted = false; if (styleAttributes != null) { style_ = new StyleAttributes(); styleAttributes.CopyTo(style_); } }
public bool IsSameStyle(Node node) { if ((style_ == null) && (node.style_ == null)) { return(true); } if ((style_ != null) && (node.style_ == null)) { StyleAttributes styleAttributes = new StyleAttributes(); if (styleAttributes.HasSameStyle(style_)) { return(true); } } else if ((style_ == null) && (node.style_ != null)) { StyleAttributes styleAttributes = new StyleAttributes(); if (styleAttributes.HasSameStyle(node.style_)) { return(true); } } else if (((style_ != null) && (node.style_ != null)) && style_.HasSameStyle(node.style_)) { return(true); } return(false); }
public void SetScale(double scaling) { if (style_ == null) { style_ = new StyleAttributes(); } if (scaling == 1) { style_.hasSize = false; style_.size = ""; style_.scale = 1; style_.canOverride = true; } else { style_.hasSize = true; style_.scale = scaling; string size = (scaling * 100).ToString(); size = size.Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, "."); size = size + "%"; style_.size = size; style_.canOverride = true; } if (HasChildren()) { NodesList list = GetChildrenNodes(); for (Node node = list.Next(); node != null; node = list.Next()) { if (node.type_.type != ElementType.Entity) { node.SetScale(scaling); } } } }
public Input(string id = null, StyleAttributes style = null, string cssClass = null, string text = null) : base() { Style = style; Class = cssClass; ID = id; Text = text; }
/// <summary> /// Access the StyleAttributes of the style according to the given state. Example: Widgets.Styles[typeof(Button)]["hover"] ...; /// </summary> /// <param name="state">The string ID of the state to access.</param> /// <returns>The StyleAttributes object for the state. If it did not exist it will be created.</returns> public StyleAttributes this[String state] { get { if (state == null || state.Length == 0) return null; StyleAttributes attrs = null; if (!states.TryGetValue(state, out attrs)) { attrs = new StyleAttributes(); states.Add(state, attrs); } return attrs; } }
public override void Run() { Graphics.Erase(); var style = new StyleAttributes() { FaceColor = Colors.Red }; foreach (var element in FEM.Manager.CurrentModel.Elements) { if (element.Nodes.Count == 3) { Graphics.OverrideStyle("FEM@E:" + element.Number, style); } } Graphics.UpdateView(); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is bool) { bool isSold = (bool)value; if (isSold) { StyleAttributes style = new StyleAttributes(); style.Strikethrough = true; style.ForegroundColor = Colors.LightGray; return(style); } } return(null); }
public Node ParseMstyle(XmlNode XMLNode, Types mTypes, EntityManager mEntities, bool bAll, StyleAttributes styleAttributes) { StyleAttributes s = null; if ((XMLNode.Attributes == null) || (XMLNode.Attributes.Count <= 0)) { return(Parse(XMLNode, mTypes, mEntities, bAll, styleAttributes, true)); } Node node = new Node(); node.type_ = mTypes["mstyle"]; node.attrs = new AttributeList(); for (int i = 0; i < XMLNode.Attributes.Count; i++) { node.attrs.Add(new Attribute(XMLNode.Attributes[i].Name, XMLNode.Attributes[i].Value, "")); } StyleAttributes fromNode = new StyleAttributes(); s = new StyleAttributes(); fromNode = AttributeBuilder.StyleAttrsFromNode(node, true); if (fromNode != null) { if (styleAttributes != null) { node.style_ = new StyleAttributes(); fromNode.CopyTo(node.style_); node.style_.canOverride = true; s = node.CascadeOverride(styleAttributes); } else { fromNode.CopyTo(s); } } else { if (styleAttributes != null) { styleAttributes.CopyTo(s); } } s.canOverride = true; XMLNode.Attributes.RemoveAll(); return(Parse(XMLNode, mTypes, mEntities, bAll, s, true)); }
public void SetColor(Color _color) { if (style_ == null) { style_ = new StyleAttributes(); } style_.canOverride = true; style_.color = _color; style_.hasColor = true; if (HasChildren()) { NodesList list = GetChildrenNodes(); for (Node node = list.Next(); node != null; node = list.Next()) { node.SetColor(_color); } } }
public void SetStyle(StyleAttributes styleAttributes) { if (style_ == null) { style_ = new StyleAttributes(); } styleAttributes.CopyTo(style_); style_.canOverride = true; if (HasChildren()) { NodesList list = GetChildrenNodes(); for (Node child = list.Next(); child != null; child = list.Next()) { if (child.type_.type != ElementType.Entity) { child.SetStyle(styleAttributes); } } } }
public void SetBackground(Color _color) { if (style_ == null) { style_ = new StyleAttributes(); } style_.canOverride = true; style_.background = _color; style_.hasBackground = true; if (HasChildren()) { NodesList list = GetChildrenNodes(); for (Node node = list.Next(); node != null; node = list.Next()) { if (node.type_.type != ElementType.Entity) { node.SetBackground(_color); } } } }
public bool IsSameStyleParent() { if (parent_ != null) { if ((style_ != null) && (parent_.style_ == null)) { StyleAttributes styleAttributes = new StyleAttributes(); if (!styleAttributes.HasSameStyle(style_)) { return(true); } } else if ((style_ == null) && (parent_.style_ != null)) { StyleAttributes styleAttributes = new StyleAttributes(); if (!styleAttributes.HasSameStyle(parent_.style_)) { return(true); } } else if (((style_ != null) && (parent_.style_ != null)) && !parent_.style_.HasSameStyle(style_)) { if (parent_.type_.type == ElementType.Math) { StyleAttributes styleAttributes = new StyleAttributes(); if (styleAttributes.HasSameStyle(style_)) { return(false); } } return(true); } } return(false); }
public StyleAttributes CascadeOverride(StyleAttributes baseAttrs) { StyleAttributes own = null; StyleAttributes result = null; if (baseAttrs != null) { result = new StyleAttributes(); baseAttrs.CopyTo(result); } own = style_; if (own != null) { if (result == null) { result = new StyleAttributes(); own.CopyTo(result); return(result); } if (!own.canOverride) { return(result); } if (own.displayStyle != DisplayStyle.AUTOMATIC) { result.displayStyle = own.displayStyle; } if (own.scriptLevel != ScriptLevel.NONE) { result.scriptLevel = own.scriptLevel; } if (own.hasColor) { result.color = own.color; result.hasColor = true; } if (own.hasBackground) { result.background = own.background; result.hasBackground = true; } if (own.hasSize) { result.scale = own.scale; result.size = own.size; result.hasSize = true; } if (own.IsStyled) { result.isBold = own.isBold; result.isItalic = own.isItalic; } result.isUnderline = false; if (own.isNormal) { result.isNormal = true; } if (own.isScript) { result.isScript = true; } if (own.isSans) { result.isSans = true; } if (own.isFractur) { result.isFractur = true; } if (own.isDoubleStruck) { result.isDoubleStruck = true; } if (own.isMonospace) { result.isMonospace = true; } } return(result); }
public void MeasurePass(Painter g) { if (parent_ != null) { level = parent_.level + 1; } int x = 0; int y = 0; bool hasBox = false; if ((box != null)) { hasBox = true; x = box.X; y = box.Y; } if ((((box == null) || ((level < 2))) || ((level == 2))) || ((level > 2))) { BoxBuilder.MakeBox(this, g); } if ((type_ != null) && (type_.type == ElementType.Math)) { PushdownStyleScript(); } if (hasBox) { box.X = x; box.Y = y; } NodesList list = GetChildrenNodes(); Node n = list.Next(); if ((style_ != null) && (style_.size.Length > 0)) { try { style_.scale = StyleAttributes.FontScale(style_.size, (double)g.GetSuitableFont(this, style_).SizeInPoints); style_.size = ""; } catch { } } if ((style_ != null)) { if (type_.type == ElementType.Math) { style_.isTop = true; } else if (style_.canOverride) { style_.isTop = false; } } while (n != null) { if (style_ != null) { if (((n.style_ != null) && n.style_.canOverride) && n.IsSameStyleParent()) { n.CombineStyles(n.style_, style_); } else if (n.type_.type == ElementType.Entity) { n.style_ = null; } else { try { StyleAttributes style = n.CascadeOverride(style_); if (style != null) { if (type_.type == ElementType.Math) { style.fontFamily = ""; style.isUnderline = false; } n.style_ = new StyleAttributes(); style.CopyTo(n.style_); if ((style_ != null) && style_.isTop) { n.style_.canOverride = false; } } } catch { } } } n.MeasurePass(g); box.setChildSize(n); n = list.Next(); } if (((((level < 2)) || ((level == 2))) || ((level > 2)))) { box.getSize(this); } }
public void CombineStyles(StyleAttributes first, StyleAttributes second) { try { if (style_ == null) { return; } if (first.hasColor) { style_.color = first.color; style_.hasColor = true; } else { style_.color = second.color; style_.hasColor = false; } if (first.hasBackground) { style_.background = first.background; style_.hasBackground = true; } else { style_.background = second.background; style_.hasBackground = false; } if (first.hasSize) { style_.scale = first.scale; style_.size = first.size; style_.hasSize = true; } else { style_.scale = second.scale; style_.size = second.size; style_.hasSize = false; } if (first.IsStyled) { style_.isBold = first.isBold; style_.isItalic = first.isItalic; style_.isUnderline = first.isUnderline; style_.isNormal = first.isNormal; style_.isMonospace = first.isMonospace; style_.isScript = first.isScript; style_.isSans = first.isSans; style_.isFractur = first.isFractur; style_.isDoubleStruck = first.isDoubleStruck; } else { style_.isBold = second.isBold; style_.isItalic = second.isItalic; style_.isUnderline = second.isUnderline; style_.isNormal = second.isNormal; style_.isMonospace = second.isMonospace; style_.isScript = second.isScript; style_.isSans = second.isSans; style_.isFractur = second.isFractur; style_.isDoubleStruck = second.isDoubleStruck; } if (type_.type == ElementType.Math) { style_.fontFamily = ""; style_.isUnderline = false; } } catch { } }
public StylePropertiesDialog(StyleAttributes styleAttributes, Node parentNode) { this.container = null; this.color = Color.Black; this.background = Color.White; this.isBold = false; this.isItalic = false; this.isFraktur = false; this.isNormal = false; this.isDoubleStruck = false; this.isScript = false; this.isMonospace = false; this.isSans = false; this.isBig = false; this.isNormalVar = false; this.isSmall = false; this.success = false; this.hasScriptLevel = false; this.InitializeComponent(); this.Style = styleAttributes; this.color = this.Style.color; this.background = this.Style.background; this.isBold = this.Style.isBold; this.isItalic = this.Style.isItalic; this.isFraktur = this.Style.isFractur; this.isNormal = this.Style.isNormal; this.isDoubleStruck = this.Style.isDoubleStruck; this.isMonospace = this.Style.isMonospace; this.isScript = this.Style.isScript; this.isSans = this.Style.isSans; this.sizeEdit.Text = this.Style.FontSize(); if (this.Style.scale == 1.25) { this.isBig = true; } else if (this.Style.scale == 0.8) { this.isSmall = true; } else if (this.Style.scale == 1) { this.isNormalVar = true; } DisplayStyle displayStyle = DisplayStyle.AUTOMATIC; ScriptLevel scriptLevel = ScriptLevel.NONE; if ((parentNode != null) && (parentNode.style_ != null)) { displayStyle = parentNode.style_.displayStyle; scriptLevel = parentNode.style_.scriptLevel; } if ((this.Style.displayStyle == DisplayStyle.TRUE) && (this.Style.displayStyle != displayStyle)) { this.dispStyle.SelectedItem = this.dispStyle.Items[1]; } else if ((this.Style.displayStyle == DisplayStyle.FALSE) && (this.Style.displayStyle != displayStyle)) { this.dispStyle.SelectedItem = this.dispStyle.Items[2]; } else { this.dispStyle.SelectedItem = this.dispStyle.Items[0]; } try { this.scriptLevel.SelectedItem = this.scriptLevel.Items[0]; if ((this.Style.scriptLevel != ScriptLevel.NONE) && (this.Style.scriptLevel != scriptLevel)) { switch (this.Style.scriptLevel) { case ScriptLevel.ZERO: { this.scriptLevel.SelectedItem = this.scriptLevel.Items[1]; break; } case ScriptLevel.ONE: { this.scriptLevel.SelectedItem = this.scriptLevel.Items[2]; break; } case ScriptLevel.TWO: { this.scriptLevel.SelectedItem = this.scriptLevel.Items[3]; break; } case ScriptLevel.PLUS_ONE: { this.scriptLevel.SelectedItem = this.scriptLevel.Items[4]; break; } case ScriptLevel.PLUS_TWO: { this.scriptLevel.SelectedItem = this.scriptLevel.Items[5]; break; } case ScriptLevel.MINUS_ONE: { this.scriptLevel.SelectedItem = this.scriptLevel.Items[6]; break; } case ScriptLevel.MINUS_TWO: { this.scriptLevel.SelectedItem = this.scriptLevel.Items[7]; break; } } } } catch { } this.smallVar.Checked = this.isSmall; this.normalVar.Checked = this.isNormalVar; this.bigVar.Checked = this.isBig; this.foreColorPanel.BackColor = this.color; this.backColorPanel.BackColor = this.background; this.foreColorPanel.BackColor = this.color; this.backColorPanel.BackColor = this.background; this.bold.Checked = this.isBold; this.italic.Checked = this.isItalic; this.doubleStruck.Checked = this.isDoubleStruck; this.fraktur.Checked = this.isFraktur; this.monospace.Checked = this.isMonospace; this.sansSerif.Checked = this.isSans; this.script.Checked = this.isScript; this.normal.Checked = this.isNormal; if (((!this.isBold && !this.isItalic) && (!this.isDoubleStruck && !this.isFraktur)) && ((!this.isMonospace && !this.isSans) && (!this.isScript && !this.isNormal))) { this.notSet.Checked = true; } this.hasScriptLevel = true; }
public void DrawString(Node node, StyleAttributes styleAttributes, string text, Color color) { this.DrawString(node, styleAttributes, node.box.X, node.box.Y, node.box.Dx, node.box.Dy, text, color); }
public void DrawString(Node node, StyleAttributes styleAttributes, int x, int y, int dx, int dy, string text, Color color) { Brush brush1; if (styleAttributes != null) { if (node.NotBlack() || (((node.type_.type == ElementType.Entity) && (node.parent_ != null)) && node.parent_.NotBlack())) { brush1 = new SolidBrush(styleAttributes.color); } else { brush1 = new SolidBrush(color); } } else if (color != Color.Black) { brush1 = new SolidBrush(color); } else { brush1 = this.blackBrush; } System.Drawing.Font font1 = this.GetSuitableFont(node, styleAttributes); PointF tf1 = new PointF((float)((this.oX + x) + dx), (float)((this.oY + y) + dy)); if (((node.glyph != null) && node.glyph.IsVisible) && ((node.glyph.Category.Name != "Spaces") && (node.glyph.FontFamily.Length == 0))) { brush1 = new SolidBrush(Color.Red); this.graphics_.DrawString("?", font1, brush1, tf1, this.typographicsFormat); return; } if ((text == "{")) { try { double num3 = this.MeasureWidth(node, node.style_, text); double num4 = 0.1; double num5 = num4 * num3; tf1.X -= (int)Math.Round(num5); } catch { } } if (((node.type_.type == ElementType.Entity) && (node.glyph != null)) && (node.glyph.Code == "0222C")) { this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); tf1.X += node.box.Width / 3; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); goto Label_1B94; } if (((node.type_.type == ElementType.Entity) && (node.glyph != null)) && (node.glyph.Code == "000A8")) { string text1 = ""; text1 = text + text; this.graphics_.DrawString(text1, font1, brush1, tf1, this.typographicsFormat); goto Label_1B94; } if (((node.type_.type == ElementType.Entity) && (node.glyph != null)) && (node.glyph.Code == "0222D")) { this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); tf1.X += node.box.Width / 4; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); tf1.X += node.box.Width / 4; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); goto Label_1B94; } if (((node.type_.type != ElementType.Entity) || (node.glyph == null)) || (((((node.glyph.Code != "02192") && (node.glyph.Code != "02190")) && ((node.glyph.Code != "02194") && (node.glyph.Code != "0F576"))) && (((node.glyph.Code != "0F577") && (node.glyph.Code != "0F578")) && ((node.glyph.Code != "021C4") && (node.glyph.Code != "021C6")))) && ((((node.glyph.Code != "021CC") && (node.glyph.Code != "021CB")) && ((node.glyph.Code != "021C0") && (node.glyph.Code != "021C1"))) && ((((node.glyph.Code != "021BC") && (node.glyph.Code != "021BD")) && ((node.glyph.Code != "0005E") && (node.glyph.Code != "000AF"))) && (((node.glyph.Code != "0FE37") && (node.glyph.Code != "0FE38")) && (node.glyph.Code != "00332")))))) { this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); goto Label_1B94; } float single1 = node.box.Width; float single2 = node.box.Height; this.graphics_.SetClip(new Rectangle((int)tf1.X, ((int)tf1.Y) - 20, node.box.Width, node.box.Height + 40)); try { PointF tf2; SizeF ef1; if (node.glyph.Code == "0FE37") { ef1 = this.graphics_.MeasureString("D", font1, tf1, this.typographicsFormat); float single3 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single4 = ef1.Width; ef1 = this.graphics_.MeasureString("F", font1, tf1, this.typographicsFormat); float single5 = ef1.Width; ef1 = this.graphics_.MeasureString("C", font1, tf1, this.typographicsFormat); float single6 = ef1.Width; float single7 = 0f; float single8 = 0f; single8 = tf1.X; single6 -= 2f; this.graphics_.DrawString("D", font1, brush1, tf1, this.typographicsFormat); tf2 = tf1; tf2.X += single3 - 2f; single7 = single3 - 2f; int num6 = ((int)(((single1 / 2f) - (single4 / 2f)) - single3)) + 4; this.graphics_.SetClip(new Rectangle((int)tf2.X, ((int)tf2.Y) - 20, num6, node.box.Height + 40)); try { while (single7 < ((single1 / 2f) - (single4 / 2f))) { this.graphics_.DrawString("C", font1, brush1, tf2, this.typographicsFormat); tf2.X += single6; single7 += single6; } } catch { } this.graphics_.ResetClip(); tf2 = tf1; tf2.X += ((single1 / 2f) + (single4 / 2f)) - 2f; single7 = ((single1 / 2f) + (single4 / 2f)) - 2f; this.graphics_.SetClip(new Rectangle((int)tf2.X, ((int)tf2.Y) - 20, num6, node.box.Height + 40)); try { while (single7 < (single1 - single5)) { this.graphics_.DrawString("C", font1, brush1, tf2, this.typographicsFormat); tf2.X += single6; single7 += single6; } } catch { } this.graphics_.ResetClip(); tf1.X = (single8 + (single1 / 2f)) - (single4 / 2f); this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); tf1.X = (single8 + single1) - single5; this.graphics_.DrawString("F", font1, brush1, tf1, this.typographicsFormat); } else if (node.glyph.Code == "0FE38") { ef1 = this.graphics_.MeasureString("?", font1, tf1, this.typographicsFormat); float single9 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single10 = ef1.Width; ef1 = this.graphics_.MeasureString("A", font1, tf1, this.typographicsFormat); float single11 = ef1.Width; ef1 = this.graphics_.MeasureString("C", font1, tf1, this.typographicsFormat); float single12 = ef1.Width; float single13 = 0f; float single14 = 0f; single14 = tf1.X; single12 -= 2f; this.graphics_.DrawString("?", font1, brush1, tf1, this.typographicsFormat); tf2 = tf1; tf2.X += single9 - 2f; single13 = single9 - 2f; int num7 = ((int)(((single1 / 2f) - (single10 / 2f)) - single9)) + 4; this.graphics_.SetClip(new Rectangle((int)tf2.X, ((int)tf2.Y) - 20, num7, node.box.Height + 40)); try { while (single13 < ((single1 / 2f) - (single10 / 2f))) { this.graphics_.DrawString("C", font1, brush1, tf2, this.typographicsFormat); tf2.X += single12; single13 += single12; } } catch { } this.graphics_.ResetClip(); tf2 = tf1; tf2.X += ((single1 / 2f) + (single10 / 2f)) - 2f; single13 = ((single1 / 2f) + (single10 / 2f)) - 2f; this.graphics_.SetClip(new Rectangle((int)tf2.X, ((int)tf2.Y) - 20, num7, node.box.Height + 40)); try { while (single13 < (single1 - single11)) { this.graphics_.DrawString("C", font1, brush1, tf2, this.typographicsFormat); tf2.X += single12; single13 += single12; } } catch { } this.graphics_.ResetClip(); tf1.X = (single14 + (single1 / 2f)) - (single10 / 2f); this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); tf1.X = (single14 + single1) - single11; this.graphics_.DrawString("A", font1, brush1, tf1, this.typographicsFormat); } else if (node.glyph.Code == "021C4") { ef1 = this.graphics_.MeasureString("&", font1, tf1, this.typographicsFormat); float single15 = ef1.Width; ef1 = this.graphics_.MeasureString("(", font1, tf1, this.typographicsFormat); float single16 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single17 = ef1.Width; float single18 = 0f; this.graphics_.DrawString("&", font1, brush1, tf1, this.typographicsFormat); tf2 = tf1; tf2.X += single15; for (single18 = single15; single18 < (single1 - single17); single18 += single16) { this.graphics_.DrawString("(", font1, brush1, tf2, this.typographicsFormat); tf2.X += single16; } tf1.X = (tf1.X + single1) - single17; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); } else if (node.glyph.Code == "021C6") { ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single19 = ef1.Width; ef1 = this.graphics_.MeasureString("(", font1, tf1, this.typographicsFormat); float single20 = ef1.Width; ef1 = this.graphics_.MeasureString(",", font1, tf1, this.typographicsFormat); float single21 = ef1.Width; float single22 = 0f; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); tf2 = tf1; tf2.X += single19; for (single22 = single19; single22 < (single1 - single21); single22 += single20) { this.graphics_.DrawString("(", font1, brush1, tf2, this.typographicsFormat); tf2.X += single20; } tf1.X = (tf1.X + single1) - single21; this.graphics_.DrawString(",", font1, brush1, tf1, this.typographicsFormat); } else if (node.glyph.Code == "021CC") { ef1 = this.graphics_.MeasureString("2", font1, tf1, this.typographicsFormat); float single23 = ef1.Width; ef1 = this.graphics_.MeasureString("(", font1, tf1, this.typographicsFormat); float single24 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single25 = ef1.Width; float single26 = 0f; this.graphics_.DrawString("2", font1, brush1, tf1, this.typographicsFormat); tf2 = tf1; tf2.X += single23; for (single26 = single23; single26 < (single1 - single25); single26 += single24) { this.graphics_.DrawString("(", font1, brush1, tf2, this.typographicsFormat); tf2.X += single24; } tf1.X = (tf1.X + single1) - single25; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); } else if (node.glyph.Code == "021CB") { ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single27 = ef1.Width; ef1 = this.graphics_.MeasureString("(", font1, tf1, this.typographicsFormat); float single28 = ef1.Width; ef1 = this.graphics_.MeasureString("3", font1, tf1, this.typographicsFormat); float single29 = ef1.Width; float single30 = 0f; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); tf2 = tf1; tf2.X += single27; for (single30 = single27; single30 < (single1 - single29); single30 += single28) { this.graphics_.DrawString("(", font1, brush1, tf2, this.typographicsFormat); tf2.X += single28; } tf1.X = (tf1.X + single1) - single29; this.graphics_.DrawString("3", font1, brush1, tf1, this.typographicsFormat); } else if ((node.glyph.Code == "02192") || (node.glyph.Code == "0F577")) { ef1 = this.graphics_.MeasureString("$", font1, tf1, this.typographicsFormat); float single31 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single32 = ef1.Width; float single33 = 0f; single31 -= 1f; tf2 = tf1; while (single33 < (single1 - single32)) { this.graphics_.DrawString("$", font1, brush1, tf2, this.typographicsFormat); tf2.X += single31; single33 += single31; } tf1.X = (tf1.X + single1) - single32; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); } else { if (node.glyph.Code == "0005E") { tf2 = tf1; try { ef1 = this.graphics_.MeasureString("m", font1, tf1, this.typographicsFormat); float single34 = ef1.Width; if (single1 > (single34 * 1.1)) { float single35 = single1 / 2f; single35 = (float)Math.Round((double)single35); float single36 = single2 / 3f; single36 = (float)Math.Round((double)single36); if (single36 < 1f) { single36 = 1f; } PointF tf3 = new PointF(tf2.X, tf2.Y + single2); PointF tf4 = new PointF(tf2.X + single35, tf2.Y); PointF tf5 = new PointF(tf2.X + single1, tf2.Y + single2); PointF tf6 = new PointF(tf2.X + single35, tf2.Y + single36); GraphicsPath path1 = new GraphicsPath(); path1.AddLine(tf3, tf4); path1.AddLine(tf4, tf5); path1.AddLine(tf5, tf6); path1.AddLine(tf6, tf3); this.graphics_.FillPath(brush1, path1); goto Label_1B71; } this.graphics_.DrawString(text, font1, brush1, tf2, this.typographicsFormat); goto Label_1B71; } catch { goto Label_1B71; } } if (node.glyph.Code == "000AF") { ef1 = this.graphics_.MeasureString("$", font1, tf1, this.typographicsFormat); float single37 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single38 = ef1.Width; float single39 = 0f; tf2 = tf1; while (single39 < (single1 - single38)) { this.graphics_.DrawString("$", font1, brush1, tf2, this.typographicsFormat); tf2.X += single37; single39 += single37; } tf1.X = (tf1.X + single1) - single38; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); } else if (node.glyph.Code == "00332") { ef1 = this.graphics_.MeasureString("$", font1, tf1, this.typographicsFormat); float single40 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single41 = ef1.Width; float single42 = 0f; tf2 = tf1; while (single42 < (single1 - single41)) { this.graphics_.DrawString("$", font1, brush1, tf2, this.typographicsFormat); tf2.X += single40; single42 += single40; } tf1.X = (tf1.X + single1) - single41; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); } else if ((node.glyph.Code == "021C0") || (node.glyph.Code == "021C1")) { ef1 = this.graphics_.MeasureString("$", font1, tf1, this.typographicsFormat); float single43 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single44 = ef1.Width; float single45 = 0f; tf2 = tf1; while (single45 < (single1 - single44)) { this.graphics_.DrawString("$", font1, brush1, tf2, this.typographicsFormat); tf2.X += single43; single45 += single43; } tf1.X = (tf1.X + single1) - single44; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); } else if ((node.glyph.Code == "021BC") || (node.glyph.Code == "021BD")) { ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single46 = ef1.Width; ef1 = this.graphics_.MeasureString("$", font1, tf1, this.typographicsFormat); float single47 = ef1.Width; float single48 = 0f; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); tf2 = tf1; tf2.X = (tf2.X + single1) - single47; for (single48 = single1; single48 > single46; single48 -= single47) { this.graphics_.DrawString("$", font1, brush1, tf2, this.typographicsFormat); tf2.X -= single47; } } else if ((node.glyph.Code == "02190") || (node.glyph.Code == "0F576")) { ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single49 = ef1.Width; ef1 = this.graphics_.MeasureString("$", font1, tf1, this.typographicsFormat); float single50 = ef1.Width; float single51 = 0f; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); single50 -= 1f; tf2 = tf1; tf2.X = (tf2.X + single1) - single50; for (single51 = single1; single51 > single49; single51 -= single50) { this.graphics_.DrawString("$", font1, brush1, tf2, this.typographicsFormat); tf2.X -= single50; } } else if ((node.glyph.Code == "0F578") || (node.glyph.Code == "02194")) { ef1 = this.graphics_.MeasureString("!", font1, tf1, this.typographicsFormat); float single52 = ef1.Width; ef1 = this.graphics_.MeasureString("$", font1, tf1, this.typographicsFormat); float single53 = ef1.Width; ef1 = this.graphics_.MeasureString(text, font1, tf1, this.typographicsFormat); float single54 = ef1.Width; float single55 = 0f; this.graphics_.DrawString("!", font1, brush1, tf1, this.typographicsFormat); single53 -= 1f; single52 -= 1f; tf2 = tf1; tf2.X += single52; for (single55 = single52; single55 < (single1 - single54); single55 += single53) { this.graphics_.DrawString("$", font1, brush1, tf2, this.typographicsFormat); tf2.X += single53; } tf1.X = (tf1.X + single1) - single54; this.graphics_.DrawString(text, font1, brush1, tf1, this.typographicsFormat); } } } catch { } Label_1B71: this.graphics_.ResetClip(); Label_1B94: if (!node.IsUnderlined()) { return; } int num8 = (int)this.Leading((float)node.box.Height, font1); this.graphics_.DrawLine(new Pen(brush1), this.oX + node.box.X, ((this.oY + node.box.Y) + node.box.Height) - (num8 / 2), (this.oX + node.box.X) + node.box.Width, ((this.oY + node.box.Y) + node.box.Height) - (num8 / 2)); }
public extern static ReactElement Style(StyleAttributes properties, params ReactElementOrText[] children);
public void DrawString(Node node, StyleAttributes styleAttributes, Color color) { this.DrawString(node, styleAttributes, node.literalText, color); }
public Node Parse(XmlNode XMLNode, Types mTypes, EntityManager mEntities, bool bAll, StyleAttributes styleAttributes) { return(Parse(XMLNode, mTypes, mEntities, bAll, styleAttributes, false)); }
public Node Parse(XmlNode XMLNode, Types mTypes, EntityManager mEntities, bool recurse, StyleAttributes styleAttributes, bool bParentShift) { bool hasSelect = false; bool hasSelectRight = false; Node result = null; if (!bParentShift) { xmlTagName = XMLNode.LocalName; namespaceURI = XMLNode.NamespaceURI; } int numAttrs = 0; if ((recurse && (XMLNode.Attributes != null)) && !bParentShift) { StyleAttributes attributes = ParseMStyle(XMLNode, style_); if (attributes != null) { if (style_ == null) { style_ = new StyleAttributes(); } attributes.CopyTo(style_); } numAttrs = XMLNode.Attributes.Count; if (numAttrs > 0) { if (attrs == null) { attrs = new AttributeList(); } for (int i = 0; i < numAttrs; i++) { if (XMLNode.Attributes[i].Name == "nugenCursor") { result = this; hasSelect = true; } else if (XMLNode.Attributes[i].Name == "nugenCursorEnd") { result = this; result.IsAppend = true; hasSelectRight = true; } else { attrs.Add(new Attribute(XMLNode.Attributes[i].Name, XMLNode.Attributes[i].Value, XMLNode.Attributes[i].NamespaceURI)); } } if (hasSelect) { XMLNode.Attributes.RemoveNamedItem("nugenCursor"); } if (hasSelectRight) { XMLNode.Attributes.RemoveNamedItem("nugenCursorEnd"); } } } if ((XMLNode.NodeType == XmlNodeType.Element) && !bParentShift) { if (type_ == null) { type_ = mTypes[xmlTagName]; } if ((hasSelect && (type_.type == ElementType.Mi)) && (literalText != null)) { InternalMark = literalText.Length; } } if (recurse && XMLNode.HasChildNodes) { XmlNodeList list = XMLNode.ChildNodes; for (int i = 0; i < list.Count; i++) { if (list[i].NodeType == XmlNodeType.Text) { if ((type_.type == ElementType.Mtext) || (type_.type == ElementType.Ms)) { literalText += list[i].Value; continue; } if (type_.type == ElementType.Mn) { literalText += list[i].Value.Trim(); continue; } if (type_.type == ElementType.Mi) { literalText += list[i].Value.Trim(); continue; } if (type_.type != ElementType.Mo) { continue; } string entityChar = list[i].Value.Trim(); bool isGlyph = false; try { Glyph glyph; if (!(((((entityChar != "(") && (entityChar != ")")) && ((entityChar != "[") && (entityChar != "]"))) && (((entityChar != "{") && (entityChar != "}")) && ((entityChar != "|") && (entityChar != "||")))) && (((entityChar != "+") && (entityChar != "-")) && ((entityChar != "=") && (entityChar != "/"))))) { string entityName = ""; switch (entityChar) { case "(": { entityName = "lpar"; break; } case ")": { entityName = "rpar"; break; } case "[": { entityName = "lbrack"; break; } case "]": { entityName = "rbrack"; break; } case "{": { entityName = "lbrace"; break; } case "}": { entityName = "rbrace"; break; } case "|": { entityName = "verbar"; break; } case "||": { entityName = "Verbar"; break; } case "+": { entityName = "plus"; break; } case "-": { entityName = "minus"; break; } case "=": { entityName = "equals"; break; } case "/": { entityName = "sol"; break; } } glyph = mEntities.ByName(entityName); if (glyph != null) { Node glyphNode = new Node(); glyphNode.type_ = mTypes["entity"]; glyphNode.literalText = "" + glyph.CharValue; glyphNode.fontFamily = glyph.FontFamily; glyphNode.glyph = glyph; glyphNode.xmlTagName = glyph.Name; AdoptChild(glyphNode); isGlyph = true; } } } catch { } if (!isGlyph) { literalText += entityChar; } continue; } if (list[i].NodeType == XmlNodeType.SignificantWhitespace) { continue; } if (list[i].NodeType == XmlNodeType.Whitespace) { if ((type_.type == ElementType.Mtext) || (type_.type == ElementType.Ms)) { literalText += " "; } continue; } if (list[i].NodeType == XmlNodeType.Element) { if ((list[i].NamespaceURI == "http://www.w3.org/1998/Math/MathML") && (list[i].LocalName == "mstyle")) { Node mstyl = ParseMstyle(list[i], mTypes, mEntities, recurse, styleAttributes); if (mstyl != null) { result = mstyl; } } else { Node n = new Node(XMLNode.Name, styleAttributes); n.type_ = mTypes[list[i].LocalName]; if (AdoptChild(n)) { Node sn = n.Parse(list[i], mTypes, mEntities, recurse, styleAttributes, false); if (sn != null) { result = sn; } } } continue; } if (list[i].NodeType == XmlNodeType.EntityReference) { Node n = new Node(); n.type_ = mTypes["entity"]; if ((type_.type == ElementType.Mtext) || (type_.type == ElementType.Ms)) { Glyph glyph = mEntities.ByName(list[i].LocalName); if (glyph != null) { char c = Convert.ToChar(Convert.ToUInt32(glyph.Code, 0x10)); if (char.IsWhiteSpace(c) || char.IsControl(c)) { literalText = literalText + " "; } else { literalText = literalText + c; } } } else { try { Glyph glyph = mEntities.ByName(list[i].LocalName); if (glyph != null) { n.literalText = ""; n.literalText = n.literalText + glyph.CharValue; n.fontFamily = glyph.FontFamily; n.glyph = glyph; n.xmlTagName = list[i].LocalName; } else { n.literalText = "?"; n.xmlTagName = list[i].LocalName; } AdoptChild(n); } catch { n.literalText = "?"; n.xmlTagName = list[i].LocalName; AdoptChild(n); } } } } } return(result); }
public StyleAttributes ParseMStyle(XmlNode xmlNode, StyleAttributes baseStyle) { bool hasStyleAttrs = false; bool hasColor = false; bool hasBackground = false; bool hasMathsize = false; bool hasVariant = false; StyleAttributes r = null; int count = 0; if (((xmlNode != null) && (((xmlNode.Name == "mi") || (xmlNode.Name == "mo")) || (((xmlNode.Name == "mn") || (xmlNode.Name == "ms")) || (xmlNode.Name == "mtext")))) && (xmlNode.Attributes != null)) { try { count = xmlNode.Attributes.Count; for (int i = 0; i < count; i++) { string name = xmlNode.Attributes[i].Name.Trim().ToLower(); if (((name == "mathvariant") || (name == "mathcolor")) || ((name == "mathbackground") || (name == "mathsize"))) { hasStyleAttrs = true; } if (name == "mathvariant") { hasVariant = true; } if (name == "mathcolor") { hasColor = true; } if (name == "mathbackground") { hasBackground = true; } if (name == "mathsize") { hasMathsize = true; } } } catch { } } if (hasStyleAttrs) { try { Node n = new Node(); n.attrs = new AttributeList(); for (int i = 0; i < count; i++) { n.attrs.Add(new Attribute(xmlNode.Attributes[i].Name, xmlNode.Attributes[i].Value, "")); } StyleAttributes nodeStyleAttrs = AttributeBuilder.StyleAttrsFromNode(n); if (nodeStyleAttrs != null) { nodeStyleAttrs.canOverride = true; r = new StyleAttributes(); if (baseStyle != null) { n.style_ = new StyleAttributes(); nodeStyleAttrs.CopyTo(n.style_); r = n.CascadeOverride(baseStyle); } else { nodeStyleAttrs.CopyTo(r); } r.canOverride = true; } if (hasMathsize) { xmlNode.Attributes.RemoveNamedItem("mathsize", ""); } if (hasVariant) { xmlNode.Attributes.RemoveNamedItem("mathvariant", ""); } if (hasColor) { xmlNode.Attributes.RemoveNamedItem("mathcolor", ""); } if (hasBackground) { xmlNode.Attributes.RemoveNamedItem("mathbackground", ""); } } catch { } } return(r); }
private System.Drawing.Font MakeFont(Node node, int mode, Category category, int level, StyleAttributes styleAttributes) { string fontName; double level0Scale = 1; double level1Scale = 0.71; double level2Scale = 0.5; System.Drawing.FontStyle fontStyle = System.Drawing.FontStyle.Regular; if (styleAttributes != null) { level0Scale = styleAttributes.scale; if (styleAttributes.isBold) { fontStyle |= System.Drawing.FontStyle.Bold; } if (styleAttributes.isItalic) { fontStyle |= System.Drawing.FontStyle.Italic; } bool flag1 = styleAttributes.isUnderline; } switch (category) { case Category.BOLD: { fontStyle |= System.Drawing.FontStyle.Bold; break; } case Category.UNKNOWN: { if (((node != null) && (node.type_ != null)) && (node.type_.type == ElementType.Mi)) { if (styleAttributes == null) { fontStyle |= System.Drawing.FontStyle.Italic; break; } if (styleAttributes.isTop) { fontStyle |= System.Drawing.FontStyle.Italic; } else if (((!styleAttributes.isNormal && !styleAttributes.isBold) && (!styleAttributes.isDoubleStruck && !styleAttributes.isFractur)) && ((!styleAttributes.isMonospace && !styleAttributes.isSans) && !styleAttributes.isScript)) { fontStyle |= System.Drawing.FontStyle.Italic; } } break; } } switch (category) { case Category.OPERATOR: case Category.NUMBER: case Category.UNKNOWN: if (styleAttributes != null) { if (styleAttributes.isSans) { category = Category.SANSSERIF; } else if (styleAttributes.isMonospace) { category = Category.MONOSPACE; } else if (((styleAttributes.isFractur && (node != null)) && ((node.literalText != null) && (node.literalText.Length > 0))) && this.IsAlphaCaseless(node.literalText)) { category = Category.FRACTUR; } else if (((styleAttributes.isDoubleStruck && (node != null)) && ((node.literalText != null) && (node.literalText.Length > 0))) && this.IsAlpha(node.literalText)) { category = Category.DOUBLESTRUCK; } else if (((styleAttributes.isScript && (node != null)) && ((node.literalText != null) && (node.literalText.Length > 0))) && this.IsAlphaCaseless(node.literalText)) { category = Category.SCRIPT; } } break; } switch (category) { case Category.SYMBOL: { switch (level) { case 0: { if (mode == 1) { return(new System.Drawing.Font("Symbol", this.textSize)); } if (styleAttributes == null) { return(this.symbol0); } return(new System.Drawing.Font("Symbol", (float)(this.textSize * level0Scale), fontStyle)); } case 1: { if (mode == 1) { return(new System.Drawing.Font("Symbol", (float)(this.textSize * level1Scale))); } if (styleAttributes == null) { return(this.symbol1); } return(new System.Drawing.Font("Symbol", (float)((this.textSize * level1Scale) * level0Scale), fontStyle)); } case 2: { if (mode == 1) { return(new System.Drawing.Font("Symbol", (float)(this.textSize * level2Scale))); } if (styleAttributes == null) { return(this.symbol2); } return(new System.Drawing.Font("Symbol", (float)((this.textSize * level2Scale) * level0Scale), fontStyle)); } } break; } case Category.BOLD: { switch (level) { case 0: { if (mode == 1) { return(new System.Drawing.Font("Symbol", (float)(this.textSize * 1.5), System.Drawing.FontStyle.Bold)); } if (styleAttributes == null) { return(this.bold0); } return(new System.Drawing.Font("Symbol", (float)((this.textSize * 1.5) * level0Scale), fontStyle)); } case 1: { if (mode == 1) { return(new System.Drawing.Font("Symbol", (float)((this.textSize * 1.5) * level1Scale), System.Drawing.FontStyle.Bold)); } if (styleAttributes == null) { return(this.bold1); } return(new System.Drawing.Font("Symbol", (float)(((this.textSize * 1.5) * level1Scale) * level0Scale), fontStyle)); } case 2: { if (mode == 1) { return(new System.Drawing.Font("Symbol", (float)((this.textSize * 1.5) * level2Scale), System.Drawing.FontStyle.Bold)); } if (styleAttributes == null) { return(this.bold2); } return(new System.Drawing.Font("Symbol", (float)(((this.textSize * 1.5) * level2Scale) * level0Scale), fontStyle)); } } break; } case Category.OPERATOR: { switch (level) { case 0: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", this.textSize)); } if (styleAttributes == null) { return(this.operator0); } return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level0Scale), fontStyle)); } case 1: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level1Scale))); } if (styleAttributes == null) { return(this.operator1); } return(new System.Drawing.Font("Times New Roman", (float)((this.textSize * level1Scale) * level0Scale), fontStyle)); } case 2: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level2Scale))); } if (styleAttributes == null) { return(this.operator2); } return(new System.Drawing.Font("Times New Roman", (float)((this.textSize * level2Scale) * level0Scale), fontStyle)); } } break; } case Category.NUMBER: { switch (level) { case 0: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", this.textSize)); } if (styleAttributes == null) { return(this.number0); } return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level0Scale), fontStyle)); } case 1: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level1Scale))); } if (styleAttributes == null) { return(this.number1); } return(new System.Drawing.Font("Times New Roman", (float)((this.textSize * level1Scale) * level0Scale), fontStyle)); } case 2: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level2Scale))); } if (styleAttributes == null) { return(this.number2); } return(new System.Drawing.Font("Times New Roman", (float)((this.textSize * level2Scale) * level0Scale), fontStyle)); } } break; } case Category.UNKNOWN: { switch (level) { case 0: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", this.textSize, System.Drawing.FontStyle.Italic)); } if (styleAttributes == null) { return(this.unknown0); } return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level0Scale), fontStyle)); } case 1: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level1Scale), System.Drawing.FontStyle.Italic)); } if (styleAttributes == null) { return(this.unknown1); } return(new System.Drawing.Font("Times New Roman", (float)((this.textSize * level1Scale) * level0Scale), fontStyle)); } case 2: { if (mode == 1) { return(new System.Drawing.Font("Times New Roman", (float)(this.textSize * level2Scale), System.Drawing.FontStyle.Italic)); } if (styleAttributes == null) { return(this.unknown2); } return(new System.Drawing.Font("Times New Roman", (float)((this.textSize * level2Scale) * level0Scale), fontStyle)); } } break; } case Category.SANSSERIF: { switch (level) { case 0: { if (mode == 1) { return(new System.Drawing.Font("Arial", this.textSize)); } if (styleAttributes == null) { return(this.operator0); } return(new System.Drawing.Font("Arial", (float)(this.textSize * level0Scale), fontStyle)); } case 1: { if (mode == 1) { return(new System.Drawing.Font("Arial", (float)(this.textSize * level1Scale))); } if (styleAttributes == null) { return(this.operator1); } return(new System.Drawing.Font("Arial", (float)((this.textSize * level1Scale) * level0Scale), fontStyle)); } case 2: { if (mode == 1) { return(new System.Drawing.Font("Arial", (float)(this.textSize * level2Scale))); } if (styleAttributes == null) { return(this.operator2); } return(new System.Drawing.Font("Arial", (float)((this.textSize * level2Scale) * level0Scale), fontStyle)); } } break; } case Category.FRACTUR: case Category.DOUBLESTRUCK: case Category.SCRIPT: { fontName = ""; switch (category) { case Category.FRACTUR: { fontName = "ESSTIXFifteen"; break; } case Category.DOUBLESTRUCK: { fontName = "ESSTIXFourteen"; break; } case Category.SCRIPT: { fontName = "ESSTIXThirteen"; break; } } float sc = 1f; switch (level) { case 0: { sc = (float)level0Scale; break; } case 1: { sc = (float)(level1Scale * level0Scale); break; } case 2: { sc = (float)(level2Scale * level0Scale); break; } } FontFamily family = null; if (this.fonts_ != null) { family = this.fonts_.Get(fontName); } if (family != null) { return(new System.Drawing.Font(family, this.textSize * sc, fontStyle)); } return(new System.Drawing.Font(fontName, this.textSize * sc, fontStyle)); } case Category.MONOSPACE: { switch (level) { case 0: { if (mode == 1) { return(new System.Drawing.Font("Courier New", this.textSize, System.Drawing.FontStyle.Italic)); } if (styleAttributes == null) { return(this.mono0); } return(new System.Drawing.Font("Courier New", (float)(this.textSize * level0Scale), fontStyle)); } case 1: { if (mode == 1) { return(new System.Drawing.Font("Courier New", (float)(this.textSize * level1Scale), System.Drawing.FontStyle.Italic)); } if (styleAttributes == null) { return(this.mono1); } return(new System.Drawing.Font("Courier New", (float)((this.textSize * level1Scale) * level0Scale), fontStyle)); } case 2: { if (mode == 1) { return(new System.Drawing.Font("Courier New", (float)(this.textSize * level2Scale), System.Drawing.FontStyle.Italic)); } if (styleAttributes == null) { return(this.mono2); } return(new System.Drawing.Font("Courier New", (float)((this.textSize * level2Scale) * level0Scale), fontStyle)); } } break; } case Category.GLYPH: { switch (level) { case 0: { if (mode != 1) { return(new System.Drawing.Font(node.fontFamily, (float)(this.textSize * level0Scale), fontStyle)); } break; } case 1: { if (mode != 1) { return(new System.Drawing.Font(node.fontFamily, (float)((this.textSize * level1Scale) * level0Scale), fontStyle)); } break; } case 2: { if (mode != 1) { return(new System.Drawing.Font(node.fontFamily, (float)((this.textSize * level2Scale) * level0Scale), fontStyle)); } break; } } break; } } return(new System.Drawing.Font("Symbol", this.textSize)); }