Exemplo n.º 1
0
		//, SizeF size)
		public static SizeF MeasureString (string inString, Font font)
		{
			
						/*NSTextStorage textStorage = new NSTextStorage();
			textStorage.
			NSTextContainer textContainer = new NSTextContainer(size);
			NSLayoutManager layoutManager = new NSLayoutManager();
			*/
var tv = new NSText { Font = font.ToNsFont (), Value = inString };
			tv.SizeToFit ();
			return tv.Frame.Size;
		}
Exemplo n.º 2
0
        //, SizeF size)
        public static SizeF MeasureString(string inString, Font font)
        {
            /*NSTextStorage textStorage = new NSTextStorage();
             *          textStorage.
             *          NSTextContainer textContainer = new NSTextContainer(size);
             *          NSLayoutManager layoutManager = new NSLayoutManager();
             */
            var tv = new NSText {
                Font = font.ToNsFont(), Value = inString
            };

            tv.SizeToFit();
            return(tv.Frame.Size);
        }
Exemplo n.º 3
0
        //, SizeF size)
        public static SizeF MeasureString(string inString, Font font)
        {
            /*
             * NSTextStorage textStorage = new NSTextStorage();
             * textStorage.
             * NSTextContainer textContainer = new NSTextContainer(size);
             * NSLayoutManager layoutManager = new NSLayoutManager();
             */
            var tv = new NSText {
                Font = font.ToNsFont(), Value = inString
            };

            tv.SizeToFit();
            float w = (float)tv.Frame.Size.Width;
            float h = (float)tv.Frame.Size.Height;

            return(new SizeF(w, h));
        }
Exemplo n.º 4
0
        internal virtual Size InternalGetPreferredSize(Size proposed)
        {
            Size size;

            if (Text == string.Empty)
            {
                size = new Size(0, Font.Height);
            }
            else
            {
                var txt = new NSText();
                txt.Value = Text;
                txt.Font  = Font.ToNsFont();
                txt.SizeToFit();
                size = Size.Round(txt.Frame.Size);
            }

#if NET_2_0
            size.Width  += Padding.Horizontal;
            size.Height += Padding.Vertical;

            if (!use_compatible_text_rendering)
            {
                return(size);
            }
#else
            size.Height = Font.Height;
#endif

            if (border_style == BorderStyle.None)
            {
                size.Height += 3;
            }
            else
            {
                size.Height += 6;
            }

            return(size);
        }
Exemplo n.º 5
0
		internal virtual Size InternalGetPreferredSize (Size proposed)
		{
			Size size;

			if (Text == string.Empty) {
				size = new Size (0, Font.Height);
			} else {
				var txt = new NSText();
				txt.Value = Text;
				txt.Font = Font.ToNsFont();
				txt.SizeToFit();
				size = Util.NSSizeToSize(txt.Frame.Size);
			}

#if NET_2_0
			size.Width += Padding.Horizontal;
			size.Height += Padding.Vertical;
			
			if (!use_compatible_text_rendering)
				return size;
#else
				size.Height = Font.Height;
#endif

			if (border_style == BorderStyle.None)
				size.Height += 3;
			else
				size.Height += 6;
			
			return size;
		}
Exemplo n.º 6
0
		//, SizeF size)
		public static SizeF MeasureString (string inString, Font font)
		{
			/*
			NSTextStorage textStorage = new NSTextStorage();
			textStorage.
			NSTextContainer textContainer = new NSTextContainer(size);
			NSLayoutManager layoutManager = new NSLayoutManager();
			*/
			var tv = new NSText { Font = font.ToNsFont (), Value = inString };
			tv.SizeToFit ();
			float w = (float)tv.Frame.Size.Width;
			float h = (float)tv.Frame.Size.Height;
			return new SizeF (w, h);
		}