Exemplo n.º 1
0
 public CTFontDescriptor(CTFontDescriptorAttributes attributes)
 {
     if (attributes == null)
     {
         throw ConstructorError.ArgumentNull(this, "attributes");
     }
     handle = CTFontDescriptorCreateWithAttributes(attributes.Dictionary.Handle);
     if (handle == IntPtr.Zero)
     {
         throw ConstructorError.Unknown(this);
     }
 }
Exemplo n.º 2
0
 internal CTFontDescriptor(IntPtr handle, bool owns)
 {
     if (handle == IntPtr.Zero)
     {
         throw ConstructorError.ArgumentNull(this, "handle");
     }
     this.handle = handle;
     if (!owns)
     {
         CFObject.CFRetain(handle);
     }
 }
Exemplo n.º 3
0
        public CTRunDelegate(CTRunDelegateOperations operations)
        {
            if (operations == null)
            {
                throw ConstructorError.ArgumentNull(this, "operations");
            }

            handle = CTRunDelegateCreate(operations.GetCallbacks(), GCHandle.ToIntPtr(operations.handle));
            if (handle == IntPtr.Zero)
            {
                throw ConstructorError.Unknown(this);
            }
        }
Exemplo n.º 4
0
 public CTFontCollection(CTFontDescriptor[] queryDescriptors, CTFontCollectionOptions options)
 {
     using (var descriptors = queryDescriptors == null
                                 ? null
                                 : CFArray.FromNativeObjects(queryDescriptors))
         handle = CTFontCollectionCreateWithFontDescriptors(
             descriptors == null ? IntPtr.Zero : descriptors.Handle,
             options == null ? IntPtr.Zero : options.Dictionary.Handle);
     if (handle == IntPtr.Zero)
     {
         throw ConstructorError.Unknown(this);
     }
 }
Exemplo n.º 5
0
 public CTFontDescriptor(string name, nfloat size)
 {
     if (name == null)
     {
         throw ConstructorError.ArgumentNull(this, "name");
     }
     using (CFString n = name)
         handle = CTFontDescriptorCreateWithNameAndSize(n.Handle, size);
     if (handle == IntPtr.Zero)
     {
         throw ConstructorError.Unknown(this);
     }
 }
Exemplo n.º 6
0
        public CTLine(NSAttributedString value)
        {
            if (value == null)
            {
                throw ConstructorError.ArgumentNull(this, "value");
            }

            handle = CTLineCreateWithAttributedString(value.Handle);

            if (handle == IntPtr.Zero)
            {
                throw ConstructorError.Unknown(this);
            }
        }
Exemplo n.º 7
0
        public CTTypesetter(NSAttributedString value, CTTypesetterOptions options)
        {
            if (value == null)
            {
                throw ConstructorError.ArgumentNull(this, "value");
            }

            handle = CTTypesetterCreateWithAttributedStringAndOptions(value.Handle,
                                                                      options == null ? IntPtr.Zero : options.Dictionary.Handle);

            if (handle == IntPtr.Zero)
            {
                throw ConstructorError.Unknown(this);
            }
        }
Exemplo n.º 8
0
        public CTGlyphInfo(CGFontIndex cid, CTCharacterCollection collection, string baseString)
        {
            if (baseString == null)
            {
                throw ConstructorError.ArgumentNull(this, "baseString");
            }

            using (var bs = new NSString(baseString))
                handle = CTGlyphInfoCreateWithCharacterIdentifier(cid, collection, bs.Handle);

            if (handle == IntPtr.Zero)
            {
                throw ConstructorError.Unknown(this);
            }
        }
Exemplo n.º 9
0
        public CTGlyphInfo(CGGlyph glyph, CTFont font, string baseString)
        {
            if (font == null)
            {
                throw ConstructorError.ArgumentNull(this, "font");
            }
            if (baseString == null)
            {
                throw ConstructorError.ArgumentNull(this, "baseString");
            }

            using (var bs = new NSString(baseString))
                handle = CTGlyphInfoCreateWithGlyph(glyph, font.Handle, bs.Handle);

            if (handle == IntPtr.Zero)
            {
                throw ConstructorError.Unknown(this);
            }
        }