freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] FT layout


From: Adam Twardoch (Lists)
Subject: Re: [ft] FT layout
Date: Sun, 14 Oct 2018 18:16:15 +0200

HarfBuzz is the modern replacement for FTLayout. It integrates with
external libraries for Unicode preprocessing and then performs
internationalized line layout for one font. If you need linebreaking and
you need to mix fonts, you need to go one level higher.

Overall, text layout works like this:

You have some "frame" that you want to fill with text. Each frame consists
of "broken" lines of text which are set in different fonts, colors, sizes
etc. For that, you need some text layout engine, of which there are many,
see:

- https://github.com/search?l=C&q=text+layout&type=Repositories
- https://github.com/search?l=C%2B%2B&q=text+layout&type=Repositories

In most cases, a text layout engine would split the text into portions that
specify one font, font size, color and other formatting aspects, and feed
into each portion into a line layout library (most likely: HarfBuzz) to
perform the shaping. Then it would get lines from HarfBuzz and perform
linebreaking. HarfBuzz uses FreeType for some processes, but in reality,
after you’ve performed your linebreaking (so you have coordinates of all
glyph IDs for all the fonts that need to show up in your paragraph or
frame), you need to "paint" the glyphs. For that, you can use FreeType but
you can use also other mechanisms (for example, for an OpenType+SVG font,
you might use an SVG renderer).

Linebreaking and paragraph layout are much more complex: Are your
paragraphs always rectangular, or do you actually need to flow text around
some images in some non-regular way? Do you use variable fonts so the glyph
metrics can change depending on the specific chosen instance, or do you
only use static fonts, so you could cache the glyph metrics? Do you just
"print" the text or do you also require editing (or at the very least, text
selection), which then involves interaction with a text cursor which is
non-trivial in bidirectional scripts? And so on.

So, paragraph layout / linebreaking is out of scope of HarfBuzz, line
layout or line shaping is out of scope of FreeType, and FTLayout was
dropped because it could never really address all of the potential
requirements of a more comprehensive text layout solution.

Best,
Adam



On Sun, Oct 14, 2018 at 1:08 PM <address@hidden> wrote:

> On Sun, Oct 14, 2018 at 06:38:22AM +0200, Werner LEMBERG wrote:
> >
> > > What's happening to the FT layout lib?
> > >
> > > Dead or indefinitely postponed or still going?
> >
> > Dead.  We decided that handling layout tables like GPOS and GSUB must
> > be done at least one level higher than FreeType.
>
> I thought the FT layout lib was supposed to be that level higher.
> Am I right and FT layout lib is really dead?
>
> --
> Sylvain
>
> _______________________________________________
> Freetype mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/freetype
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]