Git Product home page Git Product logo

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
Fixed in 2.0

Original comment by [email protected] on 11 Jun 2008 at 3:29

  • Changed state: Fixed

from iphoneebooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.