Variable Fonts support in Inkscape

379 views
Skip to first unread message

Felipe Sanches

unread,
May 29, 2017, 3:48:41 PM5/29/17
to googlefonts-discuss
I'm working on implementing Opentype Variable fonts support in Inkscape (based on a mix of pango and harfbuzz APIs).

While testing the current pango-based text handling implementation in Inkscape I tried to edit some arabic text (with several ligatures, naturally) and I ended up finding a crasher bug. I have just reported it at:

https://bugs.launchpad.net/inkscape/+bug/1694323

I'll be using this thread to liberally report ongoing progress on this effort.

happy hacking,
Felipe Sanches

Felipe Sanches

unread,
May 29, 2017, 11:35:29 PM5/29/17
to googlefonts-discuss
Today I was able to modify Inkscape's glyph loading routine to detect whether or not a given font has any OpenType variable font design space axis available. If so, then I'm printing to the terminal the metadata of each axis such as name, minimum-value, maximum-value and default-value.

Then I made it setup the font with a harcoded set of design-space coordinates, so that I could at least see some different vectors being rendered on the SVG canvas. The image attached to this message has an example of rendering the Decovar variable font loaded on Inkscape with both the "Weight" and the "Terminal Flared" axis boosted to their max values.

All of this was done directly with the Freetype API. (FT_HAS_MULTIPLE_MASTERS, FT_Get_MM_Var, FT_Var_Axis, FT_Set_Var_Design_Coordinates) At this point it only affects the glyph outline loading. All other aspects of a variable font are not yet taken into consideration. For instance, shaping is still performed by pango_shape() with no clue that we're using a specific instance of a variable font. I'll still have to figure out how to make pango (and/or harfbuzz) aware of it.

The relationship between pango and harfbuzz is still not very clear to me, as I have the impression that even pango_shape() invokes hb_shape() under the hood nowadays. But I may be wrong about that.

Also, there's still plenty to be done in terms of hooking this up with both the user interface and the underlying XML schema.

happy hacking,
Felipe Sanches


Screenshot at 2017-05-30 00:21:57.png

Khaled Hosny

unread,
May 30, 2017, 6:48:44 AM5/30/17
to googlefon...@googlegroups.com
On Tue, May 30, 2017 at 12:35:24AM -0300, Felipe Sanches wrote:
> The relationship between pango and harfbuzz is still not very clear to me,
> as I have the impression that even pango_shape() invokes hb_shape() under
> the hood nowadays.

It will eventually call HarfBuzz on Linux, but in Windows and Mac it
will call Uniscribe and Core Text, respectively. Switching to HarfBuzz
on all platforms is kinda on Pango’s TODO list, but I don’t think anyone
is working on it currently.

Felipe Sanches

unread,
Jun 2, 2017, 9:35:34 PM6/2/17
to googlefonts-discuss, Inkscape Devel List
Hi there,

These past days I've been adding an experimental UI to Inkscape for tweaking parameters in OpenType variable fonts. One major roadblock I stumbled upon is requiring me to think more carefully about some potentially deeper architectural changes. In the screenshot attached to this message you can see some text written with the Decovar variable font. The slider labeled "Testing" in the "Text & Font" dialog is wired to invoke a callback upon value-change. This callback detects the currently selected font based on the canvas text-tool cursor position, retrieves the corresponding font_instance object and invokes Freetype's FT_Set_Var_Design_Coordinates method with the updated design-space coordinates (the slider in this experiment is hardwired to adjust the weight axis of Decovar).

(I really miss a Freetype method to alter a single design-space coordinate, instead of having to pass the full array, by the way)

The way things work right now, unfortunately, leads to the glyphs not changing on-canvas because once they are loaded, they seem to be kept in a cache. As you can see in the screenshot, each glyph has a different weigth, based on the slider setting when the glyph was loaded for the first time. It seems quite obvious that I should do something to invalidate the cache upon dragging the slider. But that, on the other hand, should not alter glyphs in other places where the same variable font is being used in the same document.

Based on all that, I think that the proper implementation would involve creating individual font_instance objects for each text chunk where a variable-font is used with non-default design-space coordinates so that they can be tweaked independently. Achieving that, though, will surely involve a bit deeper fiddling with Inkscape's text internals, which is what I expect to do in my next few days of work on this.

cheers,
Felipe Sanches

PS:
I'm crossposting this to the Inkscape-devel mailing list as the rest of the development community may be interested in receiving updates on this topic. I may as well move all future updates to the Inkscape mailing list directly.

PS2: I heard that there's a GSoC student this year who's going to work on Inkscape's text implementation (fixing compliance issues to the SVG spec, I think...) It would be really great to keep in contact with him/her and the mentor to coordinate efforts.



--
You received this message because you are subscribed to the Google Groups "Google Fonts Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlefonts-discuss+unsub...@googlegroups.com.
To post to this group, send email to googlefonts-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/googlefonts-discuss.
To view this discussion on the web visit https://groups.google.com/d/msgid/googlefonts-discuss/20170530104838.GC24994%40macbook.
For more options, visit https://groups.google.com/d/optout.

Screenshot at 2017-06-02 22:27:41.png

Felipe Sanches

unread,
Jun 5, 2017, 4:57:54 PM6/5/17
to googlefonts-discuss, Inkscape Devel List
I'm writing this message addressed both to UI-designers in general as well as (to some extent) to senior Inkscape developers who may provide some more feedback on the actual code.
====

My current understanding regarding variable fonts is that any time the user tweaks parameters in a variable font, Inkscape will have to decide whether to modify those design-space coordinates on the font instance associated with the currently selected chunk of text or to instantiate a new font_instance object. Here's my rationale behind this:

If the SVG document has the same font applied to more than a single chunk of text, then we need to create a new font instance so that the edits to one chunk of text won't affect other chunks that were previously sharing the same font_instance. That would work as a lazy "un-clone" of the font resource once the differentiation is really needed. It is good (in order to avoid wasting memory) to share a font_instance for chunks of text that use the same non-variable font, or that use the default design space coordinates of a given variable font.

I think that allowing variable font design-space tweaks to individual chunks of text is desirable from the user perspective and also required from the SVG spec perspective. The SVG spec does not talk about variable fonts, but it allows individual text chunks to have their own font-family and style attributes which then apparently means allowing them to have their own variable font design space coordinates as well (If I understood it correctly). I think this is analogous to individual paths having their own individual fill/stroke styles.

It just occurred to me that this leads to a possible confusion and we probably have to make a UI design choice here. There may be occasions when the user may want to modify the design-space coordinates of a given variable font globally on the document. Do you think this is a valid concern / valid usage scenario ? In that case, a variable font instance may behave like a shared resource, analogous to a shared gradient or filter-effect. But then we would need to make this an explicit user-choice, perhaps by providing a dedicated dialog for setting up such shared font resources. Like a "palette of font instances". Does it make sense ? Also, from a codebase point of view, would you suggest a prefered way to approach this? (Thinking about how to manage these variable-font instances)


2017-06-02 22:35 GMT-03:00 Felipe Sanches <ju...@members.fsf.org>:
Hi there,

These past days I've been adding an experimental UI to Inkscape for tweaking parameters in OpenType variable fonts. One major roadblock I stumbled upon is requiring me to think more carefully about some potentially deeper architectural changes. In the screenshot attached to this message you can see some text written with the Decovar variable font. The slider labeled "Testing" in the "Text & Font" dialog is wired to invoke a callback upon value-change. This callback detects the currently selected font based on the canvas text-tool cursor position, retrieves the corresponding font_instance object and invokes Freetype's FT_Set_Var_Design_Coordinates method with the updated design-space coordinates (the slider in this experiment is hardwired to adjust the weight axis of Decovar).

(I really miss a Freetype method to alter a single design-space coordinate, instead of having to pass the full array, by the way)

The way things work right now, unfortunately, leads to the glyphs not changing on-canvas because once they are loaded, they seem to be kept in a cache. As you can see in the screenshot, each glyph has a different weigth, based on the slider setting when the glyph was loaded for the first time. It seems quite obvious that I should do something to invalidate the cache upon dragging the slider. But that, on the other hand, should not alter glyphs in other places where the same variable font is being used in the same document.

Based on all that, I think that the proper implementation would involve creating individual font_instance objects for each text chunk where a variable-font is used with non-default design-space coordinates so that they can be tweaked independently. Achieving that, though, will surely involve a bit deeper fiddling with Inkscape's text internals, which is what I expect to do in my next few days of work on this.

cheers,
Felipe Sanches

PS:
I'm crossposting this to the Inkscape-devel mailing list as the rest of the development community may be interested in receiving updates on this topic. I may as well move all future updates to the Inkscape mailing list directly.

PS2: I heard that there's a GSoC student this year who's going to work on Inkscape's text implementation (fixing compliance issues to the SVG spec, I think...) It would be really great to keep in contact with him/her and the mentor to coordinate efforts.

2017-05-30 7:48 GMT-03:00 Khaled Hosny <khale...@eglug.org>:
On Tue, May 30, 2017 at 12:35:24AM -0300, Felipe Sanches wrote:
> The relationship between pango and harfbuzz is still not very clear to me,
> as I have the impression that even pango_shape() invokes hb_shape() under
> the hood nowadays.

It will eventually call HarfBuzz on Linux, but in Windows and Mac it
will call Uniscribe and Core Text, respectively. Switching to HarfBuzz
on all platforms is kinda on Pango’s TODO list, but I don’t think anyone
is working on it currently.

--
You received this message because you are subscribed to the Google Groups "Google Fonts Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlefonts-discuss+unsubscribe...@googlegroups.com.

Felipe Sanches

unread,
Jun 10, 2017, 1:35:20 AM6/10/17
to googlefonts-discuss, Inkscape Devel List
Hi there!

I was expecting to get some feedback on this thread from other Inkscape developers, but still did not really get any. So I continued investigating the issue by myself. At the moment I'm mapping out where and how the font_instances are created, deleted and used throughout the code-base because any changes I make have to consider all side-effects that may surface. I did feel a bit overwhelmed at first with the complexity of the text-handling code, but I think I'm on the right track now.

To alleviate the anxiety of dealing with such a complex large-chunk of code, I got my hands dirty by refactoring a few portions of libnrtype/Layout-*.cpp files (it's like gardening: we can't keep just staring at it :-P) and I also talked to some friends. Since a few Brazilian friends shared the enthusiasm of OpenType Variable Fonts at LGM earlier this year here in Brazil, I wrote a bit about the ongoing effort at an online forum here: https://forum.fiozera.com.br/t/suporte-a-opentype-variable-fonts-no-inkscape/115 It is all in Brazilian Portuguese, sorry, so it is probably not much useful here, but it is also not much different from what I already talked about here in this email thread which is still the official place for me to provide progress updates. Also the forum thread does not cover a lot of areas of the code I've been studying. Writing at that forum was more of a way of relaxing and getting ideas to flow again. I'll probably do so again from time to time. :-)

Since Inkscape has finally migrated to git today ("upstream" repo is now at https://gitlab.com/inkscape/inkscape), I did fork it at https://gitlab.com/fsanches/inkscape and also got my user account approved with push-rights. I was an active Inkscape developer on Bazar several years ago with equivalent commit rights.

Then I tried the "Merge Requests" workflow, but then I figured that probably the Inkscape team will (at least for a while) prefer to work directly committing to the master branch, instead of opening requests for merge. I pushed to master a few of the aforementioned refactoring commits and created a "variable_fonts" branch on my local working copy where I'll resume all of the experimental OpenType coding (to avoid polluting master before the feature is ready to land).

So, next week I plan to get back to contributing to FontBakery ( https://github.com/googlefonts/fontbakery/ ) and gradually work a bit more on Inkscape as well. Exactly which of both tasks will take most of my time will depend on the availability of Lasse's upcoming FontBakery pull request and also on the level of feedback that I may (or may not) get from Inkscape developers. I guess perhaps no-one else who originally dealt with the text-handling code in Inkscape is active in the team nowadays ? If that's the case, then I'll have to really "take ownership" of that portion of code and improve it based on my best judgement of what would be the best approaches.

One final thing: I'm really interested in talking to whoever is planning to work on a text feature on Google Summer of Code this year. Who's the student ?! Please contact me.

Happy Hacking,
Felipe "Juca" Sanches

Felipe Sanches

unread,
Jun 12, 2017, 11:20:31 PM6/12/17
to googlefonts-discuss, Inkscape Devel List
Today I continued working Variable Fonts support on Inkscape. More specifically, I focused on adding parsing/handling of the font-variation-settings property (CSS Fonts Module Level 4). The code is here:

https://gitlab.com/fsanches/inkscape/commit/2a6a42a1389eb29b3ac94c5db9321a72000b5bb5

A shortcoming of the above code is that it only deals with a single axis coordinate, while the CSS spec allows for an arbitrary number of axis names and correspondent design-space coordinates. I do have an uncommited draft of the SPIVariableFontAxisOrNormal class which uses a C++ std::map<Glib::ustring, SPILength> for storing the parsed key/values from the property, but that code is still work-in-progress and it is what I'll be working on tomorrow.

After getting that to work, I intend to modify the font_instance* font_factory::FaceFromStyle(SPStyle const *style) method to instantiate font_instance objects taking the newly parsed property values in consideration.

One next milestone could be to get a well-formed SVG file containing a bunch of different variable-font coordinates in several chunks of text declared using the CSS property to load and render properly (without bothering about an editing UI at first). And after that I can work on the UI and the harder problem of how to decide whether a new font_instance object should be created or whether it should be recicled upon user edits.

Please let me know if you think I'm doing something wrong here. The description above is my current understanding of a possible path towards an implementation of this feature. I'm open to getting feedback on that.

Happy Hacking,
Felipe Sanches

Felipe Sanches

unread,
Jun 12, 2017, 11:23:30 PM6/12/17
to googlefonts-discuss, Inkscape Devel List
By the way... once I make the class handle multiple axis coordinates it would be reasonable for me to rename it from SPIVariableFontAxisOrNormal to SPIFontVariationSettings

Felipe Sanches

unread,
Jun 12, 2017, 11:25:16 PM6/12/17
to googlefonts-discuss, Inkscape Devel List
And, for the record, this is the URL for the definition of this property on the spec:
https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def

Khaled Hosny

unread,
Jun 13, 2017, 4:12:48 AM6/13/17
to googlefon...@googlegroups.com, Inkscape Devel List
On Tue, Jun 13, 2017 at 12:20:29AM -0300, Felipe Sanches wrote:
> Today I continued working Variable Fonts support on Inkscape. More
> specifically, I focused on adding parsing/handling of the
> *font-variation-settings* property (CSS Fonts Module Level 4). The code is
> here:

HarfBuzz has hb_variation_from_string() that parses the CSS syntax as
well.

Regards,
Khaled

Tavmjong Bah

unread,
Jun 13, 2017, 8:07:28 AM6/13/17
to Google Fonts Discussions, ju...@members.fsf.org


On Tuesday, June 13, 2017 at 5:23:30 AM UTC+2, Felipe Sanches wrote:
By the way... once I make the class handle multiple axis coordinates it would be reasonable for me to rename it from SPIVariableFontAxisOrNormal to SPIFontVariationSettings

Since this is a specialized class for a particular property, SPIFontVariationSettings would be the preferred name (SPI + CamelCased property name).

 
To unsubscribe from this group and stop receiving emails from it, send an email to googlefonts-discuss+unsub...@googlegroups.com.
To post to this group, send email to googlefon...@googlegroups.com.

Dave Crossland

unread,
Jun 13, 2017, 8:20:54 AM6/13/17
to googlefonts-discuss, Inkscape Devel List


On Jun 5, 2017 4:57 PM, "Felipe Sanches" <ju...@members.fsf.org> wrote:
There may be occasions when the user may want to modify the design-space coordinates of a given variable font globally on the document. Do you think this is a valid concern / valid usage scenario ?

I think you should postpone this for now and consider it a future possible milestone. 

In that case, a variable font instance may behave like a shared resource, analogous to a shared gradient or filter-effect. But then we would need to make this an explicit user-choice, perhaps by providing a dedicated dialog for setting up such shared font resources. Like a "palette of font instances". Does it make sense ? 

Yes, more sophisticated typesetting environments have "character styles" and "paragraph styles" which are such palettes and afaik inkscape doesn't have a UI for that. 

Cheers
Dave

Felipe Sanches

unread,
Jun 13, 2017, 8:37:38 AM6/13/17
to googlefonts-discuss, Inkscape Devel List
Cool!

I would just avoid using the term "palette" because I recently learned that the term "font-palette" is used in the CSS spec for something else (relating to color palettes in coloured font faces).

As can be seen here:
https://drafts.csswg.org/css-fonts-4/#font-palette-prop

--
You received this message because you are subscribed to the Google Groups "Google Fonts Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlefonts-discuss+unsub...@googlegroups.com.

To post to this group, send email to googlefonts-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/googlefonts-discuss.

Felipe Sanches

unread,
Jun 20, 2017, 11:00:22 PM6/20/17
to googlefonts-discuss, Inkscape Devel List
I've hit a roadblock / mental exhaustion from dealing with (banging my
head against) the Inkscape codebase, so I think it is very much wiser
to switch gears at the moment and do some FontBakery work again for a
while. And possibly get back to Inkscape later for a fresh restart.
I'll take a look now at what's pending on the issue tracker for
FontBakery that may be safe to work on regardless of Lasse's upcoming
PR.

Last week I should have met with Tav on a chat channel (possibly IRC)
but we ended up not being able to arrange a good time for that yet. So
I'm still going to get some feedback/advice from him at some point in
the future.

ScislaC (Josh Andler) on Inkscape IRC told me that not much people
touched the text-handling code in the past decade and that Tav is
probably the person who best knows it nowadays. So talking to him will
probably be very good. I don't want to continue digging deeper in that
code before talking to him, for instance.

I sketched a bit of each portion of the code that we need: (a) CSS
attribute parsing, (b) some GTK dialog/widgets and (c) some freetype
API calls for rendering the variable fonts. What I still lack is a
broader overview on how all of this stitches together coherently.

The concept is not much complicated. Read coordinate values from the
SVG file (as CSS attribute values), populate the UI of a dialog with
sliders, and then use that info when creating font instances. Then use
those values also to setup the appropriate freetype API calls. But the
devil is in the details. Among this, there's a whole labyrinth of code
for CSS and text handling...

Felipe Sanches
>> email to googlefonts-dis...@googlegroups.com.
>> To post to this group, send email to googlefon...@googlegroups.com.

Felipe Sanches

unread,
Jun 20, 2017, 11:28:58 PM6/20/17
to Martin Owens, googlefonts-discuss, Inkscape Devel List
Thanks a lot for the supportive and kind words, Martin! I'll surely
give it a second chance soon. I gotta say that I'm pretty psyched
about the new OpenType Variable Fonts technology, so I'd love to help
make it happen on Inkscape at some point.

happy hacking,
Felipe Sanches

2017-06-21 0:25 GMT-03:00 Martin Owens <doct...@gmail.com>:
> Hi Felipe,
>
> Don't worry about getting stressed out with the Inkscape code base.
> It's really big, and parts of it like text are the most intricate. Some
> of that is there because it deals with a lot of features and/or
> formatting of svg.
>
> Take a break, have a breather. It might take another deep delve at the
> coal face when you feel positive about learning a bunch of things and
> being prepared to move the code towards refactoring if necessary.
>
> Good luck!
>
> Best Regards, Martin Owens

Felipe Sanches

unread,
Jun 23, 2017, 8:16:30 AM6/23/17
to Tavmjong Bah, googlefonts-discuss, Inkscape Devel List
Quick update:

Regarding Variable fonts in Inkscape:

I had a meeting with Tav on IRC yesterday in the morning and I did
improve the code on the CSS attribute side (code is now pushed to
inkscape git master branch). We also discussed whether to call
FreeType directly or via a future bridge API not yet provided by
Pango. And Tav believes the proper way to do it would be by adding
such API on Pango. Tav mentioned that something similar happend in the
past with an API for accessing opentype font variation features being
added to pango upon Tav's request and he suggested I take a look at
its implementation and possibly submit a patch to pango myself.

2017-06-21 10:06 GMT-03:00 Tavmjong Bah <tavm...@free.fr>:
>
> Hi Felipe,
>
> Sorry to miss you on IRC. I'm in the CEST time zone (UTC+2) and am
> normally around between 9AM to 9PM (off and on).
>
> I am probably the person that knows the text code the best... which is
> a bit scary.
>
> If Pango/HarfBuzz handles the variable font stuff then it shouldn't be
> too hard to get rendering working. You can have a look at how the
> OpenType stuff works, especially the 'getFontFeatureString() in
> style.cpp and Layout-TNG-Compute.cpp.
>
> Tav
>
> On Wed, 2017-06-21 at 00:00 -0300, Felipe Sanches wrote:
>> > > To post to this group, send email to googlefonts-discuss@googlegr
>> > > oups.com.
>> > > Visit this group at https://groups.google.com/group/googlefonts-d
>> > > iscuss.
>> > > To view this discussion on the web visit
>> > > https://groups.google.com/d/msgid/googlefonts-discuss/CAEozd0yg2S
>> > > eYO00d9Mq7pETmPQMFJ8n30B6sg-fpbhofBqW9Ng%40mail.gmail.com.
>> > >
>> > > For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>>
>> -------------------------------------------------------------------
>> -----------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Inkscape-devel mailing list
>> Inkscap...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/inkscape-devel

Pathum Egodawatta

unread,
Mar 6, 2018, 9:27:43 AM3/6/18
to Google Fonts Discussions
Hi Filipe!

Hope you are doing well. Thanks for taking this on! would be aweosme to have the VF support.

Whats new in this? I would love to know more about the UI interactions and tooltips.

Cheers,
Pathum

Felipe Sanches

unread,
Mar 6, 2018, 11:19:47 AM3/6/18
to googlefonts-discuss, Inkscape Devel List
I left this aside for the past 6 months and recently got back to looking at it.

I think the most trivial thing would be to populate the font-styles combo-box with named instances. This would be almost not perceptible by the users, but would enable variable fonts' instances to show up there just like their non-variable counterparts do.

Then there's the customization aspect of varfonts. For that, I think the bare minimum would be a bunch of sliders for selecting the coordinates of each variation axis. I feel that there must be something better than that form a user experience perspective, but I'm still not sure what would that be, so I'd leave it for a second iteration of the UI.

Also, since one can get a multitude of combinations within the designspace, I think it could be practical to adopt a UI workflow similar to that of color gradients, in which once a user-defined instance is applied to a text chunk, that instance is added to a pool of var font instances that can be reused in other chunks of texto within the document. A shared varfont would then, upon tweaking of its design space coordiantes, affect all portions of the document where it was used. 

Finally, and this is not a varfont specific issue, I feel the urge to improve the basic text support in Inkscape in general. Yes, I know this is a somewhat vague statement. The overall direction I'd like to follow, though, would likely be something similar to the insightful ideas that are expressed in this article:


cheers,
Felipe Sanches

--
You received this message because you are subscribed to the Google Groups "Google Fonts Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlefonts-discuss+unsub...@googlegroups.com.

To post to this group, send email to googlefonts-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/googlefonts-discuss.

Felipe Sanches

unread,
Mar 6, 2018, 3:04:03 PM3/6/18
to Tavmjong Bah, googlefonts-discuss, Inkscape Devel List


2018-03-06 16:02 GMT-03:00 Tavmjong Bah <tavm...@free.fr>:
On Tue, 2018-03-06 at 13:19 -0300, Felipe Sanches wrote:
> I left this aside for the past 6 months and recently got back to
> looking at it.
>
> I think the most trivial thing would be to populate the font-styles
> combo-box with named instances. This would be almost not perceptible
> by the users, but would enable variable fonts' instances to show up
> there just like their non-variable counterparts do.

That would be good if that information can be extracted from the font.
Speaking of which, I wonder if the OpenType 'fvar' table can be easily
extracted (which contains the ranges for the axes).

Yes we can easily do that. We don't need to parse the tables ourselves because freetype already provides methods for all the relevant info regarding variation axes, min/max/defaul values and named instances.
 

> Then there's the customization aspect of varfonts. For that, I think
> the bare minimum would be a bunch of sliders for selecting the
> coordinates of each variation axis. I feel that there must be
> something better than that form a user experience perspective, but
> I'm still not sure what would that be, so I'd leave it for a second
> iteration of the UI.

Sounds good. The sliders would then fill in the 'font-variation-
settings' property:

https://www.w3.org/TR/css-fonts-4/#font-variation-settings-def


yes, that's also my understanding!

 
> Also, since one can get a multitude of combinations within the
> designspace, I think it could be practical to adopt a UI workflow
> similar to that of color gradients, in which once a user-defined
> instance is applied to a text chunk, that instance is added to a pool
> of var font instances that can be reused in other chunks of texto
> within the document. A shared varfont would then, upon tweaking of
> its design space coordiantes, affect all portions of the document
> where it was used.

This would probably require a pop-up dialog to edit (or duplicate) an
entry in the font-style drop-down menu. We'll need to set up signals so
that all text/tspan elements are updated whenever an entry is modified.

sounds good
 

> Finally, and this is not a varfont specific issue, I feel the urge to
> improve the basic text support in Inkscape in general. Yes, I know
> this is a somewhat vague statement. The overall direction I'd like to
> follow, though, would likely be something similar to the insightful
> ideas that are expressed in this article:

This might be something for GTK as more than just Inkscape could use
such a dialog.

I agree! But it could be prototyped in Inkscape and then later factored out if we like the result and decide to promote it upstream on GTK. Having a real and well-accepted use case in Inkscape would be good to support the inclusion of it on gtk.
 
GTK 3 does have a font-family dialog that we do not use
at the moment:

https://developer.gnome.org/gtk3/stable/GtkFontChooserDialog.html


Do you consider this one better then our current font selection UI?
 
> https://medium.com/@getflourish/the-anatomy-of-a-thousand-typefaces-
> f7b9088eed1


Tav

> cheers,
> Felipe Sanches


Khaled Hosny

unread,
Mar 6, 2018, 3:50:01 PM3/6/18
to googlefon...@googlegroups.com, Tavmjong Bah, Inkscape Devel List
On Tue, Mar 06, 2018 at 05:04:00PM -0300, Felipe Sanches wrote:
> 2018-03-06 16:02 GMT-03:00 Tavmjong Bah <tavm...@free.fr>:
>
> > On Tue, 2018-03-06 at 13:19 -0300, Felipe Sanches wrote:
> > > I left this aside for the past 6 months and recently got back to
> > > looking at it.
> > >
> > > I think the most trivial thing would be to populate the font-styles
> > > combo-box with named instances. This would be almost not perceptible
> > > by the users, but would enable variable fonts' instances to show up
> > > there just like their non-variable counterparts do.
> >
> > That would be good if that information can be extracted from the font.
> > Speaking of which, I wonder if the OpenType 'fvar' table can be easily
> > extracted (which contains the ranges for the axes).
> >
>
> Yes we can easily do that. We don't need to parse the tables ourselves
> because freetype already provides methods for all the relevant info
> regarding variation axes, min/max/defaul values and named instances.

FreeType/FontConfig/Cairo/Pango stack has more or less full variable
fonts support now, Inkscape needs to be updated to make use of the
support already available in all these libraries.

https://blogs.gnome.org/mclasen/2018/01/03/more-fun-with-fonts/

Regards,
Khaled

Felipe Sanches

unread,
Mar 6, 2018, 4:15:28 PM3/6/18
to googlefonts-discuss, Tavmjong Bah, Inkscape Devel List
2018-03-06 17:49 GMT-03:00 Khaled Hosny <khale...@eglug.org>:
FreeType/FontConfig/Cairo/Pango stack has more or less full variable
fonts support now, Inkscape needs to be updated to make use of the
support already available in all these libraries.

https://blogs.gnome.org/mclasen/2018/01/03/more-fun-with-fonts/

Wow! This is super cool!

I specially loved the CSS animation of the weight of the text when the cursor hovers over a button. 

This seems to replace Tav's opentype features selector via a GTK font-selector dialog. It also seems that we could have the innitial variable fonts support in inkscape basically hooking up to this newly improved GTK dialog. Naturally, that would require Inkscape to rely on a pretty recent version of GTK.


Felipe Sanches

unread,
Mar 6, 2018, 11:20:40 PM3/6/18
to googlefonts-discuss, Tavmjong Bah, Inkscape Devel List
Today I learnt about Mesonbuild and was impressed by this demo of it building gtk+ form git as well as all its main dependencies (also from git). This make life much much easier for setting up a bleeding-edge gtk+ development environment where all this new variable font stuff is available.

https://www.youtube.com/watch?v=2dB80CjH_3Q

Build progressed quite nicely up until (ironically), pango/fonts.c with an undeclared symbol related to EMOJI :-D


Captura de Tela 2018-03-07 às 00.55.59.png

Felipe Sanches

unread,
Mar 6, 2018, 11:23:18 PM3/6/18
to googlefonts-discuss, Tavmjong Bah, Inkscape Devel List
Tav, you asked me other day wether pango provides methods for setting up font variation coordinates in a design space.

Looking at the git commit logs, I can see that such API was introduced last Sept 5th, 2017 by Matthias Clasen 


Captura de Tela 2018-03-07 às 01.08.16.png
Captura de Tela 2018-03-07 às 01.08.55.png

Khaled Hosny

unread,
Mar 7, 2018, 5:50:00 AM3/7/18
to googlefon...@googlegroups.com, Tavmjong Bah, Inkscape Devel List
On Wed, Mar 07, 2018 at 01:20:36AM -0300, Felipe Sanches wrote:
> Build progressed quite nicely up until (ironically), *pango/fonts.c* with
> an undeclared symbol related to *EMOJI :-D*

Please file a bug about this.

Regards,
Khaled
Reply all
Reply to author
Forward
0 new messages