mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Hack for subsetting commonly used ligatures, pending proper parsing of the GSUB table
This commit is contained in:
parent
bd9fd5485b
commit
891f362385
@ -76,6 +76,17 @@ def subset(raw, individual_chars, ranges=()):
|
||||
for r in ranges:
|
||||
chars += list(xrange(ord(r[0]), ord(r[1])+1))
|
||||
|
||||
# Hack pending parsing of the GSUB table, manually add in a few common
|
||||
# ligatures
|
||||
ligatures = {'AE':'Æ', 'ae':'æ', 'OE':'Œ', 'IJ':'IJ', 'ij':'ij', 'ue':'ᵫ',
|
||||
'ff':'ff', 'fi':'fi', 'fl':'fl', 'ffi':'ffi', 'ffl':'ffl', 'st':'st'}
|
||||
all_chars = set(chars)
|
||||
for ichars, lig in ligatures.iteritems():
|
||||
ichars = frozenset(map(ord, ichars))
|
||||
if ichars.issubset(all_chars) and ord(lig) not in all_chars:
|
||||
all_chars.add(ord(lig))
|
||||
chars.append(ord(lig))
|
||||
|
||||
sfnt = Sfnt(raw)
|
||||
old_sizes = sfnt.sizes()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user