Example #1
0
  /** write TrueType file to the random access file */
  public void write() throws IOException {
    m_cmap.write();
    // hmtx must be written before hhea
    m_hmtx.write();
    m_hhea.write();

    m_glyf.write();
    m_loca.write();

    m_head.setCheckSumAdjustment(0);
    m_head.write();
    m_maxp.write(); // must be written after m_glyf
    m_hdmx.write();
    m_name.write();
    m_post.write();
    m_os2.write();

    writeTableDirectory();
    byte[] tableDir = toByteArray();
    for (FontFormatWriter table : m_tables) {
      m_buffer.write(table.toByteArray());
    } // for table

    long checkSum = 0xb1b0afba - (0xffffffff & getCheckSum());
    m_head.setCheckSumAdjustment(checkSum);
    m_head.reset();
    m_head.write();

    reset();

    m_buffer.write(tableDir);
    for (FontFormatWriter table : m_tables) {
      m_buffer.write(table.toByteArray());
    } // for table

    //		FileOutputStream writer = new FileOutputStream(m_file);
    //		writer.write(toByteArray());
    //		writer.close();
  }
Example #2
0
 public TTGlyph getGlyph(int a_index) {
   return m_glyf.getGlyph(a_index);
 }
Example #3
0
 /**
  * adds glyph to the 'glyf' subtable.
  *
  * @param a_glyph the glyph to be added.
  * @return 'glyf' index of the added glyph.
  */
 public int addGlyph(TTGlyph a_glyph) {
   return m_glyf.add(a_glyph);
 }