package com.github.googlei18n.tachyfont;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.zip.GZIPOutputStream;

import javax.servlet.http.*;

@SuppressWarnings("serial")
public class GetBase extends HttpServlet {
  @Override
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Get the TachyFont base.
    String jarFilename = "fonts/noto/sans/NotoSansJP-Thin_subset_smp.TachyFont.jar";
    JarFile jarFile = new JarFile("WEB-INF/" + jarFilename);
    JarEntry base = jarFile.getJarEntry("base");
    InputStream baseStream = jarFile.getInputStream(base);

    // Send the data.
    byte[] buffer = new byte[4096];
    int bytesRead = 0;
    resp.setContentType("application/x-font-otf");
    OutputStream outputStream = resp.getOutputStream();
//    GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputStream);
//    resp.setHeader("Content-Encoding", "gzip");
    while ((bytesRead = baseStream.read(buffer)) != -1) {
      outputStream.write(buffer, 0, bytesRead);
    }
//    gzipOutputStream.close();
    jarFile.close();
  }
}

@@ -456,16 +456,74 @@
 t base.%0A
+    System.out.println(%22need to get the font parameter%22);%0A
     Stri
@@ -575,19 +575,8 @@
 Thin
-_subset_smp
 .Tac

switch to the full font for better font testing.