Ejemplo n.º 1
0
        public async Task DrawText(string text, int startX, int startY)
        {
            await plotter.PenUp();

            plotter.GoToXY(startX, startY);
            var x = startX;
            var y = startY;

            foreach (var ch in text.ToCharArray())
            {
                var character = this.font.SupportedCharacters.FirstOrDefault(c => c.Character == ch);
                if (character != null)
                {
                    plotter.GoToXY(x, y);
                    foreach (var instruction in character.Instructions)
                    {
                        if (instruction.IsLine)
                        {
                            await plotter.PenDown();
                        }
                        else
                        {
                            await plotter.PenUp();
                        }
                        plotter.GoToDiagonal(plotter.X + instruction.RelX * sizeX / 100, plotter.Y + instruction.RelY * sizeY / 100);
                    }
                    await plotter.PenUp();
                }
                x += sizeX + spaceX;
            }
            plotter.Stop();
        }