Beispiel #1
0
 /// <summary>
 /// Prepopulates the specified face's atlases with the specified list of glyphs.
 /// </summary>
 private static void PrepopulateGlyphs(FreeTypeFontFace face, IList <PrepopulatedGlyphRange> ranges)
 {
     foreach (var range in ranges)
     {
         for (var g = range.Start; g <= range.End; g++)
         {
             face.PopulateGlyph(g);
         }
     }
 }
Beispiel #2
0
        protected override void OnDraw(Context ctx, double w, double h)
        {
            if (_font == null)
            {
                _font = FreeTypeFontFace.Create("junction-bold.otf", 0, 0);
            }

            base.OnDraw(ctx, w, h);

            // use our font at size 50 and draw white
            ctx.SetContextFontFace(_font);
            ctx.SetFontSize(50);
            ctx.SetSourceRGBA(1, 1, 1, 1);

            // draw the text centered in the view
            var tsz = ctx.TextExtents(HelloString);

            ctx.MoveTo(Math.Floor((w - tsz.Width) / 2),
                       Math.Floor((h - tsz.Height) / 2));
            ctx.ShowText(HelloString);
        }
Beispiel #3
0
 public MyView(LayoutSpec spec) : base(spec)
 {
     _font = FreeTypeFontFace.Create("FordAntennaWGL-Regular.otf");
 }