Browse Source

Added information about available font families

MarcinZiabek 3 years ago
parent
commit
cc51b62b73
1 changed files with 4 additions and 1 deletions
  1. 4 1
      QuestPDF/Drawing/FontManager.cs

+ 4 - 1
QuestPDF/Drawing/FontManager.cs

@@ -142,12 +142,15 @@ namespace QuestPDF.Drawing
                 
                 if (fontFromDefaultSource != null)
                     return fontFromDefaultSource;
+
+                var availableFontNames = string.Join(", ", SKFontManager.Default.GetFontFamilies());
                 
                 throw new ArgumentException(
                     $"The typeface '{style.FontFamily}' could not be found. " +
                     $"Please consider the following options: " +
                     $"1) install the font on your operating system or execution environment. " +
-                    $"2) load a font file specifically for QuestPDF usage via the QuestPDF.Drawing.FontManager.RegisterFontType(Stream fileContentStream) static method.");
+                    $"2) load a font file specifically for QuestPDF usage via the QuestPDF.Drawing.FontManager.RegisterFontType(Stream fileContentStream) static method. " +
+                    $"Available font family names: [{availableFontNames}]");
             }
             
             static float GetTextScale(TextStyle style)