32

I'm working on a project where I will design a GUI for an embedded device and would love to go with HTML for this. I hope you guys can help me find a render engine that suits my needs.

Requirements:

  • The web-page must be rendered into a memory buffer. I will then transfer the memory buffer to the display.

  • I must be notified though callback or event that the render engine need to fetch a new item. HTML page, image, etc. The reason for this is that I must fetch the resource and feed it to the render engine (the reason is that the device does not have TCP/IP in all configurations and will then need to fetch the item over serial line, and also for security I need to validate that the request is allowed).

  • I must be able to inject mouse and keyboard events into the rendering engine.

  • Only C and/or C++

  • Must be easily portable and lack dependencies to libraries that only exist for win/linux/mac. The device I have runs a custom OS...

  • Small footprint and memory consumption, I can probably get away with 10MB footprint and 5-10 MB allocated memory during rendering. But not much more.

  • Both open source as well as commercial solutions are welcome

  • I do NOT need full HTML5 and CSS3 support, I mean if I can use "basic HTML and some CSS" I'm more than happy.

I have looked at some WebKit, chromium, gecko, berkelium and awesomium but not really found that they fit my needs.

Is there anything out there that comes close to what I need? Or should I just give up this idea and build the GUI in some other way? I appreciate any help!

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
tkarls
  • 3,171
  • 3
  • 27
  • 27
  • Interesting Question. Worth the bounty in my opinion. – Niklas R Apr 14 '12 at 20:24
  • 2
    Sounds like : Qt Embedded + Webkit! – masoud Apr 15 '12 at 12:42
  • "...but not really found that they fit my needs." - exactly, its hard to find something that really fit our needs, and also have appriopriate license and actually project is actively managed and multiplatform. My company ended up actually writing its own Html renderer. – marcinj Apr 20 '12 at 06:53
  • How comes "not constructive?" :) – mlvljr Aug 27 '14 at 10:56
  • In 2021, we have the options of litehtml and rmlui. However, I do not see an example of rendering to an image buffer in the repo. – moi Oct 04 '21 at 00:24

3 Answers3

31

Good question! It turns out there are a few options within this space, and as you've surmised, many of them are based on Webkit. Some of them aren't, though, and those are the ones that I believe you're most interested in.

Links

The simplest, 0th-level browser that's going to meet your needs is the graphical version of the Links web browser. It's suitably cross-platform (admittedly, you will require some of the libraries from Cygwin for Windows environments), open source, carries a small memory footprint, and in some of its forked or enhanced incarnations (for example, Elinks), has enhanced functionality like Javascript support, full mouse functionality, and the bells and whistles that you desire in your problem statement.

Of course, it's written in C.

Konqueror/Embedded

Exploring some of the other options within this space, Konqueror/Embedded is something to consider and watch in the future. Yes, it is based on Qt/Embedded and Webkit (mumble mumble), but they're aiming to provide a slimmed down version of both their browser and their library stack to meet this need specifically. Once again, Windows is going to be the odd child out here, but it's workable.

Fennec

One last cross-platform option to explore is the slim version of Mozilla Firefox, Fennec. While providing a much larger code base, Mozilla is working on its embedded version very aggressively, and any help you can provide here would be greatly appreciated. From what I understand, the slimmed version is still pre-alpha (Fennec, however, lives on), but it should become a workable option in the future.

And a Gamut of Others to Explore

In addition to the gamut of web browsers currently competing in this space, proprietary options like ANT Galio may also meet your needs. It seems there are many other proprietary solutions out there, but the majority of them (for example, Internet Explorer Mobile, Mobile Safari) only service a small number of platforms. Good, proprietary, cross-platform solutions that aren't based on Webkit seem to be quite rare.

SpliFF also offered an excellent suggestion in his answer: try libRocket. As he recommends, it's lightweight, cross-platform, currently and actively maintained, easy for you to hook into, and provides for the automation cases that you seek. In this case, it's programmed in C++, with Python bindings for additional convenience.


In conclusion, given your needs, you'll still need to evaluate the strengths, weaknesses, and API specifications for the options listed above.

I recommend starting with Links, because it's the most feature-rich and robust option while optimizing on a very small memory footprint and codebase. Its biggest strength is that this was a design goal from the outset, and the entire code tree is built with this design philosophy in mind.

Do let us know what you go for. This is a common enough need in the community that I'm sure others will benefit from your experience.

Community
  • 1
  • 1
MrGomez
  • 23,788
  • 45
  • 72
  • 2
    Thank you for the very detailed answer. I had almost forgot about this post. I will definitely look into your suggestions! – tkarls May 24 '12 at 09:12
  • @tkarls, can you please tell us what solution you finally chose? – Tomas Jun 23 '12 at 10:13
  • 1
    Yes, at last we decided to implement a "gui library" our selves. We're parsing formatting data from XML files so I suppose you can call it a tiny mini mini browser. – tkarls Aug 16 '12 at 08:58
11

Have a look at librocket. It meets your requirements of being HTML+CSS, lightweight, handling events and rendering to a buffer. I looked though a bunch of projects recently looking for basically what you asked and this was the match I found.

libRocket is the C++ user interface middleware package based on the HTML and CSS standards. It is designed as a complete solution for any project's interface needs.

libRocket uses the time-tested open standards XHTML1.0 and CSS2.0 (while borrowing features from HTML5 and CSS3), and extends them with features suited towards real-time applications. Because of this, you don't have to learn a whole new proprietary technology like other packages in this middleware space.

  • Cross platform architecture (Windows, Mac, Linux, iPhone, ...).
  • Dynamic layout system.
  • Efficient application-wide styling, with a custom-built templating engine.
  • Fully featured user control set: buttons, sliders, drop-downs, etc.
  • Runtime visual debugging suite.
  • Easily integrated and extensible with Python scripting.
  • Abstracted interfaces for plugging in to any game engine (samples for OpenGL, DirectX and Ogre3d).
  • Decorator engine allowing custom application-specific effects that can be applied to any element.
  • Generic event system that binds seamlessly into existing projects.
kalucki23
  • 172
  • 4
  • 15
SpliFF
  • 38,186
  • 16
  • 91
  • 120
  • +1, perfect suggestion. You didn't _quite_ cover all of the needs of the OP, but [adding a bit of additional documentation for automation cases](http://librocket.com/wiki/documentation/RML/Events) is all this answer needs. Very nice, very worthy of inspection, and getting an update in my answer to point to this one for completeness' sake. – MrGomez Apr 20 '12 at 21:02
  • Where is the example code for render to a buffer? ```The web-page must be rendered into a memory buffer. I will then transfer the memory buffer to the display.``` – moi Oct 03 '21 at 23:30
3

Have a look at DS Organize, a homebrew DS browser, and also ES Operating System by Google (for an OS originally developed by Nintendo).

I have suggested looking at DS Organize as the Nintendo DS has only 4MB of RAM (8MB with the memory extension that most DS browsers use). And you might also be able to get away with rendering directly to VRAM, saving you a few 100kb, depending on your memory model and how much freedom you have with VRAM writes outside of VBlank.

Keldon Alleyne
  • 2,103
  • 16
  • 23