예제 #1
0
 /// <summary>
 /// Adds embedded font files
 /// </summary>
 /// <param name="stream"></param>
 private void AddFontFiles(ZipOutputStream stream)
 {
     if (_fontSettings.NumberOfEmbededFiles > 0)
     {
         stream.SetLevel(9);
         foreach (var embededFileLocation in _fontSettings.EmbededFilesLocations)
         {
             var fontFileName = new FontOnStorage(embededFileLocation, ConvertFontToMediaType(_fontSettings.GetFontFormat(embededFileLocation)));
             CreateFileEntryInZip(stream,fontFileName);
             try
             {
                 EmbeddedFontsCache.Instance.WriteFontToStream(embededFileLocation,stream);
             }
             catch (Exception ex)
             {
                 Logger.Log.ErrorFormat("Error loading font file {0} : {1}", embededFileLocation, ex);
                 continue;
             }
             _content.AddFontFile(fontFileName);
         }
     }
 }
예제 #2
0
 public void AddFontFile(FontOnStorage fontFile)
 {
     _manifest.Add(new ManifestItemV3 { HRef = fontFile.PathInEPUB.GetRelativePath(DefaultInternalPaths.ContentFilePath, _flatStructure), ID = fontFile.ID, MediaType = fontFile.MediaType });
 }