コード例 #1
0
ファイル: SKFontTest.cs プロジェクト: tonymkenu/SkiaSharp
        public void GetTextPathSucceedsForEmtptyString()
        {
            var font = new SKFont();

            var path = font.GetTextPath("");

            Assert.NotNull(path);
            Assert.Equal(0, path.PointCount);
        }
コード例 #2
0
ファイル: SKFontTest.cs プロジェクト: tonymkenu/SkiaSharp
        public unsafe void TextInterceptsAreFoundCorrectly()
        {
            var text = "|";

            var font = new SKFont();

            font.Size = 100;

            var blob = SKTextBlob.Create(text, font, new SKPoint(50, 100));

            var widths = blob.GetIntercepts(0, 100);

            Assert.Equal(2, widths.Length);

            var diff = widths[1] - widths[0];

            var textPath  = font.GetTextPath(text, SKPoint.Empty);
            var pathWidth = textPath.TightBounds.Width;

            Assert.Equal(pathWidth, diff, 2);
        }