# Textengine

#### AssetFontStore support for Freetype streams

[AssetFontStore](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_font_store.html "implements a font store for the asset library this is the default font store Candera will use to retr...") is extended to support two font load strategies:

<div class="contents" id="bkmrk-assetfontstore%3A%3Aload"><div class="contents"><div class="textblock">- [AssetFontStore::LoadStrategySelector::PreloadStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_font_store_1_1_load_strategy_selector.html#a3c06cdd0709312d8b0ac60035c9a3b62aad010b9a2098e4e40ff1f0be8f31ba4b "Load the entire font data into memory if it is not already in a direct addressable asset repository...") (the old behavior before the extension): entire fonts are loaded into memory once and font data is accessed from there by Text Engine.
- [AssetFontStore::LoadStrategySelector::OnRequestLoadStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_font_store_1_1_load_strategy_selector.html#a3c06cdd0709312d8b0ac60035c9a3b62abddf5927381d24532b5a902fda7d33f3 "Do not load anything in memory, but read/copy data into smaller temporary buffers as requested by Fre...") (new behavior, selectable through a strategy selector): small font portions are streamed directly from the asset repository when Freetype (or indirectly Harfbuzz) needs them.

</div></div></div>Use [DefaultLoadStrategySelector::SetDefaultFontLoadStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_default_load_strategy_selector.html#a340dda8ac0dfb937a3d77d68817bfd48) to select one of these load strategies. Use [DefaultLoadStrategySelector::SetDefaultFontLoadStrategyExceptionList](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_default_load_strategy_selector.html#ac9e45f0d804d98677032b463b50b3513) to exclude a list of fonts from the selected font load strategy.

Example:

```
    // Load fonts with OnRequestLoadStrategy
    selector.SetDefaultFontLoadStrategy(<a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_font_store_1_1_load_strategy_selector.html#a3c06cdd0709312d8b0ac60035c9a3b62abddf5927381d24532b5a902fda7d33f3" title="Do not load anything in memory, but read/copy data into smaller temporary buffers as requested by Fre...">Candera::AssetFontStore::LoadStrategySelector::OnRequestLoadStrategy</a>);
    // "Bitstream Vera Sans" font shall be loaded with PreloadStrategy:
    const Char* g_fontName[2] = { "ConstructionKit##ConstructionKit#Resources#Fonts#Bitstream Vera Sans", 0 };
    selector.SetDefaultFontLoadStrategyExceptionList(g_fontName);
    fontStore.SetLoadStrategySelector(&selector);
```

[Courier](http://dev.doc.cgistudio.at/APILINK/namespace_courier.html) applications can use [Courier::ViewHandler::SetFontStoreProviderCallback](http://dev.doc.cgistudio.at/APILINK/class_courier_1_1_view_handler.html#a7747f74f80b57fd376b13f942d927009) to provide specific settings for the [Candera::AssetFontStore](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_font_store.html "implements a font store for the asset library this is the default font store Candera will use to retr...") in use.

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock">---

</div></div></div>#### Support of Monotype's WorldType-Shaper

[Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") supports the WorldType-Shaper of Monotype now. The integration is done to support the font engine 'iType'. With this release complex texts can be shaped. The behavior is similar to HarfBuzz with the difference of a huge performance boost. WT-Shaper may have a higher memory consumtion as a trade-off to performance. The implementation concept is aligned with HarfBuzz to support a flexible exchangeability.

With this the default shaper of iType switches from ComplexScript to WT-Shaper. The corresponding CMake flag CANDERA\_TEXTSHAPER has been extended by the entry WorldType-Shaper.

---