Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 10-24-2017, 12:40 PM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Darkening and subsetting fonts

Hi

Here are the results of some trials.

To begin, you'll find four (there are more of them) otf fonts of the Linux Libertine O family. Please note that these fonts are published under the GPL license, and that the further modified and renamed fonts below share of course the same license. They are in the folder: "A original fonts".

These fonts have been darkened using the nice script of Sherman Perry, ReadifyFont.

Quote:
The "latest" version can be found here: https://github.com/shermp/ReadifyFon...ceImprovements
I selected two different darkening levels from a range from 0 to 50 and modified accordingly their side-bearings: 30 is nearly a semi-bold value, while 20 is only neatly darker. I produced four ttf fonts, renamed LibertineO-G30 or LibertineO-G20. The Bold and BoldItalic fonts have not been darkened. These fonts can of course be installed permanently on your system or side-loaded in any decent ebook-reader (like Koreader). They are in the folder: "B darkened."

These darkened fonts have been subsetted with pyftsubset (a part of the fonttools project) against the list of characters named characters330 which contains the 110 unicode characters of the joint EPUB (the list is produced by the reports tool of the Calibre Editor). The subsets are in the folder: "C subsets."

I also joined the test EPUB with its subsetted -and darkened- fonts. It passes the epubcheck validation test.

About size

This way one can embed subsets of any font, including a customized one. Here the regular subset size used for the EPUB is about 44k, and the italic one, 37k (from a common 110 characters list).

As we make it work currently with a single list of characters, pyftsubset can provide a clear size saving advantage if the book use only both regular and italic fonts. This advantage could be greatly reduced, even nullified, if we had to include bold and bolditalics fonts.
Attached Files
File Type: zip trials.zip (4.24 MB, 52 views)

Last edited by roger64; 10-31-2017 at 03:26 AM. Reason: size saving
roger64 is offline   Reply With Quote
Old 10-25-2017, 12:42 AM   #2
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
This is how I did it even if there can be other ways. I used these scripts with Archlinux, but they can work on many other operating systems as long as you have a recent version of Fontforge and Python (and python-pip for Arch).

About pyftsubset

I failed to see who are its five authors and its maintainer. Anyway many thanks to them.

Here is some more information about its use. If I understand correctly, by default, it says that it preserves ligatures. As you can read in the attachment, it's quite an advanced tool.

First, if you do not have it yet,
Code:
sudo pip install fonttools
Then, prepare a work folder. We'll put here
- the ttf font (exported from the EPUB or downloaded from elsewhere), for example STSong.ttf
- a UTF-8 txt file named for example china.txt containing the characters (here Chinese) you wish to include in the subset. These characters can easily be copied for example from the last line of the Characters tab of the Calibre Editor reports tool.

To create the subset, just use this command

Code:
pyftsubset STSong.ttf --text-file=china.txt
It will create a subsetted font "STSong.subset.ttf" (12.9 k) with which you can replace the original one.

This way of creating a subset seems quite useful, for example if you have a book containing some words or expressions in some exotic language.

About ReadifyFont

Many thanks to Sherman Perry. Note that the GUI has been made clearer. You will find it here:
I used the GUI provided with the script. I could darken and generate ttf for a family of four fonts. The GUI was started with this command.
Code:
fontforge -script ReadifyFontGUI.py
Quote:
note that to add multiple font files, you have to add them at the same time (the file chooser dialog allows multiple selection). The current system is designed that if you click the load button again, it assumes you want to load a a new font family.
Attached Files
File Type: txt pyftsubset.txt (14.0 KB, 143 views)

Last edited by roger64; 10-29-2017 at 03:55 PM.
roger64 is offline   Reply With Quote
Advert
Old 10-28-2017, 06:33 AM   #3
sherman
Evangelist
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 461
Karma: 960559
Join Date: Aug 2008
Location: Auckland - NZ
Device: Sony PRS-505/SC, B&N Nook, Sony PRS-650/BC, Kobo Glo, Kobo Aura H2O
I must admit that I haven't exactly kept my little GUI up to date
The "latest" version can be found here: https://github.com/shermp/ReadifyFon...ceImprovements

Goodness knows how well it works. The FontForge folks seem to change/add to the python api as it suits them, and don't exactly keep the documentation up to date (at least it seems that way). They also can't seem to decide whether they want to use Python 2 or 3, which is even more annoying.

Fonttools would be great to use, but as roger64 noted, it is a very advanced tool, however documentation on how to use the thing is.... sparse.

Note with my tool, that it seems to have real trouble with the internal font naming for a lot of fonts, and I don't know why.
sherman is offline   Reply With Quote
Old 10-29-2017, 04:41 AM   #4
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
@sherman

Thanks for the link to the new revamped interface.

Using Arch I still face the following glitch: even if the four squares (for normal, italic, etc.) are displayed, I can load only one font on the top line. If I try to load a second one, it only erases the first one and takes its place.

If I judge from other calibre-debug comments, these troubles may be related to some missing gtk library (?).


Code:
[roger@anterg ReadifyFont-InterfaceImprovements]$ calibre-debug ReadifyFontGUI.py
QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries.
QCommonStyle::drawComplexControl: Control 1 not handled
QCommonStyle::drawComplexControl: Control 1 not handled
QCommonStyle::drawComplexControl: Control 1 not handled
QCommonStyle::drawComplexControl: Control 1 not handled
roger64 is offline   Reply With Quote
Old 10-29-2017, 05:54 AM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 52,296
Karma: 47192023
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Why are you subsetting in a rather difficult way? Calibre makes subsetting trivial. Also, Linux Libertine is not a nice font.
JSWolf is offline   Reply With Quote
Advert
Old 10-29-2017, 06:27 AM   #6
doubleshuffle
Flying Wheels
doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.
 
doubleshuffle's Avatar
 
Posts: 11,325
Karma: 105325899
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD
Quote:
Originally Posted by JSWolf View Post
Also, Linux Libertine is not a nice font.
That's a matter of taste, don't you think? I've been using Linux Libertine as my standard e-reading font for quite a while now and am still very happy with it.
doubleshuffle is offline   Reply With Quote
Old 10-29-2017, 07:09 AM   #7
sherman
Evangelist
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 461
Karma: 960559
Join Date: Aug 2008
Location: Auckland - NZ
Device: Sony PRS-505/SC, B&N Nook, Sony PRS-650/BC, Kobo Glo, Kobo Aura H2O
Quote:
Originally Posted by roger64 View Post
@sherman

Thanks for the link to the new revamped interface.

Using Arch I still face the following glitch: even if the four squares (for normal, italic, etc.) are displayed, I can load only one font on the top line. If I try to load a second one, it only erases the first one and takes its place.

If I judge from other calibre-debug comments, these troubles may be related to some missing gtk library (?).


Code:
[roger@anterg ReadifyFont-InterfaceImprovements]$ calibre-debug ReadifyFontGUI.py
QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries.
QCommonStyle::drawComplexControl: Control 1 not handled
QCommonStyle::drawComplexControl: Control 1 not handled
QCommonStyle::drawComplexControl: Control 1 not handled
QCommonStyle::drawComplexControl: Control 1 not handled
Note that the name of the branch is a bit deceptive, I had every intention of upgrading the interface, but nothing of note actually happened. That just happens to be the latest code base at the moment.

Also note that to add multiple font files, you have to add them at the same time (the file chooser dialog allows multiple selection). The current system is designed that if you click the load button again, it assumes you want to load a a new font family.

Last edited by sherman; 10-29-2017 at 07:14 AM.
sherman is offline   Reply With Quote
Old 10-29-2017, 07:34 AM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 52,296
Karma: 47192023
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
I would like to know why is anyone recommending using scripts and complicated ways to subset fonts when Calibre does it so easily?
JSWolf is offline   Reply With Quote
Old 10-29-2017, 01:29 PM   #9
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 1,644
Karma: 11766398
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 6/5/iPad 1,2 & Air/Surface Pro/Kindle PW
Perhaps they don't wish to use Calibre and are developing their own method??? That is a common practice among software developers.
Turtle91 is offline   Reply With Quote
Old 10-29-2017, 01:31 PM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 52,296
Karma: 47192023
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Quote:
Originally Posted by Turtle91 View Post
Perhaps they don't wish to use Calibre and are developing their own method??? That is a common practice among software developers.
But is it common to invent a square wheel?
JSWolf is offline   Reply With Quote
Old 10-29-2017, 01:37 PM   #11
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 4,377
Karma: 9575501
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, Kobo AuraHD/Aura6"/H2O/GloHD/KA1/ClaraHD
Quote:
Originally Posted by JSWolf View Post
But is it common to invent a square wheel?
It depends whether there is a Focus Group or other committee involved in the decision-making.
jackie_w is online now   Reply With Quote
Old 10-29-2017, 02:24 PM   #12
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 4,924
Karma: 5438866
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara,Kobo Aura One, XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by JSWolf View Post
But is it common to invent a square wheel?
It's not a square wheel if the only method involves much more software than you are interested in (install calibre only for subsettings fonts is like using a sledgehammer to crack a nut).

Quote:
Originally Posted by jackie_w View Post
It depends whether there is a Focus Group or other committee involved in the decision-making.
Terisa de morgan is offline   Reply With Quote
Old 10-29-2017, 02:49 PM   #13
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 52,296
Karma: 47192023
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Quote:
Originally Posted by Terisa de morgan View Post
It's not a square wheel if the only method involves much more software than you are interested in (install calibre only for subsettings fonts is like using a sledgehammer to crack a nut).
If you go back and reread the OP's message, you'll see Calibre is installed and is part of the process.

Quote:
Originally Posted by roger64 View Post
These darkened fonts have been subsetted with pyftsubset (a part of the fonttools project) against the list of characters named characters330 which contains the 110 unicode characters of the joint EPUB (the list is produced by the reports tool of the Calibre Editor). The subsets are in the folder: "C subsets."
The problem here is that Calibre's editor doesn't differentiate between regular, bold, italic, & bolditalic. So you don't get proper subsetting. You get get such by using the Calibre to do the subsetting.

So yes, it does seem to be inventing a square wheel.
JSWolf is offline   Reply With Quote
Old 10-29-2017, 03:49 PM   #14
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Quote:
Originally Posted by sherman View Post
Note that the name of the branch is a bit deceptive, I had every intention of upgrading the interface, but nothing of note actually happened. That just happens to be the latest code base at the moment.

Also note that to add multiple font files, you have to add them at the same time (the file chooser dialog allows multiple selection). The current system is designed that if you click the load button again, it assumes you want to load a a new font family.
Thank you for this answer. That was precisely my mistake. I can indeed select the whole family (four fonts together).

I edited the first two posts to include your comments about your new GUI and about selecting a family of four fonts.

Last edited by roger64; 10-29-2017 at 04:01 PM. Reason: comments
roger64 is offline   Reply With Quote
Old 10-29-2017, 05:10 PM   #15
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 10,452
Karma: 10563064
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by JSWolf View Post
But is it common to invent a square wheel?
Sure it is - especially when you want a bumpy night ride

BR
BetterRed is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with font subsetting grumbles Editor 17 06-20-2014 02:35 PM
Font subsetting problem yktan Calibre 5 09-19-2013 11:00 PM
Bug in font subsetting JSWolf Calibre 9 01-17-2013 09:46 AM
ePub Font Subsetting Cygfrydd ePub 2 08-17-2010 08:53 AM
Screen darkening over minutes Gogolo iRex 14 11-27-2007 04:37 PM


All times are GMT -4. The time now is 06:52 AM.


MobileRead.com is a privately owned, operated and funded community.