Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-03-2015, 01:22 PM   #1
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
Create a CSS-file from fonts

Hi,

i created a very very simple plugin. It just iterates through the font files and creates a StyleFont.css file in the book.

Last edited by rubeus; 03-30-2016 at 04:27 AM.
rubeus is offline   Reply With Quote
Old 05-03-2015, 02:05 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 20,010
Karma: 103834338
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Cool. I added your plugin to the sticky list of plugins. Thanks for contributing.

I don't know much about fonts/fontfiles in general, but it does seem like the most straightforward way to manipulate/query font files in Python is through third-party library-modules -- which makes things harder to distribute to other users. I do know calibre does some font manipulation stuff (subsetting and such) perhaps there's something there that can offer some enlightenment.
DiapDealer is offline   Reply With Quote
Advert
Old 05-09-2015, 08:37 AM   #3
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
New Version in #1

I'm trying to guess some values derived from the filename
rubeus is offline   Reply With Quote
Old 05-23-2015, 05:24 AM   #4
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
New Version 020 in #1

With the help of Doitso the plugin is able to read the fontname directly from the file. Weight and style are derived from the fontname. If the fontname cant be read, the filename is taken into account.

Last edited by rubeus; 05-23-2015 at 05:27 AM.
rubeus is offline   Reply With Quote
Old 11-30-2015, 09:54 AM   #5
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
The new version 0.3.0 requires Python 3.x and the PIL libraries. This is present if you are using sigil from version 0.9.1 or newer and use the built-in python interpreter

I will leave the old one(0.2.0 for Python 2.7) in the first post, but it will not be maintained any longer (by me)
rubeus is offline   Reply With Quote
Advert
Old 12-18-2015, 08:16 AM   #6
Leonatus
Guru
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 632
Karma: 7077424
Join Date: Mar 2013
Location: Berlin, Germany
Device: Kobo Touch
Useful tool, thank you! I hope to avoid error messages by implementing fonts that sometimes occur, in the future!
Leonatus is offline   Reply With Quote
Old 12-19-2015, 01:03 PM   #7
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
Minor Bugfixes in #1
rubeus is offline   Reply With Quote
Old 01-11-2016, 02:51 PM   #8
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
Additinal bugfix in #1
rubeus is offline   Reply With Quote
Old 01-20-2016, 01:05 AM   #9
khadafi
Member
khadafi began at the beginning.
 
khadafi's Avatar
 
Posts: 15
Karma: 10
Join Date: Dec 2015
Device: sigil
Hello everyone,

I have following error and I don't know how to fix it :



Code:
Status: failed

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\PIL\ImageFont.py", line 239, in truetype
    return FreeTypeFont(font, size, index, encoding)
  File "C:\Python34\lib\site-packages\PIL\ImageFont.py", line 132, in __init__
    "", size, index, encoding, self.font_bytes)
OSError: unknown file format

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Sigil8\plugin_launchers\\python\launcher.py", line 135, in launch
    self.exitcode = target_script.run(container)
  File "C:\Users\Andry\AppData\Local\sigil-ebook\sigil\plugins\AddStyleFont\plugin.py", line 17, in run
    font_object = ImageFont.truetype(BytesIO(bk.readfile(id)))
  File "C:\Python34\lib\site-packages\PIL\ImageFont.py", line 241, in truetype
    ttf_filename = os.path.basename(font)
  File "C:\Python34\lib\ntpath.py", line 246, in basename
    return split(p)[1]
  File "C:\Python34\lib\ntpath.py", line 217, in split
    d, p = splitdrive(p)
  File "C:\Python34\lib\ntpath.py", line 159, in splitdrive
    if len(p) > 1:
TypeError: object of type '_io.BytesIO' has no len()
Error: object of type '_io.BytesIO' has no len()
Sigil version : 0.8.4 x86
Python version : 3.4.0 x86
OS : Windows 7 x64

Can anyone help me please ? Only one computer generate this error. Others works fine.

Thanks for answer !

Last edited by khadafi; 01-20-2016 at 03:03 AM.
khadafi is offline   Reply With Quote
Old 01-20-2016, 02:14 AM   #10
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
The one throwing the exception does not have the library PIL installed or is not using the internal Python interpreter or has a wrong version of Sigil.
rubeus is offline   Reply With Quote
Old 01-20-2016, 03:03 AM   #11
khadafi
Member
khadafi began at the beginning.
 
khadafi's Avatar
 
Posts: 15
Karma: 10
Join Date: Dec 2015
Device: sigil
Quote:
Originally Posted by rubeus View Post
The one throwing the exception does not have the library PIL installed or is not using the internal Python interpreter or has a wrong version of Sigil.
before using AddStyleFont I have installed PIL via
Code:
pip install Pillow
or is it wrong ?
Other computer with the same installation works fine.
khadafi is offline   Reply With Quote
Old 01-20-2016, 04:21 AM   #12
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
If they work fine they don't have the same installation.
rubeus is offline   Reply With Quote
Old 06-10-2016, 10:03 AM   #13
ErikG
Member
ErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of lightErikG is a glorious beacon of light
 
Posts: 16
Karma: 12048
Join Date: Apr 2010
Location: Leiden
Device: iRex DR800S, Kindle DX, PRS T2, Kobo H2O, Kobo Aura One, Kobo Forma
There is no longer a download link.
Reason?
ErikG is offline   Reply With Quote
Old 06-10-2016, 10:09 AM   #14
KevinH
Wizard
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: 3,276
Karma: 1958102
Join Date: Nov 2009
Device: many
rubeus was banned from MR because of his repeated attacks against newbie posters contrary to repeated requests that he stop. My guess he has removed all of his plugins which is of course his right. I will remove them from the plugin index.
So unless he has posted them on some personal page someplace, you are out of luck.

Sorry about that but we simply can not have newbie questions being verbally attacked in our own help forums.
KevinH is offline   Reply With Quote
Old 06-10-2016, 11:50 AM   #15
Doitsu
Wizard
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: 4,478
Karma: 14553847
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by ErikG View Post
There is no longer a download link.
Reason?
Some time ago, I designed a similar plugin that is not as fancy as the one by rubeus, but it basically does the same job.

If you want, I can attach it to this thread.
Doitsu is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing fonts from CSS JSWolf Kobo Reader 11 07-03-2015 10:49 AM
How to invoke different fonts in CSS 2.3.1? xuyn2003 Kobo Reader 32 01-06-2013 09:52 PM
working with fonts in css jayz Kindle Formats 9 10-29-2012 04:09 PM
Possible to embed fonts in CSS of .lit file? tanzer21 Calibre 9 06-30-2010 07:26 PM
Suggestion: let's create typographic CSS sic Sony Reader 2 08-20-2007 07:17 PM


All times are GMT -4. The time now is 05:58 AM.


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