load resources dictionary from pages as well as page node and throw informative error when the font is not found.

This commit is contained in:
Eliot Jones
2018-01-01 10:49:05 +00:00
parent b77b7ec0d8
commit 874f713566
8 changed files with 71 additions and 9 deletions

View File

@@ -79,10 +79,15 @@
public void ShowText(IInputBytes bytes)
{
var font = resourceStore.GetFont(GetCurrentState().FontState.FontName);
var currentState = GetCurrentState();
var font = resourceStore.GetFont(currentState.FontState.FontName);
if (font == null)
{
throw new InvalidOperationException($"Could not find the font with name {currentState.FontState.FontName} in the resource store. It has not been loaded yet.");
}
var fontSize = currentState.FontState.FontSize;
var horizontalScaling = currentState.FontState.HorizontalScaling;
var characterSpacing = currentState.FontState.CharacterSpacing;