// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:41:56
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   com/macromedia/generator/api/Font

package com.macromedia.generator.api;

import com.macromedia.generator.api.peer.FontPeer;
import com.macromedia.generator.platform.Mac;

// Referenced classes of package com.macromedia.generator.api:
//            GenObject, GeneratorApiException

public class Font extends GenObject
{

    public Font()
        throws GeneratorApiException
    {
        peer = FontPeer.New();
        if(peer == 0)
            throw new GeneratorApiException("unable to create peer");
        else
            return;
    }

    protected Font(int i)
        throws GeneratorApiException
    {
        peer = i;
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        else
            return;
    }

    protected void finalize()
        throws Throwable
    {
        if(peer != 0)
            FontPeer.Release(peer);
        peer = 0;
    }

    public void release()
    {
        if(peer != 0)
            FontPeer.Release(peer);
        peer = 0;
    }

    public void setFftFile(String s)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        if(s == null)
            throw new GeneratorApiException("null string");
        Mac mac = Mac.getMac();
        int i;
        if(mac != null)
        {
            String s1 = mac.makeSystemPretty(s);
            i = FontPeer.SetFftFile(peer, s1);
        } else
        {
            i = FontPeer.SetFftFile(peer, s);
        }
        if(i == 0)
            throw new GeneratorApiException("error setting file");
        else
            return;
    }

    public void setFile(String s)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        if(s == null)
            throw new GeneratorApiException("null string");
        Mac mac = Mac.getMac();
        int i;
        if(mac != null)
        {
            String s1 = mac.makeSystemPretty(s);
            i = FontPeer.SetFile(peer, s1);
        } else
        {
            i = FontPeer.SetFile(peer, s);
        }
        if(i == 0)
            throw new GeneratorApiException("error setting file");
        else
            return;
    }

    public void setFont(String s, boolean flag, boolean flag1)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        if(s == null)
            throw new GeneratorApiException("null string");
        int i = FontPeer.SetFont(peer, s, flag, flag1);
        if(i == 0)
            throw new GeneratorApiException("error setting font");
        else
            return;
    }
}