View Full Version : How to change the line spacing of a font
IceHand 03-29-2008, 06:16 PM The line spacing on the Cybook is determined by the currently used font's metrics. The following how-to was made by trial-and-error, as I don't have much knowledge about font metrics.
In the examples I'm going to show, I used the free font Bitstream Vera Sans (Vera.ttf) (http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/ttf-bitstream-vera-1.10.zip).
First download and install FontForge (http://fontforge.sourceforge.net/).
Start FontForge and open the font you want to edit. You should see something that looks like this:
http://sunedonath.de/misc/cybook_line_spacing01.png
Click on "Element" then "Font Info..." or press Ctrl+Shift+F.
Now select "OS/2" on the left side of the Font Information and then the "Metrics" tab on the right side.
Set all numbers to zero in the metrics fields, but don't uncheck the "Is Offset" boxes.
Now comes the tricky part: Depending on the font you'll need to experiment a little to get the line spacing right.
"HHead Ascent Offset" should be a negative number in most cases around -100 to -200 (the lower the value the smaller the line spacing).
"HHead Descent Offset" should be a positive number in most cases around 100 to 200 (the higher the value the smaller the line spacing).
You can make an educated guess by looking at the character size, Vera Sans for example is very large and needs some line spacing. I think HHead Ascent Offset -100 and HHead Descent Offset 100 look nice:
http://sunedonath.de/misc/cybook_line_spacing02.png
Most Serif fonts have smaller characters and would probably need something like -200 and 200.
Now click OK and select "File" -> "Generate Fonts...". The font type should be TrueType or OpenType (CFF), both formats will work fine on the Cybook.
Click "Save" and ignore any error messages or uncheck "Validate Before Saving" before saving.
http://sunedonath.de/misc/cybook_line_spacing03.png
Copy the saved font to the Cybook and check if the line spacing looks right now. If not, try other values for "HHead Ascent Offset" and/or "HHead Descent Offset".
When the line spacing is looking good, remember the values for "HHead Ascent Offset" and "HHead Descent Offset" and repeat the procedure described above with the Italic, Bold and Bold-Italic version of the font.
Boeboe 03-29-2008, 08:13 PM Do you have pictures with the result? Or either the adapted font ready for download, so we can see it/test it without having to install this extra software :)
IceHand 03-30-2008, 05:30 AM My camera's batteries are charging right now, so I can't offer screenshots at the moment, but I attached the adapted font. You can compare it to the original font, which I linked to above.
DDHarriman 03-30-2008, 02:43 PM IceHand
Outstanding work and tutorial.
I have just downloaded the font you have put here and it does give me 3 more lines then Verdana in the same eBook and same font size (24 lines with Verdana against 27 with your font!)
Note: the font size being the 3th in size from the 12 we have available in the Cybook.
One more info - this font shows my country diacritics (ã, ç, á, etc…) without a problem.
Best regards,
Thankyou!
I've just switched over to that font and it's clear and readable, and the line spacing is miles better than Verdana. So much so I'm now thinking Verdana is crap and I'm wondering how Bookeen allowed the Cybook to ship without a good font :)
delphidb96 03-30-2008, 06:16 PM My camera's batteries are charging right now, so I can't offer screenshots at the moment, but I attached the adapted font. You can compare it to the original font, which I linked to above.
LOVE your tutorial. Just one *SMALL* problem. I can't get Cygwin to properly install on my machine (about as plain-vanilla a Windows XP version as one can get with an HP Pavilion (Pentium D)) so that means I can't get FontForge to install, either. :(
As I prefer Book Antiqua, Berling Antiqua and Georgia, I guess I'll just have to suffer quietly. :(
Derek
IceHand 03-31-2008, 06:32 AM Derek, you've got mail.
Here are two screenshots showing Book Antiqua before and after I changed the line spacing. I used the values -400 and 400.
EDIT: Made better screenshots, still Book Antiqua before and after though.
Hadrien 03-31-2008, 08:35 AM Derek, you've got mail.
Here are two screenshots showing Book Antiqua before and after I changed the line spacing. I used the values -400 and 400.
Impressive !
It looks MUCH better with this custom font.
JSWolf 03-31-2008, 09:12 AM I have to agree. Looks quite a bit better. Also makes it more readable. Plus I like that you've gone from 17 lines to 21 lines. Less pages per book and less page turns equals more battery life.
delphidb96 03-31-2008, 10:21 AM I have to agree. Looks quite a bit better. Also makes it more readable. Plus I like that you've gone from 17 lines to 21 lines. Less pages per book and less page turns equals more battery life.
Yes! I suppose if I could figure out how to make FontCreator do the same thing, I'd have used that, but I found out the hard way that FontCreator has as steep a learning curve as Photoshop - and given that I'm not going to be using it for more than a handful of fonts, it just doesn't make sense to do so. (Except for the niggling little detail that I can't seem to get all the right things to install with Cygwin to make FontForge work on my machine. :( )
Oh well. Maybe someone can start up a line of freeware fonts optimized for the Cybook and other ereaders.
Derek
wallcraft 03-31-2008, 10:38 AM Is there a way to produce larger fonts in Cybook's Reader via FontForge? The current maximum size is about 24pt, which is not large enough for everyone - see Does the new CyBook support ultra-large fonts (>72 points)? (http://www.mobileread.com/forums/showthread.php?t=22376).
Like line spacing, this would be better handled by the reader software internally. And adding larger font sizes to the reader is probably easier for Bookeen to do than adding a user-specified line spacing. Even so, I think a double size (say) font would be an interesting demonstration.
tompe 03-31-2008, 10:42 AM Impressive !
It looks MUCH better with this custom font.
I thought it might be harder to read. With the modified font the word spacing can visually be greater than the line spacing and that can lead to mistake in reading. And it looks strange.
delphidb96 03-31-2008, 10:44 AM Is there a way to produce larger fonts in Cybook's Reader via FontForge? The current maximum size is about 24pt, which is not large enough for everyone - see Does the new CyBook support ultra-large fonts (>72 points)? (http://www.mobileread.com/forums/showthread.php?t=22376).
Like line spacing, this would be better handled by the reader software internally. And adding larger font sizes to the reader is probably easier for Bookeen to do than adding a user-specified line spacing. Even so, I think a double size (say) font would be an interesting demonstration.
I imagine one could make a TrueType font that starts with 18pt and goes to 36pt or even 48pt. Someone may have to try that - and as I'm not a font guru, my imagination may well be completely out of sync with how TrueType works.
GeoffC 03-31-2008, 10:50 AM An absolutely stupid ,
ridiculous ,
' bad '
question ,
but can one " pinch " fonts from MS Windows , and use them ???? :p
wallcraft 03-31-2008, 11:00 AM I imagine one could make a TrueType font that starts with 18pt and goes to 36pt or even 48pt. TrueType fonts can (always?) render whatever size you want. The trick here is for the Cybook to select 24pt but actually get back 48pt. There are lots of reasons why this might not work, but perhaps there is a way to make it happen.
delphidb96 03-31-2008, 11:02 AM TrueType fonts can (always?) render whatever size you want. The trick here is for the Cybook to select 24pt but actually get back 48pt. There are lots of reasons why this might not work, but perhaps there is a way to make it happen.
Then someone (Hint! Hint, Hint! Bookeen!) should do so! :D :D :D
Derek
wallcraft 03-31-2008, 11:04 AM can one " pinch " fonts from MS Windows , and use them ? Yes. In the case of the "core" fonts, this is even legal.
HarryT 03-31-2008, 11:04 AM TrueType fonts can (always?) render whatever size you want. The trick here is for the Cybook to select 24pt but actually get back 48pt. There are lots of reasons why this might not work, but perhaps there is a way to make it happen.
In the font header (which you should be able to edit with any font editor) there's a value which defines the mapping from points to pixels. If you increase that value (so you get more pixels per point) you'll get bigger characters for a given point size.
IceHand 03-31-2008, 12:29 PM In the font header (which you should be able to edit with any font editor) there's a value which defines the mapping from points to pixels. If you increase that value (so you get more pixels per point) you'll get bigger characters for a given point size.There is? I can't find it. The only thing I'm able find is a mapping from points to pixels for bitmap strikes (http://fontforge.sourceforge.net/editexample8.html). As far as I know the pixel size of a font is determined by the dpi setting of the display (~166 on the Cybook), not by the the font header.
Please prove me wrong though, if I'm wrong ;)
IceHand 04-01-2008, 07:12 AM Is there a way to produce larger fonts in Cybook's Reader via FontForge? The current maximum size is about 24pt, which is not large enough for everyone - see Does the new CyBook support ultra-large fonts (>72 points)? (http://www.mobileread.com/forums/showthread.php?t=22376).To answer your question directly: I don't think there is. Technically it's certainly possible to render any TrueType/OpenType font at whatever size you want, but the size is determined by the software configuration not the font itself.
Maybe someone can start up a line of freeware fonts optimized for the CybookThat's a good idea. I think, I might do just that in the next few days ... maybe.
Mikeyboards 06-29-2008, 03:05 PM ... I attached the adapted font. You can compare it to the original font, which I linked to above.
Thank you so much for posting those fonts in a downloadable format! I just put them in my Fonts folder, and now I have more lines per page, while losing nothing in readability.
If anyone else would be willing to offer the results of their font-tweaking, I'm sure many of us would be grateful for the offering!
(It's not that I'm too lazy to do the tweaking myself; it's just that I'm already spending so many hours testing and tweaking other aspects of the Cybook, as so many of us are. So the more we can save each other time-consuming steps, the more time we can all spend reading :) )
IceHand 06-30-2008, 05:07 AM The problem is probably that most people use copyrighted fonts and thus are unable to upload their tweaked fonts – legally that is. I would gladly upload my tweaked favourite font (Underware's Dolly), but I can't. Even uploading the standard Microsoft fonts would be illegal.
However there are a few good free fonts which could be tweaked and uploaded. I'm thinking of some of the URW fonts (ftp://ftp.fu-berlin.de/tex/CTAN/nonfree/support/ghostscript/AFPL/GhostPCL/urwfonts-1.41.tar.bz2) (especially Palladio) and Charis SIL (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=CharisSIL_download#1fd0063a). I may look into it.
tompe 06-30-2008, 06:01 AM The problem is probably that most people use copyrighted fonts and thus are unable to upload their tweaked fonts – legally that is. I would gladly upload my tweaked favourite font (Underware's Dolly), but I can't. Even uploading the standard Microsoft fonts would be illegal.
However there are a few good free fonts which could be tweaked and uploaded. I'm thinking of some of the URW fonts (ftp://ftp.fu-berlin.de/tex/CTAN/nonfree/support/ghostscript/AFPL/GhostPCL/urwfonts-1.41.tar.bz2) (especially Palladio) and Charis SIL (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=CharisSIL_download#1fd0063a). I may look into it.
You could probably distribute a program that modified the fonts...
|