|
|
#16 |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,345
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; NOOK ST GlowLight
|
there seems to be some C++ source here: http://podofo.sourceforge.net/doc/ht...TTFSubset.html (LGPL) Another Perl one here: http://search.cpan.org/~mhosken/Font-TTF-Scripts/ (Perl Artistic license 2.0) A php one here: http://www.4real.gr/technical-documents-ttf-subset.html Aha! A python one under active development as part of a PDF generation project: http://code.google.com/p/pyfpdf/ (LGPL) I do not know if any of the projects also work on otf fonts. matplotlib is another python project that seems to include font subsetting: https://github.com/matplotlib/matplotlib (an attribution licence)
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 |
|
|
|
|
|
#17 |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,345
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; NOOK ST GlowLight
|
But is a bit of overkill. I'd much rather find some self-contained python library. I've done a bit of digging and listed some projects that I've found. This is to remind me to check them out later.
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 |
|
|
|
|
Enthusiast
|
|
|
|
#18 |
|
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,148
Karma: 2505637
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon
|
I wonder how those subsetters work with ligatures and glyph variants...
|
|
|
|
|
|
#19 |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,345
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; NOOK ST GlowLight
|
Those are good questions!
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 |
|
|
|
|
|
#20 |
|
Mobile Reader Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 34,227
Karma: 13801376
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad
|
Not a good solution as Fontforge is Linux and to get it to run on Windows, Cygwin has to be installed and Python has to be installed under Cygwin. That's a very poor solution for Windows users. We need a more universal solution.
__________________
|
|
|
|
|
|
#21 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090
Karma: 2701341
Join Date: Dec 2010
Device: Kindle 3
|
Quote:
You may want to do your own research every now and then.
|
|
|
|
|
|
|
#22 |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,345
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; NOOK ST GlowLight
|
Working on way to subset fonts for ePub/KF3
In a couple of other threads, the idea has come up that it would be very useful to have a tool that could subset the fonts embedded in ePub and/or KF8 books, as that would both reduce the file sizes and make more fonts available, as some font licences require subsetting to permit embedding.
I have moved the posts from the main other thread over here.
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 |
|
|
|
|
|
#23 |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,345
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; NOOK ST GlowLight
|
Someone raised the question of ligatures and alternate characters. As I said, these are very good questions, as the creator of the ePub has no control over the glyph choice of the display software.
In PDFs, the subsetting task is a lot simpler, as all the glyphs used (not just characters) are fixed in the PDF. For ePubs and KF8, I think we must take this into account in any solution. But this doesn't need to be part of the font subsetting code, which should work from a passed list of glyphs that should be included. (And should return an error if any are missing from the font.) For ligatures we might need to generate not only a list of all characters in a file, but also of all character pairs. But, of course, there are also three character ligatures (ffi in English, for examples) and I suppose some languages might have more. Hmmm... Perhaps we just need to include all ligatures for which the source file includes all the characters in the ligature. Or perhaps we also need a script to get information on ligatures present in a font, so that that information can be used when parsing the XHTML. Or should we start off with a very basic solution, and elaborate once that's working?
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 |
|
|
|
|
|
#24 |
|
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,148
Karma: 2505637
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon
|
|
|
|
|
|
|
#25 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,113
Karma: 958803
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
|
The C++ class can also work with otf files according to the site. Unfortunately I cannot program in C++...
__________________
Creator and maintainer of the e-Book Tools Word add-in. Creator and maintainer of the Clean HTML macro for MS Word. |
|
|
|
|
|
#26 | |
|
Mobile Reader Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 34,227
Karma: 13801376
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad
|
Quote:
__________________
|
|
|
|
|
|
|
#27 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090
Karma: 2701341
Join Date: Dec 2010
Device: Kindle 3
|
Unfortunately, the MinGW based FontForge Windows binary installer doesn't seem to install the fontforge Python module, but theoretically it should be possible to use Python scripts to control FontForge.
|
|
|
|
|
|
#28 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,113
Karma: 958803
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
|
The windows binary of FontForge has more drawbacks. It crashes often.
__________________
Creator and maintainer of the e-Book Tools Word add-in. Creator and maintainer of the Clean HTML macro for MS Word. |
|
|
|
|
|
#29 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,840
Karma: 23400772
Join Date: Jan 2010
Device: Kindle Fire HD, Kindle 2
|
Because I have much more time than sense, I've done some more work on the script that counts/collects the characters used in files.
Building on the core that Man Eating Duck posted, this script will work for a single ePub, (x)html, or text file. In addition to filtering all of the html code/attributes from the results, it will also convert entities (named or otherwise) to their rendered equivalents. It also has the ability to limit the results to a single specified CSS class (handy for determining the font-subset required for headings or drop-caps). Python will almost always have issues printing certain unicode characters to the console on Windows OSs, so Windows users should consider just writing the results to a file and then viewing that file with an editor that supports the required character encoding. Should work with Python 2.5 - 2.7 (maybe even earlier). A test xhtml file is included for testing/benchmarking purposes. Spoiler:
__________________
“Politics: A strife of interests masquerading as a contest of principles. The conduct of public affairs for private advantage.” Last edited by DiapDealer; 10-14-2012 at 03:31 PM. |
|
|
|
|
|
#30 |
|
Mobile Reader Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 34,227
Karma: 13801376
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad
|
But is there a way of taking a TTF or OTF font file and subsetting it that works on Windows, OS X, & Linux without the need for Cygwin?
__________________
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| group an ARBITRARY subset of records | RotAnal | Library Management | 6 | 10-09-2012 11:53 AM |
| Working with Fonts and Calibre | kiwidude | Development | 8 | 03-04-2011 07:49 PM |
| Fonts not working in a converted book | snape | Sony Reader | 9 | 11-08-2010 11:46 PM |
| Changing fonts not working? | tselling | Astak EZReader | 11 | 09-21-2009 03:03 PM |
| Why are some fonts not working?? | daviddem | HanLin eBook | 4 | 01-22-2009 09:14 AM |