Base class for all font descriptors.
예제 #1
0
        /// <summary>
        /// Gets the FontDescriptor identified by the specified FontSelector. Returns null if no
        /// such objects exists.
        /// </summary>
        public FontDescriptor FindDescriptor(FontSelector selector)
        {
            if (selector == null)
            {
                return(null);
            }

            FontDescriptor descriptor = this.table[selector] as FontDescriptor;

            return(descriptor);
        }
예제 #2
0
        public FontDescriptor CreateDescriptor(string idName, byte[] fontData)
        {
            FontSelector   selector   = new FontSelector(idName);
            FontDescriptor descriptor = this.table[selector] as FontDescriptor;

            if (descriptor == null)
            {
                lock (typeof(FontDescriptorStock))
                {
                    // may be created by other thread meanwhile
                    descriptor = this.table[selector] as FontDescriptor;
                    if (descriptor == null)
                    {
                        descriptor = new TrueTypeDescriptor(idName, fontData);
                        this.table.Add(selector, descriptor);
                    }
                }
            }
            return(descriptor);
        }