Java Code Examples for org.apache.fontbox.ttf.OS2WindowsMetricsTable#FSTYPE_RESTRICTED

The following examples show how to use org.apache.fontbox.ttf.OS2WindowsMetricsTable#FSTYPE_RESTRICTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TrueTypeEmbedder.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * Returns true if the fsType in the OS/2 table permits embedding.
 */
private boolean isEmbeddingPermitted(TrueTypeFont ttf) throws IOException
{
    if (ttf.getOS2Windows() != null)
    {
        int fsType = ttf.getOS2Windows().getFsType();
        int exclusive = fsType & 0x8; // bits 0-3 are a set of exclusive bits

        if ((exclusive & OS2WindowsMetricsTable.FSTYPE_RESTRICTED) ==
                         OS2WindowsMetricsTable.FSTYPE_RESTRICTED)
        {
            // restricted License embedding
            return false;
        }
        else if ((exclusive & OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY) ==
                             OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY)
        {
            // bitmap embedding only
            return false;
        }
    }
    return true;
}
 
Example 2
Source File: FontUtils.java    From sambox with Apache License 2.0 6 votes vote down vote up
/**
 * @return true if the fsType in the OS/2 table permits embedding.
 */
public static boolean isEmbeddingPermitted(TrueTypeFont ttf) throws IOException
{
    if (ttf.getOS2Windows() != null)
    {
        int fsType = ttf.getOS2Windows().getFsType();
        int exclusive = fsType & 0x8; // bits 0-3 are a set of exclusive bits

        if ((exclusive
                & OS2WindowsMetricsTable.FSTYPE_RESTRICTED) == OS2WindowsMetricsTable.FSTYPE_RESTRICTED)
        {
            // restricted License embedding
            return false;
        }
        else if ((exclusive
                & OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY) == OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY)
        {
            // bitmap embedding only
            return false;
        }
    }
    return true;
}