Hi Tav, others,

While using HarfBuzz directly will give you a lot of flexibility, it's also a nontrivial amount of work to duplicate what Pango does already.  It's true that some of the newer features of HarfBuzz will probably take forever to be wired up in Pango.  Like variations indeed.  But maybe Inkscape people can help wiring those up in Pango instead of investing a lot of time replacing it?

On Fri, May 5, 2017 at 1:30 AM, Tavmjong Bah <tavmjong@...8...> wrote:
On Wed, 2017-05-03 at 11:06 -0300, Felipe Sanches wrote:
> Hello, Inkscape friends,
>
> == Intro ==
> ** You can skip this part if you already know me or if you don't
> really care for the intro details :-D **

Glad to see you back!

> I've been active in Inkscape development a long time ago (circa
> 2007-2010, I think), but then I moved on to collaborate on other
> projects such as GNU LibreDWG, FontForge, Metapolator, Kicad and a
> few
> programs in the 3D printing toolchain such as Sprinter/Repetier
> firmware, Pronterface and OpenSCAD. Also I'm regularly contributing
> to
> the MAME Project and heavily interested in Coreboot/Libreboot, etc.
> And during the past year and a half I've been developing and
> maintaining the FontBakery project, a Quality-Assurance testsuite for
> font families.
>
> == LGM Brazil ==
> Last month I've attended the Libre Graphics Meeting here in Brazil
> and
> had the opportunity to meet a few GIMP developers. Unfortunately
> no-one from the Inkscape team was there this time, other than the
> couple of Brazilian past contributors (myself and Aurelio Heckert).
>
> == Variable Fonts ==
> Dave Crossland brought to my attention that there's an opportunity
> for
> the "big four" libre graphics programs that heavily rely on
> typography
> (Inkscape, GIMP, Scribus and LibreOffice) to implement support for
> OpenType Font Variations (a.k.a. "variable fonts") before the
> proprietary graphics applications do so.
>
> It seems that while the major web-browsers are all already jumping
> into the "variable fonts" technology, the proprietary graphics tools
> are not so fast.
>
> The underlying free software libraries already provide the support
> for
> that. Harfbuzz did implement support on its January release,
> providing
> a new API for OpenType variable fonts. I wonder if anyone here is
> interested in getting involved in the implementation of support for
> that in Inkscape.

Personally, I'm not so sure about the utility of variable fonts but
given that browsers are supporting them, we probably should too (I
question how many high quality variable fonts will be available).
Getting a jump on propriety software is never a bad idea.

> == My plan for Variable Fonts in Inkscape (and perhaps GIMP) ==
> With that in mind, I am planning to spend a full day per work-week
> dealing with this. I have started to do so last week. I spent last
> Thursday setting up my development machine to properly build GIMP and
> Inkscape from source. I know Inkscape is moving into git at some
> point
> very soon, but since it seems it did not happen yet, I decided to use
> git-bzr to have my own local git tree, where I feel more comfortable
> working.
>
> Then I built several dependency libraries needed to build these
> projects. GIMP still fails to build, but I already got Inkscape-devel
> built and running. Nice to see the recent improvements someone did on
> the measurement tool I implemented years ago. Thanks a lot!
>
> After that, I read the relevant portions of the text-handling code in
> Inkscape sources (most of it on the src/libnrtype/ directory). I see
> that it relies on Pango for setting up font description
> data-structures based on the user's font selection. And, if I got it
> right, Pango uses HarfBuzz+Cairo as its underlying layout & rendering
> backend.

Yes.

> So, my first thought is that we may add a variable fonts "bridge-API"
> on pango that redirects the calls to the underlying harfbuzz
> hb_ot_var_* API. Or the other alternative would be to entirely
> migrate
> Inkscape code into using harfbuzz directly (ditching pango usage).
> Please correct me if I misunderstood things here, but it seems to me
> that both approaches could work, while the first is a quick and dirty
> hack while the second would be the nicer way of doing things even
> though it would require a larger coding effort.

I would be in favor of using harfbuzz directly. It seems that this is
the direction things are going... but it would take quite a bit of
effort as we rely heavily on Pango for font selection (following CSS
rules). And I'm not sure if harfbuzz can handle things like CSS font
lists ("Time New Roman, serif").

We already use harfbuzz to access font variant information (in a quite
awkward way).

How do you plan on handling selecting the parameters for variable
fonts? We currently have no support for @font-face (this is something I
would love to see added).


> I'm copying Behdad Esfahbod in this thread as he is the developer of
> both Pango and HarfBuzz and may be interested in commenting on this.

Note that we will have a GSoC student working on moving our SVG 1.2
text layout to SVG 2 this summer.

Tav

> Happy Hacking,
> Felipe "Juca" Sanches
>
>



--
behdad
http://behdad.org/