Browse Source

Documentation: Font Manager

Marcin Ziąbek 2 years ago
parent
commit
16ec2e912c
2 changed files with 19 additions and 12 deletions
  1. 19 0
      Source/QuestPDF/Drawing/FontManager.cs
  2. 0 12
      Source/QuestPDF/Resources/Documentation.xml

+ 19 - 0
Source/QuestPDF/Drawing/FontManager.cs

@@ -12,6 +12,11 @@ using SkiaSharp.HarfBuzz;
 
 namespace QuestPDF.Drawing
 {
+    /// <summary>
+    /// <para>By default, the library searches all fonts available in the runtime environment.</para>
+    /// <para>This may work well on the development environment but may fail in the cloud where fonts are usually not installed.</para>
+    /// <para>It is safest deploy font files along with the application and then register them using this class.</para>
+    /// </summary>
     public static class FontManager
     {
         private static readonly ConcurrentDictionary<string, FontStyleSet> StyleSets = new();
@@ -49,6 +54,11 @@ namespace QuestPDF.Drawing
             RegisterFontWithCustomName(fontName, stream);
         }
         
+        /// <summary>
+        /// Registers a TrueType font from a stream under the provided custom <paramref name="fontName"/>.
+        /// Refer to this font by using the same name as a font family in the <see cref="TextStyle"/> API later on.
+        /// <a href="https://www.questpdf.com/going-production/font-management.html">Learn more</a>
+        /// </summary>
         public static void RegisterFontWithCustomName(string fontName, Stream stream)
         {
             using var fontData = SKData.Create(stream);
@@ -56,12 +66,21 @@ namespace QuestPDF.Drawing
             RegisterFontType(fontData, customName: fontName);
         }
 
+        /// <summary>
+        /// Registers a TrueType font from a stream. The font family name and all related attributes are detected automatically.
+        /// <a href="https://www.questpdf.com/going-production/font-management.html">Learn more</a>
+        /// </summary>
         public static void RegisterFont(Stream stream)
         {
             using var fontData = SKData.Create(stream);
             RegisterFontType(fontData);
         }
         
+        /// <summary>
+        /// Registers a TrueType font from an embedded resource. The font family name and all related attributes are detected automatically.
+        /// <a href="https://www.questpdf.com/going-production/font-management.html">Learn more</a>
+        /// </summary>
+        /// <param name="pathName">Path to the embedded resource (the case-sensitive name of the manifest resource being requested).</param>
         public static void RegisterFontFromEmbeddedResource(string pathName)
         {
             using var stream = Assembly.GetCallingAssembly().GetManifestResourceStream(pathName);

+ 0 - 12
Source/QuestPDF/Resources/Documentation.xml

@@ -140,18 +140,6 @@
     </doc>
     
     <doc for="text.fontFamily">
-        <summary>
-            Sets the text's font family.
-        </summary>
-
-        <remarks>
-            By default, the library searches for the target font through all available in the runtime environment.
-            This usually works in the development environment, but might not in the cloud where many fonts are not installed.
-            It is a safe practice to include all font files with your application and register them using the <see cref="Drawing.FontManager">FontManager</see> class.
-        </remarks>
-
-        <param name="value">The font family name (like "Times New Roman" or "Calibri") or a custom name from the <see cref="Drawing.FontManager.RegisterFontWithCustomName">FontManager</see> method.</param>
-        
         <summary>
             <para>Sets the font family of the text.</para>
         </summary>