Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 12-28-2019, 04:41 AM   #1
Vroni
Banned
Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'
 
Posts: 168
Karma: 10010
Join Date: Oct 2018
Device: Tolino/PRS 650/Tablet
bk.font_iter() is listing no fonts

Hi,

what am i doing wrong?

Code:
def run(bk):
    print('xxx-|Start|-xxx')
    for (id, href, mime) in bk.font_iter():
        print('xxx-|',id , '|-xxx')
        print('xxx-|',href , '|-xxx')
        print('xxx-|',mime , '|-xxx')
   
    print('xxx-|End|-xxx')

    return 0
i am getting no fonts listet

mac os mojave, sigil 1.0.0

The fonts i have in the book are valid as they do show up in preview, in ADE and on my devices.

Regardless of what fonts i'm adding the list is always empty
Vroni is offline   Reply With Quote
Old 12-28-2019, 07:10 AM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,587
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Vroni View Post
what am i doing wrong?
bk.font_iter() might fail, if the fonts don't have the proper mime type.

Please post the font manifest section of your test epub. For example,

Code:
<item id="LinLibertineG30-Regular.ttf" href="LinLibertineG30-Regular.ttf" media-type="application/vnd.ms-opentype"/>
The following quick & dirty version will also work with fonts that have the wrong mime type:

Code:
def run(bk):
    print('xxx-|Start|-xxx')
    for id, href, mime in bk.manifest_iter():
        if href.endswith('tf'):
            print('xxx-|',id , '|-xxx')
            print('xxx-|',href , '|-xxx')
            print('xxx-|',mime , '|-xxx')
    print('xxx-|End|-xxx')
Doitsu is offline   Reply With Quote
Old 12-28-2019, 07:42 AM   #3
Vroni
Banned
Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'Vroni knows the difference between 'who' and 'whom'
 
Posts: 168
Karma: 10010
Join Date: Oct 2018
Device: Tolino/PRS 650/Tablet
Hi,

i added the file with sigil and the original item looks like this

Code:
<item id="SourceCodePro-Regular.otf" href="Fonts/SourceCodePro-Regular.otf" media-type="font/otf"/>
Flightcrew is complaining that the mimetype isnt correct, changing it to the suggest value

Code:
<item id="SourceCodePro-Regular.otf" href="Fonts/SourceCodePro-Regular.otf" media-type="application/vnd.ms-opentype"/>
is fixing my "problem" with bk.font_iter()

So is this a bug in sigil not choosing the right mimetype? As i said, i added the fontfile with sigil.
Attached Files
File Type: epub testfont.epub (100.8 KB, 188 views)
Vroni is offline   Reply With Quote
Old 12-28-2019, 09:27 AM   #4
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,587
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Vroni View Post
So is this a bug in sigil not choosing the right mimetype?
According to the IANA, the following font mime types can be used:

otf font/otf
sfnt font/sfnt
ttf font/ttf
woff font/woff
woff2 font/woff2

According to the epub3 specs, the following mime types are also acceptable:

ttf application/font-sfnt
otf application/vnd.ms-opentype
woff application/font-woff

I.e., font/otf is definitely a valid mime type. Maybe bk.font_iter() needs to be updated.
Doitsu is offline   Reply With Quote
Old 12-28-2019, 09:47 AM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,676
Karma: 5433388
Join Date: Nov 2009
Device: many
Yes, this is a bug as I updated the media-types based on the latest iana spec which icludes the new font/* style recommended media types:

Here is the updated list of recognized font media types:

Code:
    'font/woff2'                              : 'Fonts',
    'font/woff'                               : 'Fonts',
    'font/ttf'                                : 'Fonts',
    'font/otf'                                : 'Fonts',
    'font/sfnt'                               : 'Fonts',
    'font/collection'                         : 'Fonts',
    'application/vnd.ms-opentype'             : 'Fonts',
    'application/font-sfnt'                   : 'Fonts',  # deprecated
    'application/font-ttf'                    : 'Fonts',  # deprecated
    'application/font-otf'                    : 'Fonts',  # deprecated
    'application/font-woff'                   : 'Fonts',  # deprecated
    'application/font-woff2'                  : 'Fonts',  # deprecated
    'application/x-font-ttf'                  : 'Fonts',  # deprecated
    'application/x-truetype-font'             : 'Fonts',  # deprecated
    'application/x-opentype-font'             : 'Fonts',  # deprecated
    'application/x-font-ttf'                  : 'Fonts',  # deprecated
    'application/x-font-otf'                  : 'Fonts',  # deprecated
    'application/x-font-opentype'             : 'Fonts',  # deprecated
    'application/x-font-truetype'             : 'Fonts',  # deprecated
    'application/x-font-truetype-collection'  : 'Fonts',  # deprecated
But I forgot to fix the code in the bk.font_iter() to match that expanded list:

Code:
    def font_iter(self):
        # yields manifest id, href, and mimetype
        for id in sorted(self._w.id_to_mime):
            mime = self._w.id_to_mime[id]
            if mime.find('font-') > -1 or mime.endswith('-ttf') or mime.endswith('truetype') or mime.endswith('opentype'):
                href = self._w.id_to_href[id]
                yield id, href, mime
So this code needs to be updated to include the new font/* media types.

Kevin

I will push a fix for this to master today.

Kevin
KevinH is offline   Reply With Quote
Old 12-28-2019, 03:42 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,676
Karma: 5433388
Join Date: Nov 2009
Device: many
This should now be fixed in master.
Thanks for your bug report.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Library Listing? historybuff3737 Library Management 2 12-24-2017 04:30 AM
Touch Double listing.... kevenv Kobo Reader 2 01-26-2013 06:15 AM
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
Author listing ? carpetmojo Sony Reader 1 02-20-2011 07:00 PM
Need help with library listing geko Calibre 2 06-29-2010 03:10 PM


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


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