提取嵌入式许可信息

.NET API 解决方案,用于检测字体的许可信息。

 

Aspose.Font API Solution for .NET 具有丰富的字体处理功能。转换、字形操作、加载和保存字体等等。

字体被认为是软件,并且作为任何软件,要使用,就应该付费。是的,有一定范围的免费字体,但大多数都没有。因此,要使用字体而不侵犯版权,您需要购买许可证。

本页描述了提取有关嵌入到 TrueType 格式字体中的许可限制的信息。关于如何使用该解决方案的所有其余代码片段都放在 Aspose.Font-Documentation GitHub 项目。在那里你会发现更多的 C# 代码示例。要在线查看字体许可证以及许多其他随附信息,请尝试我们的 Font Metadata 跨平台应用程序。

要提取嵌入式许可证,我们需要:

  • Aspose.Font for .NET API 是一个功能丰富、功能强大且易于使用的 C# 平台文档操作和转换 API。

  • 打开 NuGet 包管理器,搜索 Aspose.Font 并安装。您也可以从包管理器控制台使用以下命令。

Package Manager Console Command


    PM> Install-Package Aspose.Font

使用 C# 检测字体是否包含许可信息的步骤:

  1. 指定需要检查的字体。
  2. 使用 LicenseFlags 类检测许可信息。

用于检测字体中的许可信息的 C# 代码

    using Aspose.Font.Ttf;
    //Font to check
    TtfFont font;
    LicenseFlags licenseFlags = null;
    if (font.TtfTables.Os2Table != null)
    {
        licenseFlags = font.TtfTables.Os2Table.GetLicenseFlags();
    }

    if (licenseFlags == null || licenseFlags.FSTypeAbsent)
    {
        Console.WriteLine(string.Format("Font {0} has no embedded license restrictions", font.FontName));
    }
    else
    {
        if (licenseFlags.IsEditableEmbedding)
        {
            Console.WriteLine(
                string.Format("Font {0} may be embedded, and may be temporarily loaded on other systems.", font.FontName)
                + " In addition, editing is permitted, including ability to format new text"
                + " using the embedded font, and changes may be saved.");
        }
        else if (licenseFlags.IsInstallableEmbedding)
        {
            Console.WriteLine(
                string.Format("Font {0} may be embedded, and may be permanently installed", font.FontName)
                + " for use on a remote systems, or for use by other users.");
        }
        else if (licenseFlags.IsPreviewAndPrintEmbedding)
        {
            Console.WriteLine(
                string.Format("Font {0} may be embedded, and may be temporarily loaded", font.FontName)
                + "  on other systems for purposes of viewing or printing the document.");
        }
        else if (licenseFlags.IsRestrictedLicenseEmbedding)
        {
            Console.WriteLine(
                string.Format("Font {0} must not be modified, embedded or exchanged in any manner", font.FontName)
                + " without first obtaining explicit permission of the legal owner.");
        }
    }



常问问题

1. 什么是字体许可证?

它是一份声明字体用途、使用限制、许可和版权的文件。

2. 您需要许可字体吗?

与任何其他软件一样,字体受版权保护,因此需要获得许可。不管怎样,一些授权字体可以免费用于商业需求。

3. 我可以将字体用于商业用途吗?

是的,字体可以用于商业用途,无论是付费还是免费。许可证也包含此类信息。

4. 如何查看字体授权?

要在线查看字体是否包含许可证信息,您可以使用 字体元数据 应用程序。您将在其中看到许可证说明、许可证信息 URL 和版权声明等信息。要以编程方式获取此类信息,您需要使用 LicenseFlag 类的属性。