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.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.
====
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: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 <juca@...2270...>: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.Hi there,(I really miss a Freetype method to alter a single design-space coordinate, instead of having to pass the full array, by the way)
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).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 SanchesPS: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 <khaledhosny@...3544...>: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@...820... .
To post to this group, send email to googlefonts-discuss@...3546...ps.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/201705 .30104838.GC24994%40macbook
For more options, visit https://groups.google.com/d/optout .