Esempio n. 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();
  }
Esempio n. 2
0
 public long getCharacterMapping(long a_unicode) {
   return m_cmap.getGlyfIndex(new Long(a_unicode));
 }
Esempio n. 3
0
 /**
  * adds character mapping to
  *
  * @param a_unicode unicode of the character
  * @param a_glyfIndex 'glyf' index obtained from #addGlyph
  */
 public void addCharacterMapping(long a_unicode, long a_glyfIndex) {
   m_cmap.addMapping(a_unicode, a_glyfIndex);
 }
Esempio n. 4
0
 public void addUnicodeRange(TTUnicodeRange a_range) {
   m_cmap.addUnicodeRange(a_range);
 }