Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 11-14-2016, 05:21 AM   #31
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
I am impressed. Just run the editor from source with my sample docx for generating a new epub. Works very well

Can you do the same behavior for an existing epub for updating? E.g if you are looking for the file I gave you (FonttestwithoutembededFont.epub). If you embed the font it find the regular one and for the light version it found 2 possible matches based on weight. But only one is correct because there is only one as light regular. The other one is light italic and that one isn't used for this epub. Guess, if you are able to get that in line too, most users are happy with the new solution.

Best regards,
DD
Divingduck is offline   Reply With Quote
Old 11-14-2016, 05:58 AM   #32
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
While in this case it is easy to deduce which is the correct font, in the general case it is not so easy. Remember that there are four axes on which font properties must be matched, so the search space is rather large and you can have many candidates. As such, I think showing the user the candidates and letting them pick manually is better than auto-picking one, which could very well be wrong. Not to mention that this problem only happens for special purpose fonts i.e. ones that do not have regular weight or stretch properties, which is relative rare.
kovidgoyal is offline   Reply With Quote
Advert
Old 11-14-2016, 06:56 AM   #33
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Understand. Thanks.
Divingduck is offline   Reply With Quote
Old 11-14-2016, 04:00 PM   #34
nabsltd
Evangelist
nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.
 
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
Quote:
Originally Posted by kovidgoyal View Post
See my previous post. You really need to read what I actually say instead of jumping up and down and repeating yourself endlessly. Quoting myself, from one day and 14 posts before:
To me, that meant you might be thinking about it, but not really putting it on the "to do" list. So thanks for the change.

I jumped hard because it's one of those very much not intuitive UI things that the programmer thinks is really easy to use, but other users don't. And, it could be made much, much easier if the user could just click a font file in the "not quite matching" list and say "OK, that's the one I meant...embed that, and make sure the @font-face definition that gets created matches the selector you found, thanks". This would also make it do what users seem to expect it will do.

Quote:
Font selection, operates on four keys, name (of which there are actually half a dozen varieties in font files), weight, style and stretch. Read the CSS spec on fonts sometimes.
But, most of that doesn't matter as far as real-world users who are trying to embed fonts. For example, if they have a selector like:
Code:
.something {
font-family: "Adobe Garamond Pro";
font-weight: bold;
}
A user that has this expects the font from the selector to be exactly the same one that shows up when they use a word processor, pick the "Adobe Garamond Pro" font, and choose "bold". The fact that the actual font is marked as "semibold" weight (600) shouldn't matter as far as matching for embedding. Maybe it won't embed automatically, but a user should be able to tell Calibre, "yes, that's really the right file, even though something doesn't match perfectly".

For weight, this makes perfect sense, because even the CSS spec says that font-weight can never fail to match, as long as there is a font with a name match that has the appropriate glyphs (and I never expect Calibre to check this) and otherwise matches (italic, etc.).

So, yeah, I read the spec...and Calibre's editor (which is acting as a UA at that point) doesn't follow it when embedding.
nabsltd is offline   Reply With Quote
Old 11-14-2016, 10:15 PM   #35
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by nabsltd View Post
To me, that meant you might be thinking about it, but not really putting it on the "to do" list. So thanks for the change.
You're welcome -- and miscommunication is one fo the "features" of the internet

Quote:
I jumped hard because it's one of those very much not intuitive UI things that the programmer thinks is really easy to use, but other users don't. And, it could be made much, much easier if the user could just click a font file in the "not quite matching" list and say "OK, that's the one I meant...embed that, and make sure the @font-face definition that gets created matches the selector you found, thanks". This would also make it do what users seem to expect it will do.
It's also one of those things that is a lot of effort to implement for a relatively rare use case. Software development is all about tradeoffs. If you feel my judgement of this tradeoff is incorrect, you are welcome to submit a patch.

Quote:
A user that has this expects the font from the selector to be exactly the same one that shows up when they use a word processor, pick the "Adobe Garamond Pro" font, and choose "bold".
Quote:
So, yeah, I read the spec...and Calibre's editor (which is acting as a UA at that point) doesn't follow it when embedding.
You cannot have both of those properties, they are mutually exclusive, because word processors do not follow the CSS spec on font matching. And see my post from a couple of days before, quoting myself:

Quote:
What I can do, is implement a basic fallback mechanism for when a font is not found, so that the matcher tries to find the "closest" available font, which will hopefully be the right one most of the time. However, this is a lot of work to implement.
kovidgoyal is offline   Reply With Quote
Advert
Old 11-15-2016, 12:06 AM   #36
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by kovidgoyal View Post
While in this case it is easy to deduce which is the correct font, in the general case it is not so easy. Remember that there are four axes on which font properties must be matched, so the search space is rather large and you can have many candidates. As such, I think showing the user the candidates and letting them pick manually is better than auto-picking one, which could very well be wrong. Not to mention that this problem only happens for special purpose fonts i.e. ones that do not have regular weight or stretch properties, which is relative rare.
After thinking some more about it, I decided to implement the fallback mechanism after all. The idea being that even if it gets it wrong, thanks tot he checkpoint mechanism, it is easy for the user to revert the changes and manually edit the styles for the fonts based on the generated report.

https://github.com/kovidgoyal/calibr...0ccadbac0a03bb

This is going to need some testing.
kovidgoyal is offline   Reply With Quote
Old 11-15-2016, 01:27 AM   #37
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Good morning. I see, you are busy working on this again
Divingduck is offline   Reply With Quote
Old 11-15-2016, 07:28 AM   #38
hidden.platypus
Connoisseur
hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.hidden.platypus can program the VCR without an owner's manual.
 
hidden.platypus's Avatar
 
Posts: 89
Karma: 190508
Join Date: May 2014
Device: Android
Quote:
Originally Posted by kovidgoyal View Post
After thinking some more about it, I decided to implement the fallback mechanism after all. The idea being that even if it gets it wrong, thanks tot he checkpoint mechanism, it is easy for the user to revert the changes and manually edit the styles for the fonts based on the generated report.

https://github.com/kovidgoyal/calibr...0ccadbac0a03bb

This is going to need some testing.
I am going to be doing a fair amount of font embedding via Calibre for the foreseeable future.

Happy to be your guinea pig. Tell me how you think it's best stressed, and I'm happy to inform you when and if I break it.

Thanks for taking the time to do this.
hidden.platypus is offline   Reply With Quote
Old 11-15-2016, 07:59 AM   #39
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
It works much better now. If you run the editor from actual source you will see the improvements immediately.
Divingduck is offline   Reply With Quote
Old 11-15-2016, 09:49 AM   #40
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just use it and let me know if it does something unexpected
kovidgoyal is offline   Reply With Quote
Old 11-16-2016, 12:00 PM   #41
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Hi Kovid,

I finish my tests and all went good so fare.

I recognize some system usage increase during the time the algorithm is analyzing the document.

An other observation was, that if a document have already a font included the algorithm seems not to check wether the font is in use ore not. In my case there was already a font (Arial Unicode) integrated but not used. The algorithm pick up the correct one's on top but don't delete the already included wrong one.
In my case this behavior is ok (I think) because the document uses parts of the huge Arial Unicode font (instead of the original font). The algorithm was maybe not able to find the better one. I guess this will be a unsolvable situation as the system can't know at that point what the right font is if there are intersections in glyphs between used fonts.

I recognize this behavior after I generate my mentioned "worse case book" with updated sources from scratch today. I was wondering why there was missing some fonts and surprised about to see that most of exotic glyphs matching better and with less missing ones as before.

Maybe you can put an additional remark into help file / tool tip that this can happen.

I found a little issue with one font. calibre wasn't able to find the font code2001 with font style italic. I never had seen a own italic version. After I check the font, I recognize the italic glyphs are included within the font. No problem at all, I delete the odd one manually.

Best regards,
DD
Divingduck is offline   Reply With Quote
Old 11-16-2016, 12:06 PM   #42
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Embedding fonts will never delete any pre-existing embedded fonts. It should not re-embed an already embedded font, as long as the font family and font styles of the already embedded font match those of the newly embedded font, the old font will be used. But if the old font has a different family/style/weight/stretch in its @font-face rule then then it will not be re-used.
kovidgoyal is offline   Reply With Quote
Old 11-17-2016, 01:20 PM   #43
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by kovidgoyal View Post
Embedding fonts will never delete any pre-existing embedded fonts. It should not re-embed an already embedded font, as long as the font family and font styles of the already embedded font match those of the newly embedded font, the old font will be used. But if the old font has a different family/style/weight/stretch in its @font-face rule then then it will not be re-used.
Kovid:

Stupid question, if I may? (I've been playing with your editor. Very nice.)

Does the import function (or any of these others--I freely admit I have not played with this yet) check the embedding permissions for the font, prior to embedding it or displaying it for use (in the new function)?

Thanks,
Hitch
Hitch is offline   Reply With Quote
Old 11-18-2016, 12:49 AM   #44
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, calibre is not going to get into the game of trying to second guess the user about their intentions. If the user asks calibre to embed a font, calibre will embed the font. It is up to the user to ensure they have the proper permissions for the intended use of the fonts.
kovidgoyal is offline   Reply With Quote
Old 11-18-2016, 03:03 AM   #45
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by kovidgoyal View Post
No, calibre is not going to get into the game of trying to second guess the user about their intentions. If the user asks calibre to embed a font, calibre will embed the font. It is up to the user to ensure they have the proper permissions for the intended use of the fonts.
Kovid:

Thanks. I wasn't looking to turn this into a philosophical discussion, about licensing fonts rather than not--I really just wanted to know if it did (look for the embedding bits). Obviously, it's something that we're very attuned to, at my shop. I was wondering if C did look for that, because we do get a fair number of "fixer-uppers." If C looked at that, I could have used it as a quick-n-dirty double-check of ePUBs that we've not made ourselves.

As it is, we unzip the ePUB and I check the bits with my font manager. I was simply hoping that you might have something faster/easier.

Thanks.
Hitch
Hitch is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can it embed fonts? chalimac Kobo Reader 1 06-27-2017 05:46 PM
How to embed fonts in ePub after Calibre fiery ePub 79 12-05-2016 02:18 AM
Is it possible to really embed fonts yet? LaurelRusswurm ePub 25 11-17-2011 10:25 PM
Is it possible to UN embed fonts? lmronan Sigil 14 06-04-2010 09:26 AM


All times are GMT -4. The time now is 06:39 PM.


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