Archive for the ‘Lasem’ Category

SVG Filters

Monday, October 15th, 2012

I’ve finally found the motivation to begin the implementation of SVG filters in lasem. It’s still pretty rough, there’s a lot of bugs to fix and things to finish, but when I’ve tried to render icons from gnome-icon-theme, a very large subset of this theme renders fine. Here’s an example:

For now, feGaussianBlur, feOffset, feBlend, feMerge, feMergeNode, feComposite and feFlood are supported. Support the remaining filter primitive should appear soon. Fortunately, I’m able to use Caleb Moore’s librsvg code (same license) for the filter algorithms, even if I try to use cairo API when possible.

I’ve done some work on markers, fixing overflow and automatic marker orientation:

I’ve also lately worked on the robustness of lasem, by importing in the test suite a lot of the attached files in librsvg bug reports, thanks to Olav Vitters who gave me the method for an automatic extraction of attached files in bugzilla. I’ve first downloaded the result of a bugzilla query as xml, then wrote a small script which finds attachement url and retrieves them.

Here’s the script (be careful if you use it, as bugzilla will ban you if you download a large amount of data):

#!/bin/python
# coding=utf-8

import urllib2
import xml.dom
import time
import os
import sys
import codecs
import subprocess
import locale
from xml.dom.minidom import parseString

def getText (element, tag):
        nodelist = element.getElementsByTagName (tag)[0].childNodes
        rc = []
        for node in nodelist:
                if node.nodeType == node.TEXT_NODE:
                        rc.append(node.data)
        return ''.join(rc)

count = 0

file = open('librsvg.xml')
data = file.read()
file.close()

dom = parseString(data)

bugs = dom.getElementsByTagName('bug')
for bug in bugs:
        bug_id = getText (bug, 'bug_id')
        attachments = bug.getElementsByTagName('attachment')
        for attachment in attachments:
                if attachment.getAttribute('ispatch') != "1":
                        attachment_id = getText (attachment, 'attachid')
                        type = getText (attachment, 'type')
                        if type == 'image/svg+xml' or type == 'image/png':
                                filename = getText (attachment, 'filename')

                                url = "http://bugzilla-attachments.gnome.org/attachment.cgi?id=%s" % attachment_id
                                output_filename = "librsvg/librsvg-bug%s-%s" % (bug_id, filename)
                                input_file = urllib2.urlopen( url)
                                data = input_file.read ()
                                input_file.close ()

                                output_file = open(output_filename, 'w')
                                output_file.write (data)
                                output_file.close ()

                                time.sleep (5)
                                count = count + 1

print count

FTP and Bugzilla for Lasem

Sunday, May 3rd, 2009

With the help of Chritian Rose and Christian Kirbach, Lasem now has its tarballs published on ftp.gnome.org:

http://ftp.gnome.org/pub/GNOME/sources/lasem/

And a bugzilla product:

http://bugzilla.gnome.org/enter_bug.cgi?product=lasem

Lasem git repository

Thursday, April 23rd, 2009

Since gnome has finished its SVN to git conversion, I’ve created a repository for lasem on git.gnome.org.

Here’s the direct link:

http://git.gnome.org/cgit/lasem/

I still have to ask for a mailing list and a bugzilla product…

GMathml is dead, long live Lasem

Saturday, April 11th, 2009

Since GMathml is no longer only a MathML library, but can also render SVG now, I have renamed it to Lasem. The name comes from the city of Lasem, known for its batik manufactures. It could be the acronym for “Library for Awesome SVG and Exceptional MathML”. But to be honest, it’s more an acronym for “Library for Awful SVG and Eccentric MathML”.

Only a really small subset of SVG 1.1 is supported for now. Here’s some samples of what can do Lasem:

paths-data-02-t

paths-data-02-t

pservers-grad-06-b

pservers-grad-06-b

coords-trans-01-b

coords-trans-01-b

Equations in gnumeric

Tuesday, December 9th, 2008

The last few days, I’ve added a preliminary support for equations in the goffice charting engine. I’ve made a little screencast showing the new equation object in action:


Gnumeric equation in action from Emmanuel Pacaud on Vimeo.

GMathml

Tuesday, December 9th, 2008

For some months (actually almost one year), I’m working on a mathml renderer based on gobject and cairo, with a DOM like interface. It has started as a vala experiment, but after a few weeks, after being blocked in my work by some bugs or missing features, I came back to raw gobject programming. Most of the vala bugs I’ve encountered are probably fixed by now, so it’s possible I’ll try to get back to vala one day.

The git repository is here:

http://cgit.freedesktop.org/~emmanuel/gmathml/

which can be cloned using the following command:


git clone git://anongit.freedesktop.org/~emmanuel/gmathml

It consists in a library, libgmathml, and a small rendering application, gmathmlrender, which is able to output to either PNG, PDF or SVG. In addition to mathml, gmathml also understand itex, by the mean of itex2mml (http://golem.ph.utexas.edu/~distler/blog/itex2MML.html).

For example, the following equation:


\left\langle {a + a \over x - a} | \epsilon_\Xi(a) \right\rangle = \left\{ \frac{1}{N} \sum_{i=0}^N \frac{x^i}{i!} + \Xi \int_0^x \epsilon_0(at) \, dt \right\}

Gives:

Sample PNG output

Sample PNG output

The same using the PDF output.

Here’s the reference image, produced by latex:

Reference image

Reference image

The project is far from finished, but it’s almost in a usable state, so I’ll probably do a release soon.