2
* This program is free software; you can redistribute it and/or modify it under the
3
* terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software
6
* You should have received a copy of the GNU Lesser General Public License along with this
7
* program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
8
* or from the Free Software Foundation, Inc.,
9
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
11
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
* See the GNU Lesser General Public License for more details.
15
* Copyright (c) 2006 - 2009 Pentaho Corporation and Contributors. All rights reserved.
18
package org.pentaho.reporting.libraries.fonts.monospace;
20
import org.pentaho.reporting.libraries.fonts.registry.FontFamily;
21
import org.pentaho.reporting.libraries.fonts.registry.FontRecord;
24
* Creation-Date: 13.05.2007, 13:14:25
26
* @author Thomas Morgner
28
public class MonospaceFontFamily implements FontFamily
30
private String familyName;
31
private FontRecord[] fonts;
33
public MonospaceFontFamily(final String familyName)
35
if (familyName == null)
37
throw new NullPointerException();
39
this.familyName = familyName;
40
this.fonts = new FontRecord[4];
44
* Returns the name of the font family (in english).
48
public String getFamilyName()
53
public String[] getAllNames()
55
return new String[]{ familyName };
59
* This selects the most suitable font in that family. Italics fonts are preferred over oblique fonts.
65
public FontRecord getFontRecord(final boolean bold, final boolean italics)
76
if (fonts[index] != null)
80
fonts[index] = new MonospaceFontRecord(this, bold, italics);
84
public boolean equals(final Object o)
90
if (o == null || getClass() != o.getClass())
95
final MonospaceFontFamily that = (MonospaceFontFamily) o;
97
if (!familyName.equals(that.familyName))
105
public int hashCode()
107
return familyName.hashCode();