Esempio n. 1
0
 /// <summary>Applies the highlighted ranges from another text glyph onto this glyph.</summary>
 public void ApplyHighlights(TextGlyph otherGlyph) {
    if (otherGlyph == null || otherGlyph._highlights == null) {
       _highlights = null;
    } else {
       _highlights = new List<HighlightRange>(otherGlyph._highlights);
    }
 }
Esempio n. 2
0
 /// <summary>Creates a new <see cref="TextGlyph"/> instance based on another glyph.</summary>
 public TextGlyph(string text, TextGlyph baseGlyph) 
    : this(text, baseGlyph.Font, baseGlyph.TextOverflow, baseGlyph.TextOverflowDirection, baseGlyph.SharpnessVector) {
 }
Esempio n. 3
0
      /// <summary/>
      protected override Size MeasureOverride(Size constraint) {
         var desiredSize = new Size();

         _labelGlyphs = null;
         if (ShowLabels && LabelTexts != null && LabelTexts.Length > 0) {
            var labelFont = new Font(new Typeface(LabelFontFamily, FontStyles.Normal, LabelFontWeight, FontStretches.Normal), LabelFontSize);
            labelFont.Freeze();
            var G = _labelGlyphs = new TextGlyph[LabelTexts.Length];
            for (var i = 0; i < LabelTexts.Length; i++) {
               G[i] = new TextGlyph(LabelTexts[i], labelFont);
               desiredSize.Width = Math.Max(desiredSize.Width, G[i].Width);
               desiredSize.Height = Math.Max(desiredSize.Height, G[i].Height);
            }
            if (_isHorizontal) {
               desiredSize.Height += LabelPadding;
            } else {
               desiredSize.Width += LabelPadding;
            }
         }

         return desiredSize;
      }