Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-28-2012, 04:06 PM   #31
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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That's a bug. I should have used normalize() not utf8_text(). Fix committed.
kovidgoyal is online now   Reply With Quote
Old 07-29-2012, 03:09 AM   #32
olig
Enthusiast
olig began at the beginning.
 
Posts: 32
Karma: 12
Join Date: Jul 2012
Device: Kindle 4nt 4.1.3 jailbreak
Thanks.

BTW: Do you collect sample documents? Would my ODT test cases be of interest?
olig is offline   Reply With Quote
Advert
Old 07-29-2012, 03:35 AM   #33
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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I do collect sample documents, so your test cases will be useful. Incidentally, have you committed the use of get_metadata() to your branch? Because I tried merging and there were no changes.
kovidgoyal is online now   Reply With Quote
Old 07-29-2012, 03:49 AM   #34
olig
Enthusiast
olig began at the beginning.
 
Posts: 32
Karma: 12
Join Date: Jul 2012
Device: Kindle 4nt 4.1.3 jailbreak
No, not yet committed, I'm still testing.

Where do I put the test file?
olig is offline   Reply With Quote
Old 07-29-2012, 04:12 AM   #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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just attach it here.
kovidgoyal is online now   Reply With Quote
Advert
Old 07-31-2012, 04:13 AM   #36
olig
Enthusiast
olig began at the beginning.
 
Posts: 32
Karma: 12
Join Date: Jul 2012
Device: Kindle 4nt 4.1.3 jailbreak
Morning!

Still working on a new ODT Test file with some more cases than my 'real text'. While doing I found some more problems:

1) A Picture that is anchored to a page will end up in the front of the document before any text, with a page number as positioning. If you have a lot of pictures in your document anchored to pages, all of them will be the first thing in the conversion. And there is no good way to find the real place in the document. This should also produce a warning so the user knows, or perhaps I should also remove those pictures?

2) ODT sets margins double... so I will find a style like this in the input:
.P-Text_20_body {
font-size: 12pt;
margin-left: 0;
margin-bottom: 0;
margin-top: 0;
margin-right: 0;
text-indent: 1.251cm;
font-family: FreeSerif, serif;
margin: 100%;
text-align: justify
}
which becomes in 'preprocessed' (debug mode):
.P-P3 {
display: block;
font-family: FreeSerif, serif;
font-size: 1em;
margin-bottom: 100%;
margin-top: 100%;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
text-align: justify;
text-indent: 1.251cm
}

Naturally the convert should just drop this whole 'margin: 100%' line, because it is in addition the the right margins! I suspect this is some sort of proportional setting (like margins-left-right-top-bot are X, and use 100% of this).

I will introduce a fix for this on input level, because I suspect that inside the oeb.transform fixups it's already to late. Fix will be: if there are separate margins, drop the extra margin 100% (that makes no sense at all).

I'll post a note as soon as I committed something to my branch.
olig is offline   Reply With Quote
Old 07-31-2012, 04:22 AM   #37
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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I think it is better to have a warning and leave the pictures. Data loss is always worse than poor formatting.

IIRC, I already had code in the odt input layer to take care of the double margins, but perhaps I didn't catch all cases. bzr log on odf2xhtml.py should tell you.
kovidgoyal is online now   Reply With Quote
Old 07-31-2012, 04:26 AM   #38
olig
Enthusiast
olig began at the beginning.
 
Posts: 32
Karma: 12
Join Date: Jul 2012
Device: Kindle 4nt 4.1.3 jailbreak
Yeah, you are right. I just saw that I called my test convert in a window that had not the devel envs set. The trunk head version just does fine.

I'll add a warning for the page anchored images in the odt.input.
olig is offline   Reply With Quote
Old 07-31-2012, 05:46 AM   #39
olig
Enthusiast
olig began at the beginning.
 
Posts: 32
Karma: 12
Join Date: Jul 2012
Device: Kindle 4nt 4.1.3 jailbreak
Pushed my new changes, Testfile is attached (it's odt renamed to zip, rename back to .odt to use).

A question: the OPF supports more metadata than calibre uses. Can I set those fields anyways? So for example additional contributors like editor or illustrator. By set I mean add them as fields in my ODT and then let the metadata extraction transport those fields so that they will end up in the converted output?
Attached Files
File Type: zip odttest.zip (1.39 MB, 205 views)
olig is offline   Reply With Quote
Old 07-31-2012, 06:26 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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can do that, but I doubt they will survive th conversion pipeline. IIRC the pipeline has some metadata merging code that will discard unknown metadata attributes.
kovidgoyal is online now   Reply With Quote
Old 07-31-2012, 07:38 AM   #41
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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
merged.
kovidgoyal is online now   Reply With Quote
Old 08-01-2012, 05:10 AM   #42
olig
Enthusiast
olig began at the beginning.
 
Posts: 32
Karma: 12
Join Date: Jul 2012
Device: Kindle 4nt 4.1.3 jailbreak
This is no ODT-only thing...

Now only style problems are left in my tests. Most annoying: margin and indent, which are transported 1:1 in the style. And because there are lots of styles involved (in a real world document), fixing it with extra_css is not easy.

I'm thinking about a scale_units option. Or perhaps a style_search_replace which allows regex replacements of style key/values? The second would be more flexible (but also less easy to use), because you will have a certain set of margins and so replacing would give more power than straight scaling. It would also allow replacing fixed units (cm in the ODT) with something more scalable like em. Could also be done as a flex_units option which replaces fixed margin/indent units to em by telling it what measure is 1em.

I just did a test with the last option, replacing 0.625cm with 1em (quick replace on the generated ePub stylesheet): looks very good.

Would this be an option you would accept?
olig is offline   Reply With Quote
Old 08-01-2012, 05:22 AM   #43
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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That kind of thing strays into the territory of book editing. You have various options for that. Convert to EPUB and use calibre's tweak book feature to run search/replace on the stylesheet. Or use a dedicated tool like Sigil.
kovidgoyal is online now   Reply With Quote
Old 08-01-2012, 05:32 AM   #44
olig
Enthusiast
olig began at the beginning.
 
Posts: 32
Karma: 12
Join Date: Jul 2012
Device: Kindle 4nt 4.1.3 jailbreak
Well, yes, one could see it that way... but isn't converting already editing? And isn't the whole 'Look and Feel' section in the manual exactly this? I see this in league with options like --remove-paragraph-spacing, --base-font-size, etc.

It should give you the power to automatically get good results. And margins that are just to big for the small screens is something I would see under the 'lets to it automatically' topic and not under eBook editing.
olig is offline   Reply With Quote
Old 08-01-2012, 06:46 AM   #45
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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Page margins are already automatically handled. Changing margins for individual elements most definitely falls under book editing.
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Download Metadata on Import ebookrights Calibre 2 12-18-2012 10:51 AM
Import MetaData an Tags adrian142 Library Management 0 04-03-2012 11:40 AM
Import metadata from file Vinavil Library Management 2 01-28-2012 03:48 PM
Mixing metadata on import PeteMan Calibre 2 01-03-2011 02:21 PM
Import: prioritization of metadata source? ATimson Calibre 2 02-28-2010 03:57 PM


All times are GMT -4. The time now is 08:16 AM.


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