Пример #1
0
 public void MeasureAtBottomLeft(Point bottomLeft, float PixelsPerDip)
 {
     GlyphInfo   = GlyphUtils.GetGlyphsAndInfo(Text, PixelsPerDip, out GlyphRun groupGlyphRun, bottomLeft, _glyphTypeface, TypeSize);
     TextRun     = groupGlyphRun;
     TextMetrics = new AtomTextMetrics
     {
         BoundingBox      = groupGlyphRun.GetBoundingBox(bottomLeft),
         Geocenter        = bottomLeft,
         TotalBoundingBox = groupGlyphRun.GetBoundingBox(bottomLeft),
         FlattenedPath    = GlyphUtils.GetOutline(TextRun),
         OffsetVector     = new Vector(0.0d, 0.0d)
     };
 }
Пример #2
0
        public void MeasureAtCenter(Point center)
        {
            GlyphInfo = GlyphUtils.GetGlyphsAndInfo(Text, PixelsPerDip, out GlyphRun groupGlyphRun, center, _glyphTypeface, TypeSize);
            //compensate the main offset vector for any descenders

            Vector mainOffset = GlyphUtils.GetOffsetVector(groupGlyphRun, TypeSize) +
                                new Vector(0.0, -MaxBaselineOffset);
            var    bb = groupGlyphRun.GetBoundingBox(center + mainOffset);
            Vector textFormatterOffset = new Vector(mainOffset.X, -FirstBearing(groupGlyphRun) - bb.Height / 2);

            TextRun     = groupGlyphRun;
            TextMetrics = new AtomTextMetrics
            {
                BoundingBox         = bb,
                Geocenter           = center,
                TotalBoundingBox    = groupGlyphRun.GetBoundingBox(center + mainOffset),
                OffsetVector        = mainOffset,
                TextFormatterOffset = textFormatterOffset
            };
        }
Пример #3
0
 public void DrawAtBottomLeft(Point bottomLeft, DrawingContext dc)
 {
     GlyphInfo = GlyphUtils.GetGlyphsAndInfo(Text, PixelsPerDip, out GlyphRun groupGlyphRun, bottomLeft, _glyphTypeface, TypeSize);
     dc.DrawGlyphRun(Fill, groupGlyphRun);
     TextRun = groupGlyphRun;
 }