View Full Version : How do I turn off ligatures in ADE?


JSWolf
01-16-2013, 01:32 PM
In the new ADE 2.0, it takes characters such as fl, fi, ff and converts them to ligatures. How do I tell ADE not to do this? The problem is that if the font in use does not have ligatures, the ligatures come out as space.

Jellby
01-16-2013, 02:04 PM
If that's its behaviour, it's a severe bug.

It should only use ligatures if they are defined in the font (and that is indeed what happens in my reader). So, either ADE 2.0 is broken or the font is broken (i.e. it defines a ligature that it doesn't really have). Is the font maybe a subset? In that case the subsetting software is probably breaking the font.

I don't know if you can disable ligatures in ADE, probably not (I believe the Cybook Odyssey allows that, though). You could prevent ligatures by inserting zero-width-no-break spaces (whatever the code is) between the letters... but that's an UGLY hack for this use.

JSWolf
01-16-2013, 02:08 PM
Currently Calibre's subsetting doesn't take into account reading software that makes ligatures and if the ligatures are not already in the text, the ligatures are gone. So when ADE 2.0 renders the ligatures, you get space instead of the ligatures.

I have reported this, but for now, I'd like to fix some eBooks that I've already subsetted.

DiapDealer
01-16-2013, 04:21 PM
Isn't calibre's font-subsetting feature still considered experimental?

JSWolf
01-16-2013, 08:24 PM
Isn't calibre's font-subsetting feature still considered experimental?

I have no idea. Other then this ligature issue, it's working fine.

AlexBell
01-17-2013, 01:56 AM
I'm sorry, I may be missing something. Surely the easiest way would be to go into the html and remove the ligature? & a e lig; or &# 230 shows as the , the a e ligature. Taking that out and putting an a and an e removes the ligature.

I've put spaces in above so the markup will show.

Toxaris
01-17-2013, 02:14 AM
You just took the wrong ligature. The is actually something different than ae. The sound is different. What is being meant here, I think, that if in the text there is for example 'fi' that ADE wants to use the ligature for that. However, if you use your own fonts and have subsetted this (so, removed all the characters you don't use), it will not display the ligature since it is not in the font.

Oh, and the feature in Calibre is still experimental.

Doitsu
01-17-2013, 04:18 AM
Most likely Calbre's font subsetting feature messed with the font's ligatures table. I just did a quick test and didn't notice any problems with ligatures in embedded fonts.

If you must use your subset font with ADE 2.0, you can suppress ligatures by inserting a Zero-width non-joiner (http://en.wikipedia.org/wiki/Zero_width_non_joiner) (*) between f and i, f and l etc.

Jellby
01-17-2013, 05:11 AM
Currently Calibre's subsetting doesn't take into account reading software that makes ligatures and if the ligatures are not already in the text, the ligatures are gone.

That shouldn't cause the problem you are seeing, unless it doesn't remove the ligature table; i.e., if the font file is left with a table indicating that the combination "f + j" should use the glyph name "fj.lig", but the "fj.lig" glyph is undefined or blank. A good subsetting should either keep or remove both together, the table and the glyph (a better subsetting should keep both only if "f" and "j" are also included in the subset).

dgatwood
01-17-2013, 05:38 PM
I don't know what's wrong with the font, but it makes the FDK's ttxn tool crash, which probably isn't good.

macbookpro:osx dg$ ./ttxn /Users/dg/Downloads/ex/OEBPS/Fonts/DejaVuLGCSerif-Italic.ttf
Dumping "/Users/dg/Downloads/ex/OEBPS/Fonts/DejaVuLGCSerif-Italic.ttf" to "/Users/dg/Downloads/ex/OEBPS/Fonts/DejaVuLGCSerif-Italic#1.ttx"...
Dumping 'FFTM' table...
Dumping 'GDEF' table...
Dumping 'OS/2' table...
Dumping 'cmap' table...
Dumping 'cvt ' table...
Dumping 'fpgm' table...
Dumping 'gasp' table...
Dumping 'head' table...
Dumping 'hhea' table...
Dumping 'hmtx' table...
Dumping 'kern' table...
Dumping 'loca' table...
Dumping 'maxp' table...
Dumping 'name' table...
Dumping 'post' table...
Dumping 'prep' table...
Dumping 'GSUB' table ...
Dumping 'GPOS' table ...
Dumping 'glyf' table ...
Traceback (most recent call last):
File "./../SharedData/FDKScripts/ttxn.py", line 2185, in <module>
run(sys.argv[1:])
File "./../SharedData/FDKScripts/ttxn.py", line 2177, in run
ttf = ttnDump(input, output, options, showExtensionFlag, supressHints, supressVersions)
File "./../SharedData/FDKScripts/ttxn.py", line 2131, in ttnDump
dumpFont(writer, input, supressHints)
File "./../SharedData/FDKScripts/ttxn.py", line 1954, in dumpFont
dictTxt = shellcmd(["tx", "-dump", "-0", fontPath])
File "./../SharedData/FDKScripts/ttxn.py", line 1944, in shellcmd
p = subprocess.Popen(cmdList,stdout=tempFile, stderr=subprocess.STDOUT)
File "/Users/dg/Downloads/FDK/Tools/osx/Python/Current/lib/python2.7/subprocess.py", line 672, in __init__
errread, errwrite)
File "/Users/dg/Downloads/FDK/Tools/osx/Python/Current/lib/python2.7/subprocess.py", line 1202, in _execute_child
raise child_exception



From the partial output, though:

<map code="0xfb02" name="fl"/>

in various CMAP tables and

<ClassDef glyph="fl" class="2"/>


in the GlyphClassDef. And there's an entry in the horizontal metrics table, too. And when I open it in Fontographer, I can see the "fl" glyph.

Is the attached file perhaps the original?

[Edit: Never mind. That sample was from a different poster. Still, there's something dubious about that font. :)]

JSWolf
01-17-2013, 07:43 PM
That shouldn't cause the problem you are seeing, unless it doesn't remove the ligature table; i.e., if the font file is left with a table indicating that the combination "f + j" should use the glyph name "fj.lig", but the "fj.lig" glyph is undefined or blank. A good subsetting should either keep or remove both together, the table and the glyph (a better subsetting should keep both only if "f" and "j" are also included in the subset).

I know Calibre blanks out the characters not in use. I believe the table entry is still there as when the ligature is missing, and it's trying to be used, you get space instead of a character.

Toxaris
01-18-2013, 03:16 AM
I am working on an program that can subset a font. I hope to have a first draft available after this weekend. It will not automatically read an ePUB, you either have to enter the characters (doubles will be filtered) or character sets (uppercase, lowercase, typography, etc)).
If it works, I will post it here somewhere.

Jellby
01-18-2013, 05:52 AM
I know Calibre blanks out the characters not in use. I believe the table entry is still there as when the ligature is missing, and it's trying to be used, you get space instead of a character.

OK, so this does not help for your original answer, but I'd say that's a calibre bug. Have you (or anyone else) reported it?

As a hackish workaround, you could edit the font with FontForge (for instance) and delete the ligatures table (and variants, and others if present).

JSWolf
01-18-2013, 03:37 PM
I am working on an program that can subset a font. I hope to have a first draft available after this weekend. It will not automatically read an ePUB, you either have to enter the characters (doubles will be filtered) or character sets (uppercase, lowercase, typography, etc)).
If it works, I will post it here somewhere.

Will it eventually read an ePub and subset the embedded fonts?

JSWolf
01-18-2013, 03:38 PM
OK, so this does not help for your original answer, but I'd say that's a calibre bug. Have you (or anyone else) reported it?

As a hackish workaround, you could edit the font with FontForge (for instance) and delete the ligatures table (and variants, and others if present).

I did report it and the problem has been fixed as of today's Calibre update. :2thumbsup

Toxaris
01-18-2013, 05:10 PM
Will it eventually read an ePub and subset the embedded fonts?

Perhaps. It would require quite some effort, especially if the character determination would only contain characters that are in use for that specific font.
For now the input window should be big enough to contain a whole book and determine the unique characters. Even with a big book, this should go quite fast.

It is sufficient for my needs at the moment. I will post it in the Workshop part of the forum.