public ComplexFontSelectorStrategy(String text, FontSelector selector, FontProvider provider, FontSet tempFonts ) : base(text, provider, tempFonts) { this.font = null; this.selector = selector; }
/// <summary> /// Create /// <see cref="FontSelector"/> /// or get from cache. /// </summary> /// <param name="fontFamilies">target font families</param> /// <param name="fc"> /// instance of /// <see cref="FontCharacteristics"/> /// . /// </param> /// <param name="tempFonts">set of temporary fonts.</param> /// <returns> /// an instance of /// <see cref="FontSelector"/> /// . /// </returns> /// <seealso cref="CreateFontSelector(System.Collections.Generic.ICollection{E}, System.Collections.Generic.IList{E}, FontCharacteristics) /// ">}</seealso> public FontSelector GetFontSelector(IList <String> fontFamilies, FontCharacteristics fc, FontSet tempFonts) { FontSelectorKey key = new FontSelectorKey(fontFamilies, fc); FontSelector fontSelector = fontSelectorCache.Get(key, tempFonts); if (fontSelector == null) { fontSelector = CreateFontSelector(fontSet.GetFonts(tempFonts), fontFamilies, fc); fontSelectorCache.Put(key, fontSelector, tempFonts); } return(fontSelector); }
internal virtual void Put(FontSelectorKey key, FontSelector fontSelector, FontSet fontSet) { if (fontSet == null) { Put(key, fontSelector); } else { FontSelectorCache.FontSetSelectors selectors = caches.Get(fontSet.GetId()); if (selectors == null) { caches.Put(fontSet.GetId(), selectors = new FontSelectorCache.FontSetSelectors()); } //update selectors and defaultSelectors to reset counter before pushing if needed. Update(selectors, fontSet); selectors.map.Put(key, fontSelector); } }
internal virtual void Put(FontSelectorKey key, FontSelector fontSelector) { //update defaultSelectors to reset counter before pushing if needed. Update(null, null); defaultSelectors.map.Put(key, fontSelector); }