Haru PDF Library
by Adam Blokus
This mail didn't get through yesterday - I think because of the attachments.
Both files can be found in my branch (branches/adamblokus/harutest/)
-------
Hi,
I wrote a small example of the usage of the pdf-generating library I'd like to
use(http://libharu.org/wiki/Main_Page). The code generates a pdf file (also
attached) with some graphic primitives and an image.
The provided functionality is enough to cover all the plotting functions of
the plotters_table interface. There may be some problems:
- with font handling (didn't work with some fonts for me)
- with font encoding - (as I understand it: there is some unicode support with
chinese and japanese characters, but multibyte encoding seems not to be
supported in general; this can be done by converting from utf8 to someting
else first? )
- with images - there is support for png,raw and jpeg, but,as rjek pointed
out-not for gif (this one can be added basing on what we already have in
NetSurf)
There are still some developers working on this library, so these issues (esp.
the first one, the second and third can be worked around in some ways) should
be fixed someday. By now there are not critical obstacles.
Other possible choices, that I see, are:
- using cairo (has pdf surfaces, but with more limited functionality; rjek
complained about its dependiences)
- making a .ps and convert it with GS
- hacking some sources of a program with a suitable licence to extract the
needed functions
- finding another library ( although I made some research when writing my
proposal and during the last few days and I didn't find anything better )
So I am proposing to use Haru - what do you think about it?
Adam
15 years, 6 months
Re: My GSoC - Progress report
by John-Mark Bell
On Sat, 31 May 2008, Adam Blokus wrote:
> As I was asked for - I'm reporting what has been done this week:
> I started with adding a skeleton plotter interface and kept completing
> it all the time.
This is nice work :)
> I got now through a quite big piece of the rendering code - mainly to
> find out how all the content is managed and what information it consists
> of. This all is because one of my coming goals is making the plotting
> aware of the type of the bitmap being plotted - to allow it to directly
> embed some types of images(as jpeg,png) into the pdf file.
>
> At the point I am - I have to ask for directions and/or your opinion.
> The case is:
> - To embed directly an image, we have to get access to its type(to know
> if we plot it pixel by pixel or embed its native file), and the file
> itself
> - By now, the plot_bitmap functions get only a pointer to the bitmap
> structure, which may not have any of the above (only pixbuf's in gtk)
It won't. The bitmap structure is purely a platform-specific buffer of
pixel data in 32bpp ABGR format.
> - the most times plot_bitmap is called, the pointer to the bitmap struct is
> extracted from the content struct, which includes the filetype and
> file
> - I think we should keep the generality of the sources - so don't distinguish
> plottings from each other in the rendering code ( so the changes
> should be transparent for gtk, riscos, save_draw )
Yes, I agree that preserving the generality is good.
> I see some possible ways to provide the necessary data to the plot_bitmap
> function, mainly:
> - add another field to the bitmap - a pointer to the content - this would
> double some information, but would be probably the easiest (as it
> wouldn't require any changes for other plottings)
> - divide it into 2 functions: plotting a bitmap from a file(which would
> get the content struct as an argument,not only the bitmap) and
> plotting a pixmap from memory.
Of these, I think the first is best. You'll have to add some API to
image/bitmap.h (which is where the core bitmap API is defined) to allow
you to extract the content pointer.
Another option might be to add the content pointer as a parameter to the
plot_bitmap(_tile) API, which would avoid making the bitmap structure
depend upon a content. There are some cases (e.g. page thumbnailing) where
bitmap structures are created but not backed by an image content.
> Any way - I will have to start working also on harulib, by adding some
> loadIMGTYPEfromMem functions - which, after going through haru's sources, I
> found to be quite easy ( this parts of its sources rely on quite universal
> streams ).
Cool. Serialising to file only to load back in again sucks :)
J.
15 years, 6 months
My GSoC - Progress report
by Adam Blokus
Hi everyone,
As I was asked for - I'm reporting what has been done this week:
I started with adding a skeleton plotter interface and kept completing it all
the time. By now - almost all functions, besides bitmaps, of the plotter
interface are done. I predict that still some corrections will have to be
made, as harulib has some stronger requirements on the function arguments,
which required me to normalize some values given by the rendering engine.
Many of you have already tested it and I was working also in response to some
guidelines / reported issues.
I got now through a quite big piece of the rendering code - mainly to find out
how all the content is managed and what information it consists of. This all
is because one of my coming goals is making the plotting aware of the type of
the bitmap being plotted - to allow it to directly embed some types of
images(as jpeg,png) into the pdf file.
At the point I am - I have to ask for directions and/or your opinion. The case
is:
- To embed directly an image, we have to get access to its type(to know if we
plot it pixel by pixel or embed its native file), and the file itself
- By now, the plot_bitmap functions get only a pointer to the bitmap
structure, which may not have any of the above (only pixbuf's in gtk)
- the most times plot_bitmap is called, the pointer to the bitmap struct is
extracted from the content struct, which includes the filetype and file
- I think we should keep the generality of the sources - so don't distinguish
plottings from each other in the rendering code ( so the changes should be
transparent for gtk, riscos, save_draw )
I see some possible ways to provide the necessary data to the plot_bitmap
function, mainly:
- add another field to the bitmap - a pointer to the content - this would
double some information, but would be probably the easiest (as it wouldn't
require any changes for other plottings)
- divide it into 2 functions: plotting a bitmap from a file(which would get
the content struct as an argument,not only the bitmap) and plotting a pixmap
from memory.
Please respond if you have any thoughts about this.
Any way - I will have to start working also on harulib, by adding some
loadIMGTYPEfromMem functions - which, after going through haru's sources, I
found to be quite easy ( this parts of its sources rely on quite universal
streams ).
Adam
15 years, 6 months
Re: ??Netsurf RISCOS impossibility??
by John-Mark Bell
On Wed, 28 May 2008, Keith Hopper wrote:
> John,
> Please forgive me for writing personally about a Netsurf problem -
> which is, as far as I can see, neither a 'bug' nor an additional 'wished
> for' feature.
>
> I have been experimenting with lists of sub-menus in the course of
> developing a church web site - after an idea from John Russell
> (ve3ll(a)cogeco.ca) in Canada. The idea is that you generate a horizontal
> list with drop-down sub-menus activated on hovering over the relevant list
> item.
>
> Don't jump at me yet - I do know that pseudo-classes and
> pseudo-elements are not yet implemented in Netsurf.
>
> With a scroll-wheel mouse or similar, the Menu button is pressed over
> the sub-menu item to select the relevant document.
>
> So far as I can tell this works well in Safari, Konqueror and Opera -
> not so good in Firefox; I haven't got access to MSIE, but I suspect it will
> be on a par with the others.
>
> With Netsurf on RISC OS pre-empting the Menu button on the mouse, I
> have the horrible fear that this technique might not be possible with
> Netsurf.
It wouldn't surprise me if it did break. However, I can't see that you're
actually checking which mouse button is being clicked, anyway.
> If you want to try out my prototype document just go to -
>
> http://srv.asgard.org.nz/stpeters/index.html
>
> The main horizontal list near the bottom has sub-menus for every
> entry. There is a hidden sub-menu if you hover over the 'W3C web
> technology' image - the church didn't want all of the various
> acknowledgments immediately visible in glorious technicolor!
>
> As you will appreciate I have designed the site so that the ability to
> hover and bring up the sub-menus is not a site limitation, but since this
> sort of thing is possible I wondered whether you might wish to put this on
> your to do list - or, alternatively, in the too hard basket!
I'm not sure that there's anything that actually needs doing here.
Clicking with any other mouse button works fine, too.
> With my gratitude for all your hard work - the whole team I mean.
John.
15 years, 6 months
Re: r4215 adamblokus - /branches/adamblokus/netsurf/pdf/pdf_plotters.c
by John Tytgat
In message <courier.483BE6BE.00001000(a)atlanta.semichrome.net>
netsurf(a)semichrome.net wrote:
> +#define R(x) (( x & 0xff)/256.0)
> +#define G(x) ((( x & 0xff00)>>8)/256.0)
> +#define B(x) ((( x & 0xff0000)>>16)/256.0)
Small remark: have instead:
#define R(x) (( (x) & 0xff)/256.0)
I.e. always put () around all the #define parameters instances in its
definition as e.g.
R(x+1)
expands to:
(( x + 1 & 0xff)/256.0)
Which is probably not what you've intended.
John.
--
John Tytgat
joty(a)netsurf-browser.org
15 years, 6 months
Haru PDF Library
by Adam Blokus
This mail didn't get through yesterday - I think because of the attachments.
Both files can be found in my branch (branches/adamblokus/harutest/)
-------
Hi,
I wrote a small example of the usage of the pdf-generating library I'd like to
use(http://libharu.org/wiki/Main_Page). The code generates a pdf file (also
attached) with some graphic primitives and an image.
The provided functionality is enough to cover all the plotting functions of
the plotters_table interface. There may be some problems:
- with font handling (didn't work with some fonts for me)
- with font encoding - (as I understand it: there is some unicode support with
chinese and japanese characters, but multibyte encoding seems not to be
supported in general; this can be done by converting from utf8 to someting
else first? )
- with images - there is support for png,raw and jpeg, but,as rjek pointed
out-not for gif (this one can be added basing on what we already have in
NetSurf)
There are still some developers working on this library, so these issues (esp.
the first one, the second and third can be worked around in some ways) should
be fixed someday. By now there are not critical obstacles.
Other possible choices, that I see, are:
- using cairo (has pdf surfaces, but with more limited functionality; rjek
complained about its dependiences)
- making a .ps and convert it with GS
- hacking some sources of a program with a suitable licence to extract the
needed functions
- finding another library ( although I made some research when writing my
proposal and during the last few days and I didn't find anything better )
So I am proposing to use Haru - what do you think about it?
Adam
15 years, 6 months
Patch to be tolerant of whitespace in URLs
by Philip Boulain
The attached patch makes url_normalize take care of whitespace in a
fairly useful way, consistent with other browsers:
- Leading and trailing whitespace is trimmed
- Internal whitespace is urlescaped
For example,
" http://www.google.co.uk/search?q=hello world "
becomes
"http://www.google.co.uk/search?q=hello%20world"
Explicit trailing whitespace, e.g. "...hello world%20", is left alone.
The upshot is that if you sloppily copy-paste a URL from IRC or whatnot
into the address bar, NetSurf no longer silently ignores you if you
caught some adjacent whitespace.
Apparently there are some badly-written websites out there in the wild
(who knew?) which don't escape their mid-URL whitespace properly,
either, so this should improve the chances of NetSurf working with them.
LionsPhil
15 years, 6 months
Re: r4177 mikeL - in /branches/mikeL/netsurf/gtk: dialogs/gtk_about.c gtk_scaffolding.c res/license res/netsurf.glade
by Rob Kendrick
On Mon, 2008-05-19 at 01:32 +0000, netsurf(a)semichrome.net wrote:
> Author: mikeL
> Date: Sun May 18 20:32:21 2008
> New Revision: 4177
>
> URL: http://source.netsurf-browser.org?rev=4177&view=rev
> Log:
> Redesigned about dialog as a GtkAboutDialog and removed the respective section from netsurf.glade (May need string revision)
I have some concerns with this commit;
* Artwork/Translations are duplicated. This is fine as long as we
still have the information on who did what.
* The one-per-line listing of the people involved feels wasteful, as
half the window is empty.
* It doesn't use the whole NetSurf logo, just the icon.
* The licence text is not in a fixed-pitch font, and it contains
preformatted sections, so looks odd/wrong in places.
Other concerns are in-line.
> Added: branches/mikeL/netsurf/gtk/dialogs/gtk_about.c
> URL: http://source.netsurf-browser.org/branches/mikeL/netsurf/gtk/dialogs/gtk_...
> ==============================================================================
> --- branches/mikeL/netsurf/gtk/dialogs/gtk_about.c (added)
> +++ branches/mikeL/netsurf/gtk/dialogs/gtk_about.c Sun May 18 20:32:21 2008
> @@ -1,0 +1,51 @@
> +/*
> + * Copyright 2008 Rob Kendrick <rjek(a)rjek.com>
This file is nothing to do with me :) You should put your own name and
email address here.
> + * This file is part of NetSurf, http://www.netsurf-browser.org/
> + *
> + * NetSurf is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * NetSurf is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "gtk/gtk_gui.h"
> +#include "desktop/browser.h"
> +
> +GtkAboutDialog* about_dialog;
> +
> +gchar *authors[] = {"Kevin Bagust", "John M Bell", "James Bursa", "Matthew Hambley", "Rob Jackson", "Rob Kendrick", "Jeffrey Lee", "Adrian Lees", "Phil Mellor", "Philip Pemberton", "Daniel Silverstone", "Andrew Timmins", "John Tytgat", "Richard Wilson", NULL};
> +gchar *translators = "Sebastian Barthel \nBruno D'Arcangeli \nMichael Drake \nAndrew Duffell \nRichard Hallas \nGerard van Katwijk \nJérôme Mathevet \nSimon Voortman.";
> +gchar *artists[] = {"Sebastian Barthel", "Bruno D'Arcangeli", "Michael Drake", "Andrew Duffell", "Richard Hallas", "Gerard van Katwijk", "Jérôme Mathevet", "Simon Voortman", NULL};
Why are the authors and artists listed as seperate strings, but the
translators are one string? Is this just an uglyness in the GTK API?
> +gchar *name = "NetSurf";
> +gchar *description = "Small as a mouse, fast as a cheetah, and available for free.\nNetsurf is a web browser for RISC OS and UNIX-like platforms.";
"NetSurf" has a capital S.
> +gchar *url = "http://www.netsurf-browser.org";
> +gchar *url_label = "NetSurf Website";
> +gchar *copyright = "Copyright © 2003 - 2008 The NetSurf Developers";
> +
> +gchar* license = "license";
"Licence" as a noun is spelt with a C, not an S. American English
doesn't have this distinction (they are interchangeable), but they do in
British English. (Think devise/device and advise/advice when you spell
license/licence - it's the same rule.)
Could all these variables be static? I don't think they need to be
accessed outside this link unit, and the pollute the namespace.
> +static void launch_url (GtkAboutDialog *about_dialog, const gchar *url, gpointer data){
> + struct browser_window *bw = data;
> + browser_window_go(bw, url, 0, true);
> + }
> +
> +void nsgtk_about_dialog_init(GtkWindow *parent, struct browser_window *bw, char *version) {
> + g_file_get_contents(g_strconcat(res_dir_location, license, NULL), &license, NULL, NULL);
> + gtk_about_dialog_set_url_hook (launch_url, (gpointer) bw, NULL);
> +
> + gtk_show_about_dialog(parent, "artists", artists, "authors", authors,
> + "comments", description,"copyright", copyright, "license", license,
> + "program-name", name, "translator-credits", translators,
> + "version", version, "website", url, "website-label", url_label,
> + "wrap-license", FALSE, NULL);
> +}
> +
>
> Modified: branches/mikeL/netsurf/gtk/gtk_scaffolding.c
> URL: http://source.netsurf-browser.org/branches/mikeL/netsurf/gtk/gtk_scaffold...
> ==============================================================================
> --- branches/mikeL/netsurf/gtk/gtk_scaffolding.c (original)
> +++ branches/mikeL/netsurf/gtk/gtk_scaffolding.c Sun May 18 20:32:21 2008
> @@ -35,6 +35,7 @@
> #include "gtk/gtk_plotters.h"
> #include "gtk/gtk_scaffolding.h"
> #include "gtk/dialogs/gtk_options.h"
> +#include "gtk/dialogs/gtk_about.c"
> #include "gtk/gtk_completion.h"
> #include "gtk/gtk_throbber.h"
> #include "gtk/gtk_history.h"
> @@ -666,8 +667,8 @@
>
> MENUHANDLER(about)
> {
> - gtk_widget_show(GTK_WIDGET(wndAbout));
> - gdk_window_raise(GTK_WIDGET(wndAbout)->window);
> + struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
> + nsgtk_about_dialog_init(gw->window, nsgtk_get_browser_for_gui(gw->top_level),netsurf_version);
> return TRUE;
> }
>
>
> Added: branches/mikeL/netsurf/gtk/res/license
> URL: http://source.netsurf-browser.org/branches/mikeL/netsurf/gtk/res/license?...
> ==============================================================================
> --- branches/mikeL/netsurf/gtk/res/license (added)
> +++ branches/mikeL/netsurf/gtk/res/license Sun May 18 20:32:21 2008
Could this be a symlink to the COPYING file instead, perhaps?
B.
15 years, 6 months
Keyboard navigation
by Balazs Kezes
Dear Netsurf community!
I'm applying to GSOC for keyboard navigation, but got no response yet,
and was told on IRC that I should post my ideas to the mailing list.
Here are they (a little revised from what is in the application):
My proposal's content from the user's perspective:
(this is mainly for the PC's keyboard, but can be extended for others too)
- One-key default shortcuts for the most basic operations - like in Opera, for
example
F8 - focus the address bar
Z/Backspace - navigate back in history
X/Shift+Backspace - navigate forward in history
maybe J,K,^F,^B,^D,^U - scrolling the content for Vi fanatics
etc.
- highlight current text field - this is beneficial for the user for detecting
where is his focus as Jeff Atwood points out
[http://www.codinghorror.com/blog/archives/001055.html]
- TAB and SHIFT-TAB for jumping between text fields (for example at login
screens)
- keyboard navigation - when the Shift key is being pressed, a little number or
character or string of characters next to each link is displayed on the
screen, which when typed on keyboard focuses that link. Four links will be
special which next to the string also display a little custom colored arrow,
each with different color, with the meaning which will be the next focused
link when navigated with Shift+Arrows (this is called spatial navigation)
An alternative way for displaying those strings next to the links without
worrying ALT/CTRL/SHIFT portability problems is to do it the Konqueror way:
hit and release CTRL. Just try it in Konqueror. It is pretty neat,
pretty much what I have on mind, but in K. it is restricted only to one
character.
Altogether this is something like the spatial navigation + keyboard links
together.
The workarounds for the pages with lots of links or with long
scrollable content should also be discussed well.
The typing of links is very similar to MS Office's new GUI and to a Firefox
extension or to Konqueror for which I have no screenshot (unfortunately I
don't have much time to do it right now):
again, a Jeff Atwood article for a screen shot of Office
[http://www.codinghorror.com/blog/archives/000825.html], and a screen shot of
hit-a-hint can be found here:
[http://weblogs.asp.net/jgalloway/archive/2006/06/14/Mouseless-Computing.aspx]
- support for Access Keys - [http://en.wikipedia.org/wiki/Access_keys]
Konqueror seems to use this effectively in his navigation
(when you press Ctrl twice)
What do you think? Are these feasible ideas?
Thank you!
Bye!
Balazs Kezes
15 years, 7 months
Re: NetSurf Fails on Fedora 9
by Leon Stringer
John-Mark Bell wrote:
> On Sun, 4 May 2008, Leon Stringer wrote:
>
>> Without these lines access to HTTP and HTTPS sites seems to work fine
>> so I'm not sure they're necessary. But I'm not a libcurl or SSL expert
>> so maybe there's a very good reason for them?
>
> It's required so that we can present certificate details to the user
> when it fails to verify. This only works with libcurl+openssl because
> libcurl doesn't provide access to the underlying SSL library handle for
> other SSL implementations. We've never attempted to use any other SSL
> implementation so, while https connections to sites with valid
> certificates may work, all bets are off when invalid certificates are
> encountered.
>
Thanks for your reply. So basically this is working by accident with
Fedora 8 and earlier and won't work with Fedora 9 and later (and
possibly other distros). With this in mind, although I appreciate it's
not a NetSurf bug, I've filed this as a bug
(https://sourceforge.net/tracker/?func=detail&atid=464312&aid=1957289&grou...)
as presumably it's something to be aware of...
15 years, 7 months