summaryrefslogtreecommitdiff
path: root/gnu/java/awt/peer/ClasspathFontPeer.java
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2015-06-19 16:04:59 +0100
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2015-06-19 16:04:59 +0100
commit6bc8d84e4b0527f680b78a9a0c808cda74d4933d (patch)
tree835056047b4bde36f8d67b1656fa8dab8f6e1c6d /gnu/java/awt/peer/ClasspathFontPeer.java
parent591da8d224ab68474c4600d42fc74bafe974303a (diff)
downloadclasspath-6bc8d84e4b0527f680b78a9a0c808cda74d4933d.tar.gz
Mention PR66376.
2015-06-19 Andrew John Hughes <gnu_andrew@member.fsf.org> * NEWS: Mention PR66376.
Diffstat (limited to 'gnu/java/awt/peer/ClasspathFontPeer.java')
-rw-r--r--gnu/java/awt/peer/ClasspathFontPeer.java123
1 files changed, 62 insertions, 61 deletions
diff --git a/gnu/java/awt/peer/ClasspathFontPeer.java b/gnu/java/awt/peer/ClasspathFontPeer.java
index 96677a4af..2f7768e02 100644
--- a/gnu/java/awt/peer/ClasspathFontPeer.java
+++ b/gnu/java/awt/peer/ClasspathFontPeer.java
@@ -1,5 +1,5 @@
/* ClasspathFontPeer.java -- Font peer used by GNU Classpath.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -129,7 +129,8 @@ public abstract class ClasspathFontPeer
super(max, 0.75f, true);
max_entries = max;
}
- protected boolean removeEldestEntry(Map.Entry eldest)
+ @Override
+ protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
{
return size() > max_entries;
}
@@ -191,7 +192,7 @@ public abstract class ClasspathFontPeer
return name;
}
- public static void copyStyleToAttrs (int style, Map attrs)
+ public static void copyStyleToAttrs (int style, Map<TextAttribute,Object> attrs)
{
if ((style & Font.BOLD) == Font.BOLD)
attrs.put (TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
@@ -204,18 +205,18 @@ public abstract class ClasspathFontPeer
attrs.put (TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);
}
- protected static void copyFamilyToAttrs (String fam, Map attrs)
+ protected static void copyFamilyToAttrs (String fam, Map<TextAttribute,Object> attrs)
{
if (fam != null)
attrs.put (TextAttribute.FAMILY, fam);
}
- public static void copySizeToAttrs (float size, Map attrs)
+ public static void copySizeToAttrs (float size, Map<TextAttribute,Object> attrs)
{
attrs.put (TextAttribute.SIZE, new Float (size));
}
- protected static void copyTransformToAttrs (AffineTransform trans, Map attrs)
+ protected static void copyTransformToAttrs (AffineTransform trans, Map<TextAttribute,Object> attrs)
{
if (trans != null)
{
@@ -255,12 +256,12 @@ public abstract class ClasspathFontPeer
}
- protected void setStandardAttributes (String name, Map attribs)
+ protected void setStandardAttributes (String name, Map<TextAttribute,Object> attribs)
{
String family = this.familyName;
AffineTransform trans = this.transform;
- float size = this.size;
- int style = this.style;
+ float setSize = this.size;
+ int setStyle = this.style;
if (attribs.containsKey (TextAttribute.FAMILY))
family = (String) attribs.get (TextAttribute.FAMILY);
@@ -272,27 +273,27 @@ public abstract class ClasspathFontPeer
{
Float weight = (Float) attribs.get (TextAttribute.WEIGHT);
if (weight.floatValue () >= TextAttribute.WEIGHT_BOLD.floatValue ())
- style += Font.BOLD;
+ setStyle += Font.BOLD;
}
if (attribs.containsKey (TextAttribute.POSTURE))
{
Float posture = (Float) attribs.get (TextAttribute.POSTURE);
if (posture.floatValue () >= TextAttribute.POSTURE_OBLIQUE.floatValue ())
- style += Font.ITALIC;
+ setStyle += Font.ITALIC;
}
if (attribs.containsKey (TextAttribute.SIZE))
{
Float sz = (Float) attribs.get (TextAttribute.SIZE);
- size = sz.floatValue ();
+ setSize = sz.floatValue ();
// Pango doesn't accept 0 as a font size.
- if (size < 1)
- size = 1;
+ if (setSize < 1)
+ setSize = 1;
}
else
- size = 12;
+ setSize = 12;
if (attribs.containsKey (TextAttribute.TRANSFORM))
{
@@ -301,10 +302,10 @@ public abstract class ClasspathFontPeer
trans = ta.getTransform ();
}
- setStandardAttributes (name, family, style, size, trans);
+ setStandardAttributes (name, family, setStyle, setSize, trans);
}
- protected void getStandardAttributes (Map attrs)
+ protected void getStandardAttributes (Map<TextAttribute,Object> attrs)
{
copyFamilyToAttrs (this.familyName, attrs);
copySizeToAttrs (this.size, attrs);
@@ -315,15 +316,15 @@ public abstract class ClasspathFontPeer
/* Begin public API */
- public ClasspathFontPeer (String name, Map attrs)
+ public ClasspathFontPeer (String name, Map<TextAttribute,Object> attrs)
{
setStandardAttributes (name, attrs);
}
public ClasspathFontPeer (String name, int style, int size)
{
- setStandardAttributes (name, (String)null, style,
- (float)size, (AffineTransform)null);
+ setStandardAttributes (name, (String)null, style, size,
+ (AffineTransform)null);
}
/**
@@ -333,7 +334,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public String getName (Font font)
{
return logicalName;
@@ -346,7 +347,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public String getFamily (Font font)
{
return familyName;
@@ -359,7 +360,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public String getFamily (Font font, Locale lc)
{
return familyName;
@@ -372,7 +373,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public String getFontName (Font font)
{
return faceName;
@@ -385,7 +386,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public String getFontName (Font font, Locale lc)
{
return faceName;
@@ -398,7 +399,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public float getSize (Font font)
{
return size;
@@ -411,7 +412,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public boolean isPlain (Font font)
{
return style == Font.PLAIN;
@@ -424,7 +425,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public boolean isBold (Font font)
{
return ((style & Font.BOLD) == Font.BOLD);
@@ -437,7 +438,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public boolean isItalic (Font font)
{
return ((style & Font.ITALIC) == Font.ITALIC);
@@ -450,13 +451,13 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public Font deriveFont (Font font, int style, float size)
+ @SuppressWarnings("unused")
+ public Font deriveFont (Font font, int newStyle, float newSize)
{
- Map attrs = new HashMap ();
+ Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>();
getStandardAttributes (attrs);
- copyStyleToAttrs (style, attrs);
- copySizeToAttrs (size, attrs);
+ copyStyleToAttrs (newStyle, attrs);
+ copySizeToAttrs (newSize, attrs);
return tk().getFont (logicalName, attrs);
}
@@ -467,12 +468,12 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public Font deriveFont (Font font, float size)
+ @SuppressWarnings("unused")
+ public Font deriveFont (Font font, float newSize)
{
- Map attrs = new HashMap ();
+ Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>();
getStandardAttributes (attrs);
- copySizeToAttrs (size, attrs);
+ copySizeToAttrs (newSize, attrs);
return tk().getFont (logicalName, attrs);
}
@@ -483,12 +484,12 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public Font deriveFont (Font font, int style)
+ @SuppressWarnings("unused")
+ public Font deriveFont (Font font, int newStyle)
{
- Map attrs = new HashMap ();
+ Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>();
getStandardAttributes (attrs);
- copyStyleToAttrs (style, attrs);
+ copyStyleToAttrs (newStyle, attrs);
return tk().getFont (logicalName, attrs);
}
@@ -499,12 +500,12 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public Font deriveFont (Font font, int style, AffineTransform t)
+ @SuppressWarnings("unused")
+ public Font deriveFont (Font font, int newStyle, AffineTransform t)
{
- Map attrs = new HashMap ();
+ Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>();
getStandardAttributes (attrs);
- copyStyleToAttrs (style, attrs);
+ copyStyleToAttrs (newStyle, attrs);
copyTransformToAttrs (t, attrs);
return tk().getFont (logicalName, attrs);
}
@@ -516,10 +517,10 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public Font deriveFont (Font font, AffineTransform t)
{
- Map attrs = new HashMap ();
+ Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>();
getStandardAttributes (attrs);
copyTransformToAttrs (t, attrs);
return tk().getFont (logicalName, attrs);
@@ -532,8 +533,9 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public Font deriveFont (Font font, Map attrs)
+ @SuppressWarnings("unused")
+ public Font deriveFont (Font font,
+ Map<? extends AttributedCharacterIterator.Attribute,?> attrs)
{
return tk().getFont (logicalName, attrs);
}
@@ -545,10 +547,10 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public Map getAttributes (Font font)
+ @SuppressWarnings("unused")
+ public Map<TextAttribute,?> getAttributes (Font font)
{
- HashMap h = new HashMap ();
+ HashMap<TextAttribute,Object> h = new HashMap<TextAttribute,Object>();
getStandardAttributes (h);
return h;
}
@@ -560,8 +562,8 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
- public AttributedCharacterIterator.Attribute[] getAvailableAttributes(Font font)
+ @SuppressWarnings("unused")
+ public static AttributedCharacterIterator.Attribute[] getAvailableAttributes(Font font)
{
AttributedCharacterIterator.Attribute a[] =
new AttributedCharacterIterator.Attribute[5];
@@ -580,7 +582,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public AffineTransform getTransform (Font font)
{
if (transform == null)
@@ -595,7 +597,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public boolean isTransformed (Font font)
{
return ! transform.isIdentity ();
@@ -608,13 +610,12 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public float getItalicAngle (Font font)
{
if ((style & Font.ITALIC) == Font.ITALIC)
return TextAttribute.POSTURE_OBLIQUE.floatValue ();
- else
- return TextAttribute.POSTURE_REGULAR.floatValue ();
+ return TextAttribute.POSTURE_REGULAR.floatValue ();
}
@@ -625,7 +626,7 @@ public abstract class ClasspathFontPeer
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
-
+ @SuppressWarnings("unused")
public int getStyle (Font font)
{
return style;