Ejemplo n.º 1
0
        private void ProcessTextFormat(CanvasDrawingSession drawingSession, CanvasTextFormat format)
        {
            CanvasTextLayout textLayout = new CanvasTextLayout(drawingSession, "Q", format, 0.0f, 0.0f);

            if (CharacterWidth != textLayout.DrawBounds.Width || CharacterHeight != textLayout.DrawBounds.Height)
            {
                CharacterWidth  = textLayout.DrawBounds.Right;
                CharacterHeight = textLayout.DrawBounds.Bottom;
            }

            int columns = Convert.ToInt32(Math.Floor(canvas.RenderSize.Width / CharacterWidth));
            int rows    = Convert.ToInt32(Math.Floor(canvas.RenderSize.Height / CharacterHeight));

            if (Columns != columns || Rows != rows)
            {
                Columns = columns;
                Rows    = rows;
                ResizeTerminal();

                if (_stream != null && _stream.CanWrite)
                {
                    _stream.SendWindowChangeRequest((uint)columns, (uint)rows, 800, 600);
                }
            }
        }