Hi Stuart,
Thanks for the quick reply. First, I need to say how much I'm enjoying
working with the sfntly library. Nice work!
I'll try to give some code... I'd like to create a class that extends
InputStream that takes an InputStream from a ttf file and subsets and/
or outputs in a different format.
For example:
class MyFontInputStream extends InputStream {
public MyFontInputStream(InputStream isTTF, String format, String
charsInSubset);
public int read();
}
Then I can use this class like:
MyFontInputStream is = MyFontInputStream(new FileInputStream(new
File("some name")), "eot", "abcdefg");
This will take the incoming InputStream, subset it down to the
characters "abcdefg" and convert it to eot format.
Then in the constructor of MyFontInputStream I perform all the sfntly
operations to subset the incoming InputStream and convert it to a
different format. In the case of converting the incoming ttf to eot or
woff, it is easy to use the WritableFontData output from EOTWriter and
WoffWriter to implement the int read() method:
public int read() {
return writableFontData.readByte(offset++);
}
My problem is the *seemingly* simpler case where the desired output
format is ttf. For example:
MyFontInputStream is = MyFontInputStream(new FileInputStream(new
File("some name")), "ttf", "abcdefg");
In this case, I just want to do the subsetting and make the resulting
font available as a ttf. How can I step through the ttf's bytes one by
one to make them available for the MyFontInputStream's read() method?
Thanks,
Bill