/// <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); }
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); }