Ejemplo 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();
  }
Ejemplo n.º 2
0
 /**
  * http://www.microsoft.com/typography/otspec/os2.htm
  *
  * @param a_codeRange position of the bit. For example, JIS will be 17.
  */
 public void setCodeRangeFlag(int a_codeRange) {
   m_os2.setCodePageRangeFlag(a_codeRange);
 }
Ejemplo n.º 3
0
 public void setLineGap(int a_value) {
   m_os2.setTypoLineGap(a_value);
   m_hhea.setLineGap(a_value);
 }
Ejemplo n.º 4
0
 public void setXHeight(int a_value) {
   m_os2.setXHeight(a_value);
 }
Ejemplo n.º 5
0
 public void setDescent(int a_value) {
   m_os2.setTypoDescender(-a_value);
 }
Ejemplo n.º 6
0
 public void setAscent(int a_value) {
   m_os2.setTypoAscender(a_value);
   m_os2.setCapHeight(a_value);
 }