sfntly Support for CFF

155 views
Skip to first unread message

Bill Schwanitz

unread,
Feb 13, 2012, 12:34:46 PM2/13/12
to sfntly-users
Hi All,

I wonder if anyone could comment on the curent state of support for
CFF fonts in sfntly? It looks like some support is there, but it is
not complete.

Any idea if adding support for subsetting CFFs is on the roadmap?

Thanks,
Bill

Stuart Gill

unread,
Feb 13, 2012, 8:05:04 PM2/13/12
to sfntly...@googlegroups.com
Bill,

The current state of support is pretty close to zero. There is a tag defined for the identity of a CFF table but it will be constructed as a sfntly.table.Table object. You will be able to access it at the byte level but nothing more than that.

CFF tables are essentially containers for a whole other font format inside an sfnt container. This other format is essentially a variant of a PostScript (PS) font. To start editing these tables will require implementing a PS parser. It may not need to be a full parser but even still it's a big-ish task.

I've actually been thinking about it over the last couple of weeks but it hasn't gotten any further than that yet. I think if this goes forward the best way to deal with it might be to implement a Java PS library (probably not full featured - i.e. it wouldn't be able to run the PS just parse it). This library could then be used by sfntly as part of it's processing of the CFF table.

This is definitely something that we'd like to see done. How the scheduling works out for it is uncertain. As an open source project help is always welcome.

Stuart

Brian Stell

unread,
Feb 14, 2012, 2:35:35 PM2/14/12
to bschw...@extensis.com, sfntly...@googlegroups.com
Hi Bill,

Would you be interested in helping with CFF subsetting?

Brian

randomrand...@yahoo.com.au

unread,
Aug 31, 2012, 11:56:50 PM8/31/12
to sfntly...@googlegroups.com
Ok, I'm not sure if this is a stupid question or not, so bear with me :)
  1. I load a CFF font through FontFactory.loadFonts() and I end up with a Font object
  2. I create a new font builder via FontFactory.newFontBuilder()
  3. I then add a new table builder for each table that was in the CFF font I loaded (Font.Builder.newTableBuilder(key, srcData))
  4. I then build the new font and serialize it (so it should essentially be a copy of the original?)
  5. The problem is that the serialized font is invalid (according to Windows anyway - trying to open it will fail)

But then let's say I do the following:

  1. I load the CFF font as a font builder via FontFactory.loadFontsForBuilding()
  2. I then build and serialize this builder
  3. The resultant font is valid
  4. I can remove tables from the font builder and the resultant font is still valid if I do it this way

So essentially if I try to create a new font from a CFF font it fails, but if I started out with a font builder in the first place, all seems ok - is this to be expected? I've attached an example font for which this occurs, but I believe it happens with all the CFF fonts that I've tried so far.

Thanks alot.

BergamoStd-Regular.otf

randomrand...@yahoo.com.au

unread,
Sep 1, 2012, 12:08:06 AM9/1/12
to sfntly...@googlegroups.com
Oh yeah; here's some sample code for the first case I outlined (has no error checking)
Thanks
Sfnttest.java

Brian Stell

unread,
Sep 1, 2012, 9:30:32 PM9/1/12
to sfntly...@googlegroups.com
I don't think the CFF is supported at this time.

Stuart Gill

unread,
Sep 4, 2012, 1:51:05 PM9/4/12
to sfntly...@googlegroups.com
CFF isn't specifically yet supported but the CFF table should flow through. I'll add an issue for this and have a look at it as soon as I can.

Thanks,
Stuart
Reply all
Reply to author
Forward
0 new messages