emacs-devel
[Top][All Lists]
Advanced

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

Re: Ligatures


From: 조성빈
Subject: Re: Ligatures
Date: Sat, 23 May 2020 22:36:21 +0900

Stefan Monnier <address@hidden> 작성:

The crucial problem is that we currently perform layout decisions one
grapheme cluster at a time, whereas what HarfBuzz people say is that
we should basically do that one screen line at a time.

I wonder how it is supposed to work and it works in other applications:

I don’t know how much you know about text rendering, (I’m fairly confident that a previous Emacs maintainer to know more about this than me) but for people who are curious about this, I found the ’Text Rendering Hates You’[0] article which was very helpful for understanding the problem.

[0]: https://gankra.github.io/blah/text-hates-you/

Disregarding the theoretical question of whether a font can use
ligatures that involve the LF character (and hence affect the definition
of what is a line), I still see a chicken-and-egg problems:
How do you know where the current "screen line" ends if you don't know
how narrow/wide the font and its ligatures will render the text?

Do current applications use a heuristic like "ligatures won't reduce the
size by more than a factor 2, so estimate the lower bound on the final
size to be at most half of what the font metrics say", so they will send
up to twice as much text to be shaped as needed, and then they throw
away the left overs?

According to the article I mentioned, it’s just passing the total text repeatedly until it runs out of space.

You have to assume that your text fits on a single line and shape it until you run out of space. At that point you can perform layout operations and figure out where to break the text and start the next line. Repeat until everything is shaped and laid out.


        Stefan





reply via email to

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