Font fall back support for inkscape
![](https://secure.gravatar.com/avatar/d47b17fec39e811c53a5d23f1fe30c36.jpg?s=120&d=mm&r=g)
Hello everybody,
I am a selected candidate for GSoC 2011 and contributed to inkscape in GSoC 2010 as well. I am looking to start the development of font fall back support in inkscape. As discussed with my mentor Tavmjong its a required item and shall be very helpful to inkscape. And as all the readers of this mail might have guessed, I am writing this mail to have the inputs of inskcape developers on this. I would love to have your comments which can help me answer questions like - Where to look into the code, What to change, What to add should it be anew class or an added functionality to a pre-existing class, questions of these sort. Waiting earnestly for all of your responses :)
![](https://secure.gravatar.com/avatar/d47b17fec39e811c53a5d23f1fe30c36.jpg?s=120&d=mm&r=g)
I am eagerly waiting for all of your responses !!!!!
On Wed, Jun 15, 2011 at 1:37 PM, Abhishek Sharma <sharma.abhishek.it@ gmail.com> wrote:
Hello everybody,
I am a selected candidate for GSoC 2011 and contributed to inkscape in GSoC 2010 as well. I am looking to start the development of font fall back support in inkscape. As discussed with my mentor Tavmjong its a required item and shall be very helpful to inkscape. And as all the readers of this mail might have guessed, I am writing this mail to have the inputs of inskcape developers on this. I would love to have your comments which can help me answer questions like - Where to look into the code, What to change, What to add should it be anew class or an added functionality to a pre-existing class, questions of these sort. Waiting earnestly for all of your responses :)
-- Regards,
Abhishek Sharma
![](https://secure.gravatar.com/avatar/84524eb6e916f5d548e7c7c0e41fd127.jpg?s=120&d=mm&r=g)
Let me try to get the discussion started:
An SVG may use a font that is not on the rendering computer. CSS allows an artist to define a list of alternative fonts to use instead. In principle, the use of an SVG font or a WOFF font would avoid this problem, but Inkscape supports neither.
The scope of Abhishek's work will be limited to parsing a font list correctly and getting Inkscape to use the first available font in the list. It does not include things like adding a way to define the list or to enable/disable fonts in the list for testing.
One question is when should the CSS entry be turned into a list? It could be done in the initial parsing of the CSS but I have a feeling it might be better done later. One could even imagine that it be done at the last moment, then a list could be created using the existing font name entry box.
Tav
On Thu, 2011-06-16 at 07:31 -0400, Abhishek Sharma wrote:
I am eagerly waiting for all of your responses !!!!!
On Wed, Jun 15, 2011 at 1:37 PM, Abhishek Sharma <sharma.abhishek.it@...400...> wrote: Hello everybody,
I am a selected candidate for GSoC 2011 and contributed to inkscape in GSoC 2010 as well. I am looking to start the development of font fall back support in inkscape. As discussed with my mentor Tavmjong its a required item and shall be very helpful to inkscape. And as all the readers of this mail might have guessed, I am writing this mail to have the inputs of inskcape developers on this. I would love to have your comments which can help me answer questions like - Where to look into the code, What to change, What to add should it be anew class or an added functionality to a pre-existing class, questions of these sort. Waiting earnestly for all of your responses :) -- Regards, Abhishek Sharma
-- Regards,
Abhishek Sharma
![](https://secure.gravatar.com/avatar/03e0d5cf6f173f88af40808ef41b599c.jpg?s=120&d=mm&r=g)
On Thursday, June 16, 2011, 7:56:43 PM, Tavmjong wrote:
TB> The scope of Abhishek's work will be limited to parsing a font list TB> correctly and getting Inkscape to use the first available font in the TB> list.
I just wanted to point out that this is not the correct behaviour (and in fact there is a test in the SVG 1.1 test suite which specifically tests for this behaviour, and produces a fail if the implementation always picks the first available font in the list).
Instead, the list should be parsed and each character in the text should be displayed using the first font in the list which is a) available b) has a glyph for that character
![](https://secure.gravatar.com/avatar/84524eb6e916f5d548e7c7c0e41fd127.jpg?s=120&d=mm&r=g)
On Fri, 2011-06-17 at 17:45 +0200, Chris Lilley wrote:
On Thursday, June 16, 2011, 7:56:43 PM, Tavmjong wrote:
TB> The scope of Abhishek's work will be limited to parsing a font list TB> correctly and getting Inkscape to use the first available font in the TB> list.
I just wanted to point out that this is not the correct behaviour (and in fact there is a test in the SVG 1.1 test suite which specifically tests for this behaviour, and produces a fail if the implementation always picks the first available font in the list).
Instead, the list should be parsed and each character in the text should be displayed using the first font in the list which is a) available b) has a glyph for that character
Interesting. I doubt that Inkscape will ever implement the correct behavior as it would require that Inkscape be able to do all the book keeping to know which characters are available in which font. At the moment we use Pango to come up with the best match for a given font specification. Getting Inkscape to use the first available font in the list will be a small step forward (right now it treats a font list as a single font name and thus won't match anything).
BTW, only GPAC, Abbra, and Webkit pass the test; whether or not this is due to lack of SVG font support is not clear.
Tav
![](https://secure.gravatar.com/avatar/014b988254e77ad61312267eb1d2d696.jpg?s=120&d=mm&r=g)
On Fri, Jun 17, 2011 at 12:15 PM, Tavmjong Bah <tavmjong@...8...> wrote:
On Fri, 2011-06-17 at 17:45 +0200, Chris Lilley wrote:
On Thursday, June 16, 2011, 7:56:43 PM, Tavmjong wrote:
TB> The scope of Abhishek's work will be limited to parsing a font list TB> correctly and getting Inkscape to use the first available font in the TB> list.
I just wanted to point out that this is not the correct behaviour (and in
fact there is a test in the SVG 1.1 test suite which specifically tests for this behaviour, and produces a fail if the implementation always picks the first available font in the list).
Instead, the list should be parsed and each character in the text should
be displayed using the first font in the list which is
a) available b) has a glyph for that character
Interesting. I doubt that Inkscape will ever implement the correct behavior as it would require that Inkscape be able to do all the book keeping to know which characters are available in which font. At the moment we use Pango to come up with the best match for a given font specification. Getting Inkscape to use the first available font in the list will be a small step forward (right now it treats a font list as a single font name and thus won't match anything).
I will say that regarless of what appears to be the likelihood of things getting implemented. It would be nice if Abhishek documents the code in various places where he can put TODOs about what the proper way to do things is vs how it currently works. This to me seems ideal so that if someone is in that code in the future and that functionality strikes them as particularly useful, they may be motivated to add it in.
Cheers, Josh
![](https://secure.gravatar.com/avatar/d47b17fec39e811c53a5d23f1fe30c36.jpg?s=120&d=mm&r=g)
Hello everybody,
May anybody please give me heads up as to what inskcape does(effectively which function it calls or which class it refers) when it reads a new svg file and checks its style for its fonts. I have already looked into FontFactory and the only function which it has for reading font spec from SPStyle is FaceFromStyle. But this function doesn't get called when a new svg is loaded(verified it through printf and gtk_dialog_new, none of them give a response on a new svg loaded). So any heads up on this will be really helpful. I shall be highly thankful.
On Sun, Jun 19, 2011 at 12:00 AM, Josh Andler <scislac@...400...> wrote:
On Fri, Jun 17, 2011 at 12:15 PM, Tavmjong Bah <tavmjong@...8...> wrote:
On Fri, 2011-06-17 at 17:45 +0200, Chris Lilley wrote:
On Thursday, June 16, 2011, 7:56:43 PM, Tavmjong wrote:
TB> The scope of Abhishek's work will be limited to parsing a font list TB> correctly and getting Inkscape to use the first available font in
the
TB> list.
I just wanted to point out that this is not the correct behaviour (and
in fact there is a test in the SVG 1.1 test suite which specifically tests for this behaviour, and produces a fail if the implementation always picks the first available font in the list).
Instead, the list should be parsed and each character in the text should
be displayed using the first font in the list which is
a) available b) has a glyph for that character
Interesting. I doubt that Inkscape will ever implement the correct behavior as it would require that Inkscape be able to do all the book keeping to know which characters are available in which font. At the moment we use Pango to come up with the best match for a given font specification. Getting Inkscape to use the first available font in the list will be a small step forward (right now it treats a font list as a single font name and thus won't match anything).
I will say that regarless of what appears to be the likelihood of things getting implemented. It would be nice if Abhishek documents the code in various places where he can put TODOs about what the proper way to do things is vs how it currently works. This to me seems ideal so that if someone is in that code in the future and that functionality strikes them as particularly useful, they may be motivated to add it in.
Cheers, Josh
EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
![](https://secure.gravatar.com/avatar/82c0f6eed0ee59676eb45aadd66dac57.jpg?s=120&d=mm&r=g)
On 2011-06-23 19:40, Abhishek Sharma wrote:
May anybody please give me heads up as to what inskcape does(effectively which function it calls or which class it refers) when it reads a new svg file and checks its style for its fonts. I have already looked into FontFactory and the only function which it has for reading font spec from SPStyle is FaceFromStyle. But this function doesn't get called when a new svg is loaded(verified it through printf and gtk_dialog_new, none of them give a response on a new svg loaded). So any heads up on this will be really helpful. I shall be highly thankful.
I'm no expert on the matter (so if anyone simply knows the answer, feel free to chime in), but SPTextStyle appears to be the "access point" for font styles, so what if you simply "knock it out" and see what breaks? Crude, I know, but it can be quite effective.
![](https://secure.gravatar.com/avatar/d47b17fec39e811c53a5d23f1fe30c36.jpg?s=120&d=mm&r=g)
Hi,
I am sorry but I just noticed that when you CLICK on the text which was loaded from the file then the print statement does get executed(in the FaceFromStyle) and that too at every interaction(clicking, dragging, expanding, almost anything). So the new question is, what happens for the first time?? From where does it read the style values if it does not call this function???
On Thu, Jun 23, 2011 at 11:56 PM, Jasper van de Gronde < th.v.d.gronde@...528...> wrote:
On 2011-06-23 19:40, Abhishek Sharma wrote:
May anybody please give me heads up as to what inskcape does(effectively which function it calls or which class it refers) when it reads a new svg file and checks its style for its fonts. I have already looked into FontFactory and the only function which it has for reading font spec from SPStyle is FaceFromStyle. But this function doesn't get called when a new svg is loaded(verified it through printf and gtk_dialog_new, none of them give a response on a new svg loaded). So any heads up on this will be really helpful. I shall be highly thankful.
I'm no expert on the matter (so if anyone simply knows the answer, feel free to chime in), but SPTextStyle appears to be the "access point" for font styles, so what if you simply "knock it out" and see what breaks? Crude, I know, but it can be quite effective.
Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
![](https://secure.gravatar.com/avatar/d47b17fec39e811c53a5d23f1fe30c36.jpg?s=120&d=mm&r=g)
Hi all,
I was debugging inkscape with eclipse recently and found out that sp_text_build was called out every time a new file is loaded. Is this where font initialization takes place. Please confirm anybody.
On Fri, Jun 24, 2011 at 12:22 AM, Abhishek Sharma <sharma.abhishek.it@ gmail.com> wrote:
Hi,
I am sorry but I just noticed that when you CLICK on the text which was loaded from the file then the print statement does get executed(in the FaceFromStyle) and that too at every interaction(clicking, dragging, expanding, almost anything). So the new question is, what happens for the first time?? From where does it read the style values if it does not call this function???
On Thu, Jun 23, 2011 at 11:56 PM, Jasper van de Gronde < th.v.d.gronde@...528...> wrote:
On 2011-06-23 19:40, Abhishek Sharma wrote:
May anybody please give me heads up as to what inskcape does(effectively which function it calls or which class it refers) when it reads a new svg file and checks its style for its fonts. I have already looked into FontFactory and the only function which it has for reading font spec from SPStyle is FaceFromStyle. But this function doesn't get called when a new svg is loaded(verified it through printf and gtk_dialog_new, none of them give a response on a new svg loaded). So any heads up on this will be really helpful. I shall be highly thankful.
I'm no expert on the matter (so if anyone simply knows the answer, feel free to chime in), but SPTextStyle appears to be the "access point" for font styles, so what if you simply "knock it out" and see what breaks? Crude, I know, but it can be quite effective.
Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
-- Regards,
Abhishek Sharma
![](https://secure.gravatar.com/avatar/ad7c76b9aa8758315397d0dfb15fc222.jpg?s=120&d=mm&r=g)
On Jun 24, 2011, at 6:49 AM, Abhishek Sharma wrote:
Hi all,
I was debugging inkscape with eclipse recently and found out that sp_text_build was called out every time a new file is loaded. Is this where font initialization takes place. Please confirm anybody.
Eeeeek!!!
Well... I might not be surprised. We had quite a bit of code that relied on things being initialized in GUI construction, so having things pop up in odd places is not surprising. I'll see if I can verify some of this and abetter approach.
participants (6)
-
Abhishek Sharma
-
Chris Lilley
-
Jasper van de Gronde
-
Jon Cruz
-
Josh Andler
-
Tavmjong Bah