Example #1
0
   public static MathListIndex IndexForPoint <TFont, TGlyph>(
       this IGlyphDisplay <TFont, TGlyph> self,
       TypesettingContext <TFont, TGlyph> _,
       PointF point) where TFont : IFont <TGlyph> =>
   point.X > self.Position.X + self.Width / 2
 ? MathListIndex.Level0Index(self.Range.End)
   : MathListIndex.Level0Index(self.Range.Location);
Example #2
0
 public RadicalDisplay(ListDisplay <TFont, TGlyph> innerDisplay, IGlyphDisplay <TFont, TGlyph> glyph, PointF position, Range range)
 {
     Radicand      = innerDisplay;
     _radicalGlyph = glyph;
     Position      = position;
     Range         = range;
 }
Example #3
0
 public InnerDisplay(ListDisplay <TFont, TGlyph> inner, IGlyphDisplay <TFont, TGlyph>?left, IGlyphDisplay <TFont, TGlyph>?right, Range range)
 {
     Inner = inner;
     Left  = left;
     Right = right;
     Range = range;
 }
Example #4
0
 public static void HighlightCharacterAt <TFont, TGlyph>(
     this IGlyphDisplay <TFont, TGlyph> self,
     MathListIndex index, Color color) where TFont : IFont <TGlyph>
 {
     if (index.SubIndexType != MathListSubIndexType.None)
     {
         throw new ArgumentException
                   ("The subindex must be none to get the highlight a character in it.", nameof(index));
     }
     self.Highlight(color);
 }
Example #5
0
   public static PointF?PointForIndex <TFont, TGlyph>(
       this IGlyphDisplay <TFont, TGlyph> self,
       TypesettingContext <TFont, TGlyph> _,
       MathListIndex index) where TFont : IFont <TGlyph> =>
   index.SubIndexType != MathListSubIndexType.None
 ? throw new ArgumentException
             ("The subindex must be none to get the closest point for it.", nameof(index))
         : index.AtomIndex == self.Range.End
         // draw a caret after the glyph
 ? self.Position.Plus(new PointF(self.DisplayBounds().Right, 0))
         // draw a caret before the glyph
         : self.Position;
Example #6
0
 public static void Highlight <TFont, TGlyph>(
     this IGlyphDisplay <TFont, TGlyph> self, Color color) where TFont : IFont <TGlyph>
 {
     self.TextColor = color;
 }