ch.claudio.fonts
Class CachedInfo

java.lang.Object
  extended by ch.claudio.fonts.CachedInfo

public class CachedInfo
extends java.lang.Object

Remembers font information which is hard to obtain. On object creation the font is just stored. Only when one of the methods except getFont is called it will perform the costly action to find all stretches of character belonging to a font.

Version:
$Id: CachedInfo.java 279 2008-07-06 12:48:24Z claudio $
Author:
Claudio Nieder

Copyright (C) 2006-2008 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Constructor Summary
CachedInfo(java.awt.Font f)
          Create a CachedInfo item for this font.
 
Method Summary
 int firstChar()
           
 int[] getDisplayableChars()
          Returns an array containing those character codepoints which are displayable characters in this font.
 java.awt.Font getFont()
           
 java.lang.String getSample(int cpl)
          Create a string containing all displayable characters in this font.
 IntegerRange[] getStretches()
          Return an array of ranges of displayable characters.
 int lastChar()
           
static void main(java.lang.String[] args)
          Print license.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedInfo

public CachedInfo(java.awt.Font f)
Create a CachedInfo item for this font.

Parameters:
f -
Method Detail

firstChar

public int firstChar()
Returns:
first character code in this font

lastChar

public int lastChar()
Returns:
last character code in this font

getFont

public java.awt.Font getFont()
Returns:
Returns the font.

getDisplayableChars

public int[] getDisplayableChars()
Returns an array containing those character codepoints which are displayable characters in this font.

Returns:
the displayableChars.

getSample

public java.lang.String getSample(int cpl)
Create a string containing all displayable characters in this font.

Parameters:
cpl - number of characters after which to insert a new line.
Returns:
the string

getStretches

public IntegerRange[] getStretches()
Return an array of ranges of displayable characters.

Returns:
List of defined and displayable character ranges.

main

public static void main(java.lang.String[] args)
Print license.

Parameters:
args - ignored