Comments (3)
More thinking on this, and a conclusion (though hardly a solution): HTML sucks
for
small-device reader applications.
While incrementally loading text is easy (just pick a point and start drawing),
and
even incrementally loading the subset of HTML-like formatting that Plucker
supports
is quite doable, loading real, native, in-the-wild HTML without having parsed
everything before the current point is essentially impossible.
Even assuming perfect XHTML (which is hardly a safe assumption given some of the
garbage that's out there), you'd need to at minimum read the header and any
intervening [style] blocks to know how to draw a particular section. When you
add
all the myriad ways of messing up HTML - missing close tags, improper nesting,
and
gawd knows what else... I give... I don't think it's possible to render part
'C' of
an HTML file without having first read 'A' and 'B'. Maybe if you're willing to
draw
it with minimal formatting and then re-draw it once you've read from the top
down.
That could give you faster load up time (at the expense of ugly text at first).
Frankly, coding that seems like it would be a nightmare.
We could load the book up fast if the user's near the beginning (just render up
to
the current offset before showing, and figure out the rest in a BG thread), but
I'm
not sure that buys much. Load times would increase linearly as the user
scrolled
down in the book.
I begin to see why Plucker doesn't do HTML on the device, but pre-processes it.
The
Plucker format is designed so that any given record is 'closed' with respect to
what
came before it. Any global-type formatting (BG color) is set at the beginning
of
each record. There's nothing like CSS and just simple font families and sizes.
We
could greatly ease the problem by using a pre-processor ourselves for HTML, but
I
personally like the idea of just dropping files on the phone and being able to
read
them without any foreplay...
I wonder if there's any widget on the iPhone that can just take an HTML file
(rather
than a string of HTML) and display it? Hopefully Apple might have done better
at
quick loading? Time to dive into the headers...
Original comment by [email protected]
on 16 Sep 2007 at 4:01
from iphoneebooks.
The UIWebView does it, and I've gotten it to compile. But the problem is that
there's no way to determine how
large the view should be (that I can find--there are some string drawing
routines but they just segfault for
me). Somehow, UITextView can do it, but you can't do it directly. The method
you're looking for is
"[uiwebview loadRequest:[NSURLRequest requestWithURL:[NSURL
fileURLWithPath:pathString]]]". It loads
without blocking.
This also displays images in-line, even! But there's no way to:
- change the font
- change the text size directly (although you can do -makeTextBigger and
-makeTextSmaller applied to the
WebKit WebView, which I haven't tested)
- pre-process the file and send it to the UIWebView as a string; the
loadHTMLString: withBaseURL: method
seems to be unimplemented.
- guarantee that the view will only be 320 pixels wide. (If there's an image,
the view expands to fit it and
goodbye, vertical-only scrolling.)
I'm already loading up text & HTML files up to a certain character count and
then loading the rest "in the
background." But I'm not sure whether a UITextView is possible to make
thread-safe or not. I'm trying to
avoid multithreading if at all possible.
Original comment by [email protected]
on 18 Sep 2007 at 5:07
from iphoneebooks.
Fixed in 2.0
Original comment by [email protected]
on 11 Jun 2008 at 3:29
- Changed state: Fixed
from iphoneebooks.
Related Issues (20)
- keyboard doesn't appear when editing Font Size in prefs HOT 1
- Feature Request: Progress indicator HOT 2
- Clock is off center HOT 1
- Unable to open ebooks larger than 200kb HOT 1
- Switching between chapters is slow in 1.4 HOT 1
- iPhone Crashes on Loading Large Book HOT 1
- Landscape mode lock doesn't stick. HOT 1
- iPhone orientation HOT 1
- Screen size is incorrect HOT 3
- Books.app it keeps trying to load & display help in lower corner HOT 1
- Prev issue id:39 upgraded to 1.5 now I get Access Dinied HOT 1
- freezes upon first launch HOT 1
- Clickable HTML Links in Books HOT 3
- How to package a book HOT 1
- Disable Page Scrolling in Favor of Page Flipping
- When I update to version 1.5-r523, it finds my books and chapters but it shows no text. It worked previous to the update.
- SDK version? HOT 2
- [Enhancement] Support for Speed Reading
- how can i open the source code in iphone simolator or device? HOT 2
- iOS4: Scrolling within file contents does not work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iphoneebooks.