SoC'08 SVG Fonts application
As suggested on http://wiki.inkscape.org/wiki/index.php/SOC_Writing_Project_Proposals I am sending you a first draft of my application so that you can comment on it. I also expect to find out who would be interested in mentoring this one.
Please, tell me if I forgot to mention something important. JucaBlues
== About Me == My name is Felipe C. da S. Sanches, known on Inkscape community as JucaBlues. I study Electrical Engeneering with emphasys on Telecomunications on University of São Paulo, Brazil. My contributions to Inkscape are described later on this SoC application.
I like a lot to deal with computer graphics and I have been ploting pixels since 11 years old, when I started to learn computer programming by myself on an old 386 with QBASIC and MS-DOS. Later I learned C, C++ and x86 Asm. Recently I have also played a bit with javascript and python.
Currently I am working 20 hours a week on web development (using the django framework) on a brazilian startup. I will continue employed there during SoC.
I have some small free software projects started by myself. Often very small and unimportant stuff. During some time I have contributed with bug reporting and feature requests to some big projects such as Mediawiki and Firefox, and I have aprox. 3 lines of code incorporated in DemocracyTV (now called Miro), but I did not get commit rights on those projects, so I won't count them. The first big project I am involved with a lot of coding is Inkscape.
== My first contact with Inkscape == I first heard about Inkscape when I was looking for a free software drawing tool. I needed to draw the schematics of wood cuts for my pinball machine. You can see my (not yet finished) homebrew pinball machine at www.flickr.com/photos/felipesanches By that time Inkscape was on version 0.43 and I remember I got very impressed by the about screen drawing.
== How I got interested on coding for inkscape == After some time I started designing some SVG images for my hexamines game ( http://code.google.com/p/hexamines/). I had to set the CC-licensing metadata for a lot of files and I didn't know it was possible to do it easily using templates, so I decided to write a patch to make a "default metadata settings" UI. This patch, and a fix to a bug in itself, gave me svn commit rights. Later, the patch was considered confusing and not that much useful and was reverted. But since I saw myself, for the first time, with commit access to a free software project, I got excited about that and decided to pick something to work on. I saw some work going on filters UI (Nicholas Bishopp's SoC) and decided that filter renderers would be something cool to implement.
== Work done on Inkscape == Last year I have implemented in Inkscape some of the SVG filter renderers. More precisely, these ones: feTurbulence, feDisplacementMap, feFlood, feColorMatrix, feConvolveMatrix, feImage, feMorphology and feComponentTransfer. I have also worked a bit on the filters user interface. I have implemented the filters infobox (which gives users instructions on what each filter primitive does). I have designed all of the icons used on this infobox(*). I have also added all of the tooltips for the filters UI.
I have recently adapted the 0.46 About Screen to some languages, based on advice given by people at inkscape-translator list.
== What I intend to do on GSoC'08 ==
Basic SVG Font rendering support. This does not include UI for the SVG Fonts.
=== Parameter loading === Some time ago I started work on sp-font.{cpp,h}, sp-glyph.{cpp,h}, sp-missing-glyph.{cpp,h} and sp-glyph-kerning.{cpp,h}. These are not functional yet. I intend to complete their implementation, so that svg parameters related to SVG Fonts are correctly parsed. This will probably also need refactoring (as I understand that having these implemented as C++ classes is a main target for 0.47) I will need advice on the refactoring part of this task. (or, alternativelly, I will look at already refactored code in order to find out)
=== Laying Out Text === I intend to write code that uses Pango to layout text that uses SVG Fonts. Although I have never used pango before, so this is the part of my SoC work where I mostly need advice.
I suppose that it is possible to setup a font and provide its metrics and details to pango, and then hook the glyphs handled by pango on code that properly creates the NRArenaItems and render the glyphs that are described by arbitrary SVG. It will depend on the capability of reading the proper coordinates of the glyphs after being laid out by pango.
I also heard something about cairo's user font support. I wish somebody could explain this to me. This part of my SoC proposal can be improved once I figure out these things clearer.
=== future ideas (not to be implemented for SoC'08) === Here I include some ideas that I would possibly work on after I finish the SoC tasks.
* SVG Fonts to TrueType (or other font formats) conversion and vice-versa * SVG Fonts User Interface
Offtopic Notes: (*) The bird photograph was shot by my daddy. If you are interested, you can take a look at his work at www.flickr.com/photos/dariosanches
Felipe Sanches wrote:
I also heard something about cairo's user font support. I wish somebody could explain this to me. This part of my SoC proposal can be improved once I figure out these things clearer.
Currently cairo has three font backends: FreeType, Win32, and Quartz. There is a fourth, the toy font backend, but that exists only to provides a simple interface to one of the other font backends (depending on your platform) to be used for simple demos and examples.
Cairo can only use the fonts that are supported by these font backends which basically means that only TrueType, OpenType, and Type 1 fonts are supported. Some less common formats are also supported by some font backends.
The user-font support allows applications to provide cairo with a callback function for rendering fonts. The application receives the call to render each glyph and uses the cairo API to draw the glyph.
A simplified view of the API is:
cairo_public cairo_font_face_t * cairo_user_font_face_create (void);
This creates a new user-font.
typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scaled_font_t *scaled_font, unsigned long glyph, cairo_t *cr, cairo_text_extents_t *extents);
This is the render function that the application must implement. When cairo needs to draw a user-font glyph it calls this function with the glyph id of the glyph to render. The font size can be obtained from scaled_font with cairo_scaled_font_get_font_matrix(). The application draws the glyph onto the supplied cairo content.
cairo_public void cairo_user_font_face_set_render_glyph_func ( cairo_font_face_t *font_face, cairo_user_scaled_font_render_glyph_func_t render_glyph_func);
This sets the render function for the user-font with font_face.
=== future ideas (not to be implemented for SoC'08) === Here I include some ideas that I would possibly work on after I finish the SoC tasks.
- SVG Fonts to TrueType (or other font formats) conversion and vice-versa
You may want to look at the TrueType subsetting code in cairo so see how it pulls apart and re-assembles a TrueType font. Although one difference is the cairo subsetter is designed copy the original glyphs in the GLYF table into the subset to preserve the hinting. A SVG to TTF converter would need to generate the GLYF table from the SVG outlines.
One problem with converting SVG fonts to TrueType is that SVG glyphs can have cubic Bézier curves while the TrueType format only supports quadratic Bézier curves. For this reason converting to Type 1 or OpenType with PostScript outlines is easier. Cairo has code for creating Type 1 or CFF fonts from outlines. CFF fonts are the PostScript outlines in OpenType/PS fonts.
Potential mentors for SVG Fonts, this is the final revision of my SoC application (as submitted today).*
Abstract* *
*SVG Fonts is a feature described on section 20 of the SVG 1.1 specification that allows fonts to be described using SVG. It can be used to embbed a font into an SVG document so that the author can be sure that the document will be properly rendered in any SVG compliant viewer, not depending on specific fonts being installed on the user's system.
SVG Fonts can also enhance acessibility of documents because text is stored as strings in the xml file. This way, artwork containing text can be read by screen reader software. Also, adaptation of artwork to other languages is easier when text is stored in strings.
I will implement basic SVG Fonts rendering into Inkscape using Cairo's user-font support and Pango.
*Detailed Description*
1. About Me 2. My first contact with Inkscape 3. How I got interested on coding for inkscape 4. Work done on Inkscape 5. What I intend to do on GSoC'08 5.1 Parameter loading 5.2 Laying out text and rendering 6. future ideas (not to be implemented for SoC'08) 7. Off-topic notes
1. About Me
My name is Felipe C.orrêa da Silva Sanches, known on Inkscape community as JucaBlues. I study Electrical Engeneering with emphasys on Telecomunications on University of São Paulo, Brazil. My contributions to Inkscape are described later on this SoC application.
I like a lot to deal with computer graphics and I have been ploting pixels since 11 years old, when I started to learn computer programming by myself on an old 386 with QBASIC and MS-DOS. Later I learned C, C++ and x86 Asm. Recently I have also played a bit with javascript and python.
Currently I am working 20 hours a week on web development (using the django framework) on a brazilian startup. I will continue employed there during SoC.
I have some small free software projects started by myself. Often very small and unimportant stuff. During some time I have contributed with bug reporting and feature requests to some big projects such as Mediawiki and Firefox, and I have aprox. 3 tiny lines of code incorporated in DemocracyTV (now called Miro), but I did not get commit rights on those projects, so I won't count them. The first big project I am involved with a lot of coding is Inkscape.
2. My first contact with Inkscape I first heard about Inkscape when I was looking for a free software drawing tool. I needed to draw the schematics of wood cuts for my pinball machine(*). By that time Inkscape was on version 0.43 and I remember I got very impressed by the about screen drawing.
3. How I got interested on coding for inkscape After some time I started designing some SVG images for my hexamines game(**). I had to set the CC-licensing metadata for a lot of files and I didn't know it was possible to do it easily using templates, so I decided to write a patch to make a "default metadata settings" UI. This patch, and a fix to a bug in itself, gave me svn commit rights. Later, the patch was considered confusing and not that much useful and was reverted. But since I saw myself, for the first time, with commit access to a free software project, I got excited about that and decided to pick something to work on. I saw some work going on filters UI (Nicholas Bishopp's SoC) and decided that filter renderers would be something cool to implement.
4. Work done on Inkscape Last year I have implemented in Inkscape some of the SVG filter renderers. More precisely, these ones: feTurbulence, feDisplacementMap, feFlood, feColorMatrix, feConvolveMatrix, feImage, feMorphology and feComponentTransfer. I have also worked a bit on the filters user interface. I have implemented the filters infobox (which gives users instructions on what each filter primitive does). I have designed all of the icons used on this infobox(***). I have also added all of the tooltips for the filters UI.
I have recently adapted the 0.46 About Screen to some languages, based on advice given by people at inkscape-translator list.
5. What I intend to do on GSoC'08
Basic SVG Font rendering support. This does not include UI for the SVG Fonts.
5.1 Parameter loading Some time ago I started work on sp-font.{cpp,h}, sp-glyph.{cpp,h}, sp-missing-glyph.{cpp,h} and sp-glyph-kerning.{cpp,h}. These are not functional yet. I intend to complete their implementation, so that svg parameters related to SVG Fonts are correctly parsed. This will probably also need refactoring (as I understand that having these implemented as C++ classes is a main target for 0.47) I will need advice on the refactoring part of this task. (or, alternativelly, I will look at already refactored code in order to find out)
5.2 Laying out text and rendering I intend to write code that uses Pango to layout text that uses SVG Fonts and then use the new user-font support on Cairo to render it. Although I have never used Pango and Cairo before, so this is the part of my SoC work where I mostly need advice.
I have been chatting about this on irc and on the inkscape-devel list. Cworth told me that Cairo 1.6 will have this new user-font feature which will be useful for the task. I was wondering when the release will be so that we have time to incorporate it during SoC. Since Cairo 1.6 is scheduled for Ubuntu Hardy, I think we shouldn't worry. Also, since Behdad, the developer of user-font, is also maintainer of Pango, we can hopefully have the proper Pango support soon, also.
Probably, a first step would be to render SVG Fonts which describe their glyphs using only the d "path" attribute. Once this works, I can work on loading general glyphs which use arbitrary SVG.
6. future ideas (not to be implemented for SoC'08) Here I include some ideas that I would possibly work on after I finish the SoC tasks.
- SVG Fonts to TrueType (or other font formats) conversion and vice-versa - SVG Fonts User Interface
7. Off-topic notes (*) You can see my (not yet finished) homebrew pinball machine at www.flickr.com/photos/felipesanches (**) http://code.google.com/p/hexamines/ (***) The bird photograph was shot by my daddy. If you are interested, you can take a look at his work at www.flickr.com/photos/dariosanches
participants (2)
-
Adrian Johnson
-
Felipe Sanches