public FontPart AddFontPart(FontPartType partType) { var contentType = FontPartTypeInfo.GetContentType(partType); var partExtension = FontPartTypeInfo.GetTargetExtension(partType); OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension); return(AddFontPart(contentType)); }
internal static string GetContentType(FontPartType fontType) { switch (fontType) { case FontPartType.FontData: return("application/x-fontdata"); case FontPartType.FontTtf: return("application/x-font-ttf"); case FontPartType.FontOdttf: return("application/vnd.openxmlformats-officedocument.obfuscatedFont"); default: throw new ArgumentOutOfRangeException(nameof(fontType)); } }
internal static string GetTargetExtension(FontPartType fontType) { switch (fontType) { case FontPartType.FontData: return(".fntdata"); case FontPartType.FontTtf: return(".ttf"); case FontPartType.FontOdttf: return(".odttf"); default: return(".font"); } }
/// <summary> /// Adds a FontPart to the FontTablePart. /// </summary> /// <param name="partType">The part type of the FontPart.</param> /// <param name="id">The relationship id.</param> /// <returns>The newly added part.</returns> public FontPart AddFontPart(FontPartType partType, string id) { string contentType = FontPartTypeInfo.GetContentType(partType); string partExtension = FontPartTypeInfo.GetTargetExtension(partType); OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension); return AddFontPart(contentType, id); }
internal static string GetContentType(FontPartType fontType) => fontType switch {
internal static string GetTargetExtension(FontPartType fontType) { switch (fontType) { case FontPartType.FontData: return ".fntdata"; case FontPartType.FontTtf: return ".ttf"; case FontPartType.FontOdttf: return ".odttf"; default: return ".font"; } }
internal static string GetContentType(FontPartType fontType) { switch (fontType) { case FontPartType.FontData: return "application/x-fontdata"; case FontPartType.FontTtf: return "application/x-font-ttf"; case FontPartType.FontOdttf: return "application/vnd.openxmlformats-officedocument.obfuscatedFont"; default: throw new ArgumentOutOfRangeException("fontType"); } }