Ejemplo n.º 1
0
        public FontPart AddFontPart(FontPartType partType)
        {
            var contentType   = FontPartTypeInfo.GetContentType(partType);
            var partExtension = FontPartTypeInfo.GetTargetExtension(partType);

            OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension);
            return(AddFontPart(contentType));
        }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
        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");
            }
        }
Ejemplo n.º 4
0
 /// <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);
 }
Ejemplo n.º 5
0
 internal static string GetContentType(FontPartType fontType)
 => fontType switch
 {
Ejemplo n.º 6
0
        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";
            }
        }
Ejemplo n.º 7
0
        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");
            }
        }