Beispiel #1
0
        protected void SetScale()
        {
            if (font == null)
            {
                return;
            }
            float heightScale = (float)Bounds.Height / (6 + LineHeight * Lines.Count);
            //Bounds.Width / Max line width
            float widthScale = Bounds.Width /
                               Lines.Concat(new List <IDrawableText> {
                new PlainText("")
            }).Max(line => line.Size(font).X);

            Scale = Utils.Lowest(heightScale, widthScale, DefaultScale); //smaller scale so it fits. clamp at DefaultScale
            ScrollChange?.Invoke();
        }