Examples of PrivateFontCollection


Examples of cli.System.Drawing.Text.PrivateFontCollection

            baos.write( buffer, 0, count );
        }
        byte[] fontData = baos.toByteArray();

        // create a private Font Collection and add the font data
        PrivateFontCollection pfc;
        try {
            pfc = createPrivateFontCollection(fontData);
        } catch( cli.System.IO.FileNotFoundException x ) {
            FontFormatException ffe = new FontFormatException(x.getMessage());
            ffe.initCause(x);
            throw ffe;
        }

        // create the font object
        Font2D font2D = FontManager.createFont2D( pfc.get_Families()[0], 0 );
        Font font = new Font( font2D.getFontName( Locale.getDefault() ), PLAIN, 1 );
        font.font2D = font2D;
        return font;
    }
View Full Code Here

Examples of cli.System.Drawing.Text.PrivateFontCollection

    // create a private Font Collection and add the font data
    @cli.System.Security.SecuritySafeCriticalAttribute.Annotation
    private static PrivateFontCollection createPrivateFontCollection(byte[] fontData) throws cli.System.IO.FileNotFoundException {
        GCHandle handle = GCHandle.Alloc(fontData, GCHandleType.wrap(GCHandleType.Pinned));
        try {
            PrivateFontCollection pfc = new PrivateFontCollection();
            // AddMemoryFont throws a cli.System.IO.FileNotFoundException if the data are corrupt
            pfc.AddMemoryFont( handle.AddrOfPinnedObject(), fontData.length );
            return pfc;
        } finally {
            handle.Free();
        }
    }
View Full Code Here

Examples of cli.System.Drawing.Text.PrivateFontCollection

    public static Font createFont( int fontFormat, File fontFile ) throws java.awt.FontFormatException, java.io.IOException {
        if( fontFormat != Font.TRUETYPE_FONT && fontFormat != Font.TYPE1_FONT ) {
            throw new IllegalArgumentException( "font format not recognized" );
        }
        // create a private Font Collection and add the font data
        PrivateFontCollection pfc = new PrivateFontCollection();
        try {
            pfc.AddFontFile( fontFile.getPath() );
            if(false){
                throw new cli.System.IO.FileNotFoundException();
            }
        } catch( cli.System.IO.FileNotFoundException fnfe ) {
            FileNotFoundException ex = new FileNotFoundException(fnfe.getMessage());
            ex.initCause( fnfe );
            throw ex;
        }
        // create the font object
        Font2D font2D = FontManager.createFont2D( pfc.get_Families()[0], 0 );
        Font font = new Font( font2D.getFontName( Locale.getDefault() ), PLAIN, 1 );
        font.font2D = font2D;
        return font;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.