View Single Post
Old 04-12-2009, 12:11 AM   #4
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
Quote:
Originally Posted by politicorific View Post
Actually I do, since my text is mostly math problems and vertical spacing is important. Since I reuse a large portion of my code for 100 odd drawings, I'd rather not retune each piece. For example, if I need a single number or a list of numbers, that would entail figuring out by trial and error the correct x co-ordinate placement. Also I want to be able to read my code without having to view it in another application for every change I make.
Ah, I see. Still, I disagree that monospace fonts are the "right" way to achieve this. Have you considered using a math-oriented language and converting to SVG as a rendering format? It looks like there's an open source MathML-to-SVG converter.

Quote:
Originally Posted by politicorific View Post
I still need a way to preserve whitespace.
Hmm. If I'm reading the SVG spec correctly (Section 10.15 "White space handling"), using xml:space="preserve" should preserve spaces, but treat newlines like spaces. If that's not what you're seeing, then I'm afraid you've found a bug.

Quote:
Originally Posted by politicorific View Post
Okay, so I've unwittingly included css inside my svg? The whitespace : pre declaration and another html character I'm using (the multiplication sign) are being rendered by Chrome and Safari, but shouldn't in say inkscape or other svg viewers which are not html aware?
I don't see a "white-space" property in the SVG property index, so yah. You probably can't depend on even all SVG-in-XHTML EPUB renderers to treat that CSS property in SVG the same way.

Quote:
Originally Posted by politicorific View Post
I think I understand, but am still baffled if I use height and width at 100%, this should take up the entire display area, right? Forgive my lack of terminology, but if percentage is used, then the outcome is determined by taking the original size of what the page is, inherited from <head>, <div>, <table>, or other css element, and then derived to the resulting size.

For example, I'm defining page width as 350px (approximately 65-80 characters as most css documents suggest), then defining a table which has a column width of 60% (now 210px), and finally defining an svg with 50% width, the resulting image should be 105px? Yet, how do I define height, which can be infinite, must I continue to use px or pt?
Ok, there's several things going on here.

First, although I'm not sure this is what're saying you are doing, you probably shouldn't be specifying your page-width at all, especially not in pixels. Although it's common practice Web documents, EPUB books are, well, books, and it's the job of the reader application to ensure that the text is at a readable width. If you want finer control over the page layout, Adobe has defined a separate stylesheet language which allows you to control the number of columns used for various display sizes. (Only AdobeDE understands these stylesheets ATM.)

Second, yah, '%' in CSS units is a percentage of the parent box. So if you have a box that you've set up to consume 60% of the page-width, a width of 100% on any child boxes will consume the entire page-width. If you want to control image maximum size and proportion, check out the CSS max-height and max-width properties and the SVG preserveAspectRation attribute. With those together you should be able to ensure that your images reasonably consume whatever space is available.
llasram is offline   Reply With Quote