PurplePen.MapRenderer.WrappedTextFits C# (CSharp) Method

WrappedTextFits() public method

public WrappedTextFits ( object font, string text, RectangleF rect, StringAlignment horizAlignment ) : bool
font object
text string
rect System.Drawing.RectangleF
horizAlignment StringAlignment
return bool
        public bool WrappedTextFits(object font, string text, RectangleF rect, StringAlignment horizAlignment)
        {
            TextSymDef symdef = (TextSymDef) font;

            PointF baseLocation;
            float x = rect.Left;
            float y = rect.Top;
            baseLocation = Geometry.TransformPoint(new PointF(x, y), currentTransform);

            // Need to create the symbol to get it's height.
            TextSymbol symbol = new TextSymbol(symdef, new string[1] { text }, baseLocation, 0, Geometry.TransformDistance(rect.Width, currentTransform), TextSymDefHorizAlignment.Default, TextSymDefVertAlignment.Default);
            return symbol.TextSize.Height <= Geometry.TransformDistance(rect.Height, currentTransform);
        }