2000-03-17 01:45:06 +01:00
|
|
|
/* Copyright (C) 1999, 2000 Free Software Foundation
|
1999-05-05 13:05:57 +02:00
|
|
|
|
|
|
|
This file is part of libjava.
|
|
|
|
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
|
|
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
package java.awt;
|
|
|
|
|
2000-07-12 05:32:07 +02:00
|
|
|
import java.util.Locale;
|
|
|
|
|
2000-03-17 01:45:06 +01:00
|
|
|
/**
|
|
|
|
* @author Warren Levy <warrenl@cygnus.com>
|
|
|
|
* @date March 16, 2000.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Written using on-line Java Platform 1.2 API Specification, as well
|
|
|
|
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
|
|
|
* Status: Stubbed; A very incomplete implementation.
|
|
|
|
*/
|
1999-05-05 13:05:57 +02:00
|
|
|
|
|
|
|
public class Font
|
|
|
|
{
|
2000-03-17 01:45:06 +01:00
|
|
|
// FIXME
|
|
|
|
|
|
|
|
public static final int PLAIN = 0;
|
|
|
|
public static final int BOLD = 1;
|
|
|
|
public static final int ITALIC = 2;
|
|
|
|
public static final int ROMAN_BASELINE = 0;
|
|
|
|
public static final int CENTER_BASELINE = 1;
|
|
|
|
public static final int HANGING_BASELINE = 2;
|
|
|
|
protected String name;
|
|
|
|
protected int style;
|
|
|
|
protected int size;
|
|
|
|
protected float pointSize;
|
|
|
|
|
|
|
|
public Font(String name, int style, int size)
|
|
|
|
{
|
|
|
|
this.name = name;
|
|
|
|
this.style = style & 0x3; // Only use lowest 2 bits.
|
|
|
|
this.size = size;
|
|
|
|
pointSize = size; // Assume some subclass can set a different val.
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isPlain()
|
|
|
|
{
|
|
|
|
if (style == PLAIN)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isBold()
|
|
|
|
{
|
2000-03-24 10:09:56 +01:00
|
|
|
if ((style & BOLD) == BOLD)
|
2000-03-17 01:45:06 +01:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isItalic()
|
|
|
|
{
|
2000-03-24 10:09:56 +01:00
|
|
|
if ((style & ITALIC) == ITALIC)
|
2000-03-17 01:45:06 +01:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName()
|
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2000-07-12 05:32:07 +02:00
|
|
|
public String getFamily()
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getFamily(Locale l)
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2000-03-17 01:45:06 +01:00
|
|
|
public int getStyle()
|
|
|
|
{
|
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getSize()
|
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getSize2D()
|
|
|
|
{
|
|
|
|
return pointSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Font decode(String str) { return null; } // FIXME
|
2000-07-12 05:32:07 +02:00
|
|
|
|
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
String style_str = "";
|
|
|
|
if (isPlain())
|
|
|
|
style_str = "plain";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isBold())
|
|
|
|
style_str += "bold";
|
|
|
|
if (isItalic())
|
|
|
|
style_str += "italic";
|
|
|
|
}
|
|
|
|
return getClass().getName() + "[family=" + getFamily() + ",name=" +
|
|
|
|
getName() + ",style=" + style_str + ",size=" + getSize() + "]";
|
|
|
|
}
|
1999-05-05 13:05:57 +02:00
|
|
|
}
|