FileDocCategorySizeDatePackage
Ffn.javaAPI DocApache Poi 3.0.15887Mon Jan 01 18:55:32 GMT 2007org.apache.poi.hwpf.model

Ffn

public class Ffn extends Object
FFN - Font Family Name. FFN is a data structure that stores the names of the Main Font and that of Alternate font as an array of characters. It has also a header that stores info about the whole structure and the fonts
author
Praveen Mathew

Fields Summary
private int
_cbFfnM1
private byte
_info
private static BitField
_prq
private static BitField
_fTrueType
private static BitField
_ff
private short
_wWeight
private byte
_chs
private byte
_ixchSzAlt
private byte[]
_panose
private byte[]
_fontSig
private char[]
_xszFfn
private int
_xszFfnLength
Constructors Summary
public Ffn(byte[] buf, int offset)


      
  
    int offsetTmp = offset;

    _cbFfnM1 = LittleEndian.getUnsignedByte(buf,offset);
    offset += LittleEndian.BYTE_SIZE;
    _info = buf[offset];
    offset += LittleEndian.BYTE_SIZE;
    _wWeight = LittleEndian.getShort(buf, offset);
    offset += LittleEndian.SHORT_SIZE;
    _chs = buf[offset];
    offset += LittleEndian.BYTE_SIZE;
    _ixchSzAlt = buf[offset];
    offset += LittleEndian.BYTE_SIZE;

    // read panose and fs so we can write them back out.
    System.arraycopy(buf, offset, _panose, 0, _panose.length);
    offset += _panose.length;
    System.arraycopy(buf, offset, _fontSig, 0, _fontSig.length);
    offset += _fontSig.length;

    offsetTmp = offset - offsetTmp;
    _xszFfnLength = (this.getSize() - offsetTmp)/2;
    _xszFfn = new char[_xszFfnLength];

    for(int i = 0; i < _xszFfnLength; i++)
    {
      _xszFfn[i] = (char)LittleEndian.getShort(buf, offset);
      offset += LittleEndian.SHORT_SIZE;
    }


  
Methods Summary
public booleanequals(java.lang.Object o)

    boolean retVal = true;

    if (((Ffn)o).get_cbFfnM1() == _cbFfnM1)
    {
      if(((Ffn)o)._info == _info)
      {
      if(((Ffn)o)._wWeight == _wWeight)
      {
        if(((Ffn)o)._chs == _chs)
        {
        if(((Ffn)o)._ixchSzAlt == _ixchSzAlt)
        {
          if(Arrays.equals(((Ffn)o)._panose,_panose))
          {
          if(Arrays.equals(((Ffn)o)._fontSig,_fontSig))
          {
                  if(!(Arrays.equals(((Ffn)o)._xszFfn,_xszFfn)))
                    retVal = false;
          }
          else
            retVal = false;
          }
          else
          retVal = false;
        }
        else
          retVal = false;
        }
        else
        retVal = false;
      }
      else
        retVal = false;
      }
      else
      retVal = false;
    }
    else
      retVal = false;

    return retVal;
  
public java.lang.StringgetAltFontName()

    int index = _ixchSzAlt;
    for (;index < _xszFfnLength; index++)
    {
      if (_xszFfn[index] == '\0")
      {
        break;
      }
    }
    return new String(_xszFfn, _ixchSzAlt, index);

  
public bytegetChs()

	  return  _chs;
  
public byte[]getFontSig()

	  return  _fontSig;
  
public java.lang.StringgetMainFontName()

    int index = 0;
    for (;index < _xszFfnLength; index++)
    {
      if (_xszFfn[index] == '\0")
      {
        break;
      }
    }
    return new String(_xszFfn, 0, index);
  
public byte[]getPanose()

	  return  _panose;
  
public intgetSize()

    return (_cbFfnM1 + 1);
  
public shortgetWeight()

	  return  _wWeight;
  
public intget_cbFfnM1()

    return  _cbFfnM1;
  
public voidset_cbFfnM1(int _cbFfnM1)

    this._cbFfnM1 = _cbFfnM1;
  
public byte[]toByteArray()

    int offset = 0;
    byte[] buf = new byte[this.getSize()];

    buf[offset] = (byte)_cbFfnM1;
    offset += LittleEndian.BYTE_SIZE;
    buf[offset] = _info;
    offset += LittleEndian.BYTE_SIZE;
    LittleEndian.putShort(buf, offset, _wWeight);
    offset += LittleEndian.SHORT_SIZE;
    buf[offset] = _chs;
    offset += LittleEndian.BYTE_SIZE;
    buf[offset] = _ixchSzAlt;
    offset += LittleEndian.BYTE_SIZE;

    System.arraycopy(_panose,0,buf, offset,_panose.length);
    offset += _panose.length;
    System.arraycopy(_fontSig,0,buf, offset, _fontSig.length);
    offset += _fontSig.length;

    for(int i = 0; i < _xszFfn.length; i++)
    {
      LittleEndian.putShort(buf, offset, (short)_xszFfn[i]);
      offset += LittleEndian.SHORT_SIZE;
    }

    return buf;