Exemplo n.º 1
0
		public static NSString ToNSString (CTBaselineClass key)
		{
			switch (key) {
				case CTBaselineClass.Roman:                return Roman;
				case CTBaselineClass.IdeographicCentered:  return IdeographicCentered;
				case CTBaselineClass.IdeographicLow:       return IdeographicLow;
				case CTBaselineClass.IdeographicHigh:      return IdeographicHigh;
				case CTBaselineClass.Hanging:              return Hanging;
				case CTBaselineClass.Math:                 return Math;
			}

			throw new ArgumentOutOfRangeException ("key");
		}
        void SetBaseline(CTBaselineClass baselineClass, double offset, NSString infoKey)
        {
            var ptr  = CFDictionary.GetValue(Dictionary.Handle, infoKey.Handle);
            var dict = ptr == IntPtr.Zero ? new NSMutableDictionary() : new NSMutableDictionary(ptr);

            var key = CTBaselineClassID.ToNSString(baselineClass);

            Adapter.SetValue(dict, key, new NSNumber(offset));

            if (ptr == IntPtr.Zero)
            {
                Adapter.SetNativeValue(Dictionary, infoKey, (INativeObject)dict);
            }
        }
Exemplo n.º 3
0
        public static NSString ToNSString(CTBaselineClass key)
        {
            switch (key)
            {
            case CTBaselineClass.Roman:                return(Roman);

            case CTBaselineClass.IdeographicCentered:  return(IdeographicCentered);

            case CTBaselineClass.IdeographicLow:       return(IdeographicLow);

            case CTBaselineClass.IdeographicHigh:      return(IdeographicHigh);

            case CTBaselineClass.Hanging:              return(Hanging);

            case CTBaselineClass.Math:                 return(Math);
            }

            throw new ArgumentOutOfRangeException("key");
        }
 public void SetBaselineReferenceInfo(CTBaselineClass baselineClass, double offset)
 {
     SetBaseline(baselineClass, offset, CTStringAttributeKey.BaselineReferenceInfo);
 }
		void SetBaseline (CTBaselineClass baselineClass, double offset, NSString infoKey)
		{
			var ptr = CFDictionary.GetValue (Dictionary.Handle, infoKey.Handle);
			var dict = ptr == IntPtr.Zero ? new NSMutableDictionary () : new NSMutableDictionary (ptr);

			var key = CTBaselineClassID.ToNSString (baselineClass);
			Adapter.SetValue (dict, key, new NSNumber (offset));

			if (ptr == IntPtr.Zero)
				Adapter.SetNativeValue (Dictionary, infoKey, (INativeObject)dict);
		}
		public void SetBaselineReferenceInfo (CTBaselineClass baselineClass, double offset)
		{
			SetBaseline (baselineClass, offset, CTStringAttributeKey.BaselineReferenceInfo);
		}