Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 09-27-2015, 04:37 AM   #1
sherman
Guru
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
[Script] Koboify Fonts

I wanted a quicker way of modifying fonts for use on my Kobo, so I decided to cook up a script this weekend.

I thought I would share this with you folks. Hopefully someone else may also get some use out of it.

Without further ado, may I present to you...

Koboify Fonts
Updated to v0.3.1
Fixes a major (and silly) issue with the batch file, and changes how the script should be called. See readme for details.

New! Workaround for font naming issue
Please see readme for more information

New! Now with included batch file for Windows 7/8/10 users
With the version update to 0.2, I have also included a fancy "Drag'n'Drop" batch file for Windows users. Please view the readme for usage instructions.

This is a script that takes one or more sub-families of a font (Regular, Italic, Bold, Bold Italic), performs some modifications using FontForge, and generates new TTF files.

It will rename the font, and you can chose to:
  • Remove PANOSE information
  • Remove Hinting
  • Add legacy kerning tables
  • Darken fonts, with an optional modification to glyph bearings

You can choose any one, or all of these tasks

It should be cross platform, but I have only tested it on Windows 10 64-bit

it is a Python script, however Python is NOT required to be installed. It is designed to be used with the FontForge embedded Python Interpreter. The only requirement is that FontForge must be installed.

Usage instructions are given in the readme, which I will duplicate at the end of this post.

I hope someone finds a use for this! If you have any suggestions or improvements, please let me know. I can't guarantee that I will spend a lot more time on this however.


Please not, I am not a developer. I don't program very often. Therefore this script will be buggy, not terribly efficient, and may not follow best python/coding practices...


Known Bugs:

None at the moment. I have created a workaround for the font naming issue as of version 0.3


Code:
Koboify Fonts by Sherman Perry

This is a script that takes one or more font files (of the same font family),
performs some modifications, and generates new TTF file(s). It uses FontForge
to perform the modifications.

It is provided AS-IS. This is very rough. I may or may not make improvements
in the future.
=========================================================================
CHANGELOG:
_0.3.1_2015-10-18_
- Fixed an error with the batch file where there was a problem if the path to
  the script file contained spaces.
- Changed how the script is called, from running "ffpython.exr" to 
  "fontforge.exe -script " 

_0.3_2015-09-29_
- Created a somewhat ugly workaround to handle fonts that will not rename
  properly. This is set in a new commandline option, [-n]
- Fixed a fairly major bug in the batch file--it would break if less than
  four files were dragged onto it.
- Moved font name processing to a seperate function

_0.2 2015-09-28_

Reworked a few internals, especially the layer curve type handling
Created a Drag'n'Drop batch file for Windows 7-10 users

_0.1_2015-09-27_
Initial release
=========================================================================
REQUIREMENTS:
FontForge must be installed on your system.
The script will not run using the system installed Python unless FontForge
was specifically compiled to allow this.

This script should now be called by using:
path/to/fontforge/fontforge(.exe) -script KoboifyFonts-0.3.1.py [OPTIONS]

FontForge is located (by default) in the following location on Windows 
64-bit systems:
"C:\Program Files (x86)\FontForgeBuilds\bin\fontforge.exe"

On Windows, the best way to run the script is to probably call it in a
batch file. As of version 0.2 I have created a batch file called 
'DragFontFilesHere.bat' Details on how to use this are below.

I reccommend running the script/batch in the same directory as the font
files you wish to convert.
=========================================================================
OSX INSTALLATION:

The following instructions were kindly provided by mobileread user 'GERGE':

Firstly, you can't use this by just installing FontForge from its page, you 
need command line version of FontForge. That version is much smaller 
(takes 30 MB or so) and needs to be compiled and installed with Homebrew. 
I am not going to explain to you how to use Homebrew, there are literally 
hundreds of guides out there. Just don't use HEAD version, brew install 
fonforge is the command you need to install it.

Secondly, you can't use it by internal Python of FontForge, you don't even 
have an internal Python. But OS X's own Python works perfectly well, just 
use versions of this command I used with EB Garamond:

python ./KoboifyFonts-0.3.py -r /Users/msimsek/Downloads/EBGaramond08-Regular.otf 
	-i /Users/msimsek/Downloads/EBGaramond08-Italic.otf -s -k -p -d . 'EB Garamond'
=========================================================================
USAGE: KoboifyFonts-0.3.1.py [-h] [-r REGULAR] [-i ITALIC] [-b BOLD]
                           [-B BOLDITALIC] [-s] [-k] [-d OUTPUTDIRECTORY]
                           [-w ADDWEIGHT] [-p] [-m] [-n]
                           fontname

positional arguments:
  fontname              Specify new font name

optional arguments:
  -h, --help            show this help message and exit
  -r REGULAR, --regular REGULAR
                        Regular font file
  -i ITALIC, --italic ITALIC
                        Italic font file
  -b BOLD, --bold BOLD  bold font file
  -B BOLDITALIC, --bolditalic BOLDITALIC
                        Bold Italic font file
  -s, --striphint       Strip hints from font
  -k, --legacykern      Include legacy kerning table
  -d OUTPUTDIRECTORY, --outputdirectory OUTPUTDIRECTORY
                        Output directory if set. Default is "./kobomodified/"
  -w ADDWEIGHT, --addweight ADDWEIGHT
                        Add weight to font. Values around 8-15 seems suitable.
                        50 is bold
  -p, --panosestrip     Strip PANOSE data from font
  -m, --modifybearings  Modify bearings when adding weight. This has no affect
                        when not adding weight. Only use it for subtle weight
                        changes
  -n, --namehack        If the fonts generated have internal names different
                        to what you specified, try this option to enable an
                        ugly workaround. It basically generates the font
                        twice.
============================================================================
USING INCLUDED BATCH FILE
-------------------------
The included batch file allows font files to be dragged onto it. The font files
should include anywhere in their filenames the following:
	regular
	bold
	italic
	bolditalic/bold italic/bold-italic etc.
This will tell the batch file how to feed the files to the python script.

When files are dragged onto the batch file, you will be asked a number of questions
about whether to enable the options (see above usage section).

Fonts will be generated in a 'koboified/' subdirectory where the original font
files are located.

The batch file is set to use the FontForge python binary 'ffpython.exe' in the
default FontForge installation directory. If FontForge is installed elsewhere,
you will need to change this in the batch file (variable %ffpythonpath%).

The batch file and the python script should be located in the same directory.
============================================================================
There has been stability issues observed with --modifybearings (Windows 10 x64). 

It seems to have happened more with longer output file paths

I have not determined the root cause of this, 
as the python interpreter crashes without 
providing a traceback
	This stability issue may be Windows related. 
Or (more likely) I've made a big mistake somewhere...
============================================================================
Attached Files
File Type: zip KoboifyFonts-v0.3.1.zip (6.8 KB, 1145 views)

Last edited by sherman; 10-17-2015 at 06:29 PM. Reason: Updated readme to include OSX installation/usage instructions
sherman is offline   Reply With Quote
Old 09-27-2015, 08:26 AM   #2
boriar
Evangelist
boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.boriar ought to be getting tired of karma fortunes by now.
 
boriar's Avatar
 
Posts: 407
Karma: 314204
Join Date: Jan 2015
Device: bq Avant XL, Kobo Aura H2O, Onyx Boox M96C Plus
Many thanks for your efforts. Very usefull for me.
boriar is offline   Reply With Quote
Old 09-27-2015, 11:19 AM   #3
dmapr
Evangelist
dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.
 
Posts: 469
Karma: 600816
Join Date: Sep 2009
Device: Kobo Aura HD, Kobo Aura One
This is what happened when I tried it on the Literata font:
Code:
"C:\Program Files (x86)\FontForgeBuilds\bin\ffpython.exe" KoboifyFonts-0.1.py -r Literata-Regular.otf -i Literata-Italic.otf -b Literata-Bold.otf -B Literata-BoldItalic.otf -s -k -p -d . Literata
This font contains both a 'kern' table and a 'GPOS' table.
  The 'kern' table will only be read if there is no 'kern' feature in 'GPOS'.
20

Saving Literata-Regular.ttf. . .

Internal Error: Attempt to output 2147483647 into a 16-bit field. It will be truncated and the file may not be useful.
Internal Error: Lookup sub table, 'kern' Horizontal Kerning lookup 0 per glyph data 0 in 'kern' Horizontal Kerning lookup 0, contains no data.
Internal Error: Lookup sub table, 'kern' Horizontal Kerning lookup 0 kerning class 1 in 'kern' Horizontal Kerning lookup 0, contains no data.
Internal Error: Lookup sub table, 'kern' Horizontal Kerning lookup 0 kerning class 2 in 'kern' Horizontal Kerning lookup 0, contains no data.
Internal Error: Lookup sub table, 'kern' Horizontal Kerning lookup 0 kerning class 3 in 'kern' Horizontal Kerning lookup 0, contains no data.
Internal Error: Lookup sub table, 'locl' Localized Forms in Latin lookup 0 subtable in 'locl' Localized Forms in Latin lookup 0, contains no data.
Internal Error: Lookup sub table, 'locl' Localized Forms in Latin lookup 1 subtable in 'locl' Localized Forms in Latin lookup 1, contains no data.
Internal Error: Lookup sub table, 'tnum' Tabular Numbers lookup 2 subtable in 'tnum' Tabular Numbers lookup 2, contains no data.
Internal Error: Lookup sub table, 'pnum' Proportional Numbers lookup 3 subtable in 'pnum' Proportional Numbers lookup 3, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 0 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 1 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 2 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 3 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 4 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 5 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 6 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 7 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 8 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 9 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 10 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 11 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 12 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 13 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 14 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 15 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 16 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 17 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 18 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 19 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 4 contextual 20 in 'frac' Diagonal Fractions lookup 4, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 5 subtable in 'frac' Diagonal Fractions lookup 5, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 6 subtable in 'frac' Diagonal Fractions lookup 6, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 7 subtable in 'frac' Diagonal Fractions lookup 7, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 8 subtable in 'frac' Diagonal Fractions lookup 8, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 9 subtable in 'frac' Diagonal Fractions lookup 9, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 10 subtable in 'frac' Diagonal Fractions lookup 10, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 11 subtable in 'frac' Diagonal Fractions lookup 11, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 12 subtable in 'frac' Diagonal Fractions lookup 12, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 13 subtable in 'frac' Diagonal Fractions lookup 13, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 14 subtable in 'frac' Diagonal Fractions lookup 14, contains no data.
Internal Error: Lookup sub table, 'frac' Diagonal Fractions lookup 15 subtable in 'frac' Diagonal Fractions lookup 15, contains no data.
Internal Error: Lookup sub table, 'sinf' Scientific Inferiors lookup 16 subtable in 'sinf' Scientific Inferiors lookup 16, contains no data.
Internal Error: Lookup sub table, 'sups' Superscript lookup 17 subtable in 'sups' Superscript lookup 17, contains no data.
Internal Error: Lookup sub table, 'numr' Numerators lookup 18 subtable in 'numr' Numerators lookup 18, contains no data.
Internal Error: Lookup sub table, 'dnom' Denominators lookup 19 subtable in 'dnom' Denominators lookup 19, contains no data.
Internal Error: Lookup sub table, 'ordn' Ordinals lookup 20 subtable in 'ordn' Ordinals lookup 20, contains no data.
Internal Error: Lookup sub table, 'liga' Standard Ligatures lookup 21 subtable in 'liga' Standard Ligatures lookup 21, contains no data.
Internal Error: Lookup sub table, Single Substitution lookup 22 subtable in Single Substitution lookup 22, contains no data.
Internal Error: Lookup sub table, Single Substitution lookup 23 subtable in Single Substitution lookup 23, contains no data.
Note: On Windows many apps can have problems with this font's kerning, because 2503 of its glyph kern pairs cannot be mapped to unicode-BMP kern pairs (eg, they have a Unicode value of -1) To avoid this, go to Generate, Options, and check the "Windows-compatible 'kern'" option.
Internal Error: File Offset wrong for ttf table (name-data), -1 expected 294
Save Failed
Traceback (most recent call last):
  File "..\..\KoboifyFonts-0.1\KoboifyFonts-0.1.py", line 160, in <module>
    f.generate(newValTTF, flags=flagsTTF)
EnvironmentError: Font generation failed
dmapr is offline   Reply With Quote
Old 09-27-2015, 05:11 PM   #4
sherman
Guru
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by dmapr View Post
This is what happened when I tried it on the Literata font:
What version of FontForge and Literata are you using?

I tried it with the version of Literata I have (1.001) and it works fine.

My FontForge version is 2015-08-04

Here's what I get when I run almost the same command as you:
Code:
C:\Users\sherm\Documents\Fonts\Literata\Original>"C:\Program Files (x86)\FontFor
geBuilds\bin\ffpython.exe" "C:\Users\sherm\OneDrive\Documents\Scripts\KoboifyFon
ts-0.1.py" -r literata.otf -i literata-italic.otf -b literata-bold.otf -B litera
ta-bold-italic.otf -s -k -p "Literata"
This font contains both a 'kern' table and a 'GPOS' table.
  The 'kern' table will only be read if there is no 'kern' feature in 'GPOS'.
30

Saving koboified\Literata-Regular.ttf. . .

Note: On Windows many apps can have problems with this font's kerning, because 2
527 of its glyph kern pairs cannot be mapped to unicode-BMP kern pairs (eg, they
 have a Unicode value of -1) To avoid this, go to Generate, Options, and check t
he "Windows-compatible 'kern'" option.
This font contains both a 'kern' table and a 'GPOS' table.
  The 'kern' table will only be read if there is no 'kern' feature in 'GPOS'.
27

Saving koboified\Literata-Bold.ttf. . .

Note: On Windows many apps can have problems with this font's kerning, because 2
393 of its glyph kern pairs cannot be mapped to unicode-BMP kern pairs (eg, they
 have a Unicode value of -1) To avoid this, go to Generate, Options, and check t
he "Windows-compatible 'kern'" option.
This font contains both a 'kern' table and a 'GPOS' table.
  The 'kern' table will only be read if there is no 'kern' feature in 'GPOS'.
29

Saving koboified\Literata-Italic.ttf. . .

Note: On Windows many apps can have problems with this font's kerning, because 2
936 of its glyph kern pairs cannot be mapped to unicode-BMP kern pairs (eg, they
 have a Unicode value of -1) To avoid this, go to Generate, Options, and check t
he "Windows-compatible 'kern'" option.
This font contains both a 'kern' table and a 'GPOS' table.
  The 'kern' table will only be read if there is no 'kern' feature in 'GPOS'.
33

Saving koboified\Literata-BoldItalic.ttf. . .

Note: On Windows many apps can have problems with this font's kerning, because 2
691 of its glyph kern pairs cannot be mapped to unicode-BMP kern pairs (eg, they
 have a Unicode value of -1) To avoid this, go to Generate, Options, and check t
he "Windows-compatible 'kern'" option.

C:\Users\sherm\Documents\Fonts\Literata\Original>pause
Press any key to continue . . .
sherman is offline   Reply With Quote
Old 09-28-2015, 01:03 AM   #5
GERGE
Guru
GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.
 
Posts: 732
Karma: 5797160
Join Date: Jun 2010
Location: Istanbul
Device: Kobo Libra
Don't use this twice on the same font file, if added weight is too small or too much just start from the beginning. Adding weight twice sometimes damages glyphs too much.
GERGE is offline   Reply With Quote
Old 09-28-2015, 01:14 AM   #6
sherman
Guru
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by GERGE View Post
Don't use this twice on the same font file, if added weight is too small or too much just start from the beginning. Adding weight twice sometimes damages glyphs too much.
Are you saying not to use the generated font files as further input? If so, I agree with this.

Using the original files as input should always generate new files.
...unless fontforge.font.save() does something silly like modifying existing files, rather than overwrite them. The documentation doesn't state either way
sherman is offline   Reply With Quote
Old 09-28-2015, 02:53 AM   #7
sherman
Guru
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
New! Version 0.2. Now with fancy barch

Presenting Version 0.2 with fancy batch file

I've updated a few internals in the main python script, mainly to do with layer processing. There is no change to how the script should be used.


I've decided to make my (and hopefully others...) life easier by including a "Drag'n'Drop" enabled batch file to easily add fonts for processing.

See the first post and/or readme for usage instructions.

First post has been updated with the new version.
sherman is offline   Reply With Quote
Old 09-28-2015, 11:36 PM   #8
sherman
Guru
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Version 0.3 released

New version

First post has been updated with the latest version

This is a bugfix release mainly. I've created a workaround for the font naming issue that could occur with some fonts (not all!).

There was also a major issue with the batch file which I've corrected.


For those interested in the workaround, I have added an option that when enabled, the script will reopen the generated TTF file, rename the font, then generate a new TTF. It's an inelegant workaround at best, and I'm not all that happy with it, but unless the cause of the bug can be tracked down, there's not a lot I can think of to do better.

The problem seems to lie in the fontforge provided font.appendSFNTName() method. It simply isn't appending/replacing data like it should in some fonts.
sherman is offline   Reply With Quote
Old 09-29-2015, 06:01 AM   #9
vandafc
Connoisseur
vandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texanvandafc might easily be mistaken for a Texan
 
vandafc's Avatar
 
Posts: 97
Karma: 18420
Join Date: Feb 2013
Location: Brussels, Belgium
Device: Kobo Aura One, Kobo Glo, Kindle 3
would be great if you also share some of your 'cleaned' fonts for Kobo with the community
vandafc is offline   Reply With Quote
Old 09-29-2015, 08:53 AM   #10
dmapr
Evangelist
dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.
 
Posts: 469
Karma: 600816
Join Date: Sep 2009
Device: Kobo Aura HD, Kobo Aura One
Quote:
Originally Posted by sherman View Post
What version of FontForge and Literata are you using?

I tried it with the version of Literata I have (1.001) and it works fine.

My FontForge version is 2015-08-04
Thanks! It was the older FontForge version that was causing me trouble.
dmapr is offline   Reply With Quote
Old 09-29-2015, 09:41 AM   #11
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,166
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Quote:
Originally Posted by vandafc View Post
would be great if you also share some of your 'cleaned' fonts for Kobo with the community
One has to be careful with this; it would depend to a large degree on the licensing of the original font as to whether or not one can redistribute a modified version of the font.
PeterT is offline   Reply With Quote
Old 09-29-2015, 01:04 PM   #12
GERGE
Guru
GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.
 
Posts: 732
Karma: 5797160
Join Date: Jun 2010
Location: Istanbul
Device: Kobo Libra
Here is one: Unbelievably gorgeous EB Garamond, quite possibly the best open-source typeface: http://drop.muratcansimsek.com/EBGaramond.zip

But there is something more you should add to the readme, here are the instructions to use this on OS X:

Firstly, you can't use this by just installing FontForge from its page, you need command line version of FontForge. That version is much smaller (takes 30 MB or so) and needs to be compiled and installed with Homebrew. I am not going to explain to you how to use Homebrew, there are literally hundreds of guides out there. Just don't use HEAD version, brew install fonforge is the command you need to install it.

Secondly, you can't use it by internal Python of FontForge, you don't even have an internal Python. But OS X's own Python works perfectly well, just use versions of this command I used with EB Garamond:

Code:
python ./KoboifyFonts-0.3.py -r /Users/msimsek/Downloads/EBGaramond08-Regular.otf -i /Users/msimsek/Downloads/EBGaramond08-Italic.otf -s -k -p -d . 'EB Garamond'
GERGE is offline   Reply With Quote
Old 09-29-2015, 04:21 PM   #13
sherman
Guru
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by GERGE View Post
Here is one: Unbelievably gorgeous EB Garamond, quite possibly the best open-source typeface: http://drop.muratcansimsek.com/EBGaramond.zip

But there is something more you should add to the readme, here are the instructions to use this on OS X:

Firstly, you can't use this by just installing FontForge from its page, you need command line version of FontForge. That version is much smaller (takes 30 MB or so) and needs to be compiled and installed with Homebrew. I am not going to explain to you how to use Homebrew, there are literally hundreds of guides out there. Just don't use HEAD version, brew install fonforge is the command you need to install it.

Secondly, you can't use it by internal Python of FontForge, you don't even have an internal Python. But OS X's own Python works perfectly well, just use versions of this command I used with EB Garamond:

Code:
python ./KoboifyFonts-0.3.py -r /Users/msimsek/Downloads/EBGaramond08-Regular.otf -i /Users/msimsek/Downloads/EBGaramond08-Italic.otf -s -k -p -d . 'EB Garamond'
Thanks. I have updated the readme in the zip file, and the first post with these instruction.

My problem with EB Garamond is the lack of bold and bold italic variants. I personally prefer a complete font set on my reader.
sherman is offline   Reply With Quote
Old 09-29-2015, 04:45 PM   #14
sherman
Guru
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by vandafc View Post
would be great if you also share some of your 'cleaned' fonts for Kobo with the community
As PeterT said, I don't particularly want to do this due to licensing issues. Even fonts licensed under the SIL open font license have certain conditions that must be met regarding font naming, and copyright notices etc.

This tool is not really set up to properly handle the licensing side of things.'

The purpose of this script was to make it (hopefully) simple and (hopefully) quick to modify fonts for your own personal use, without having to delve into the....unusual... FontForge interface, or buy (or otherwise... obtain) commercial font software.
sherman is offline   Reply With Quote
Old 09-30-2015, 01:18 AM   #15
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,391
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by sherman View Post
without having to delve into the....unusual... FontForge interface
Ahhh... a believer in kind words.
DNSB is online now   Reply With Quote
Reply

Tags
font


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add alternate fonts without replacing system fonts.(this time this is a guide) techiemonkey Kindle Developer's Corner 17 09-12-2012 04:55 PM
An Observation on Fonts - Improving readability by using *bold* versions of fonts nesler General Discussions 12 06-24-2012 12:33 PM
need the fonts in /usr/java/lib/fonts of kindle touch5.0.0 hanpal Kindle Developer's Corner 1 02-20-2012 10:40 AM
Troubleshooting need the fonts in /usr/java/lib/fonts of kindle touch5.0.0 hanpal Amazon Kindle 0 02-20-2012 08:51 AM
Touch Fonts question (special characters in stock and custom fonts) levil Kobo Reader 20 09-23-2011 01:51 PM


All times are GMT -4. The time now is 03:25 PM.


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