Definition of 'shaping engine'? (Or, what is HarfBuzz?)

pereelmagne
pereelmagne Posts: 10
edited February 13 in Technique and Theory
I need a definition of 'shaping engine' for a piece that I'm writing and I've come up with a proposal. You savvy typographers and type designers will surely tear it apart and make evident all its flaws. Please do. The definition goes like this:

A ‘shaping engine’ or ‘text shaping engine’ is:
- a software library
- used by text processors and page layout applications
- which processes raw Unicode-compliant text (or plain text, for short) 
- and applies to it parameters from the OpenType font in use 
- in order to generate the typographic written chain. 

Comments

  • John Hudson
    John Hudson Posts: 3,126
    A bit more generally, a shaping engine is used wherever Unicode text is displayed, so not just word processors and page layout applications but also web browsers, mobile apps, embedded systems (e.g. automobile infotainment systems, houshold appliances, etc).

    While OpenType is the most commonly deployed font and layout technolog, shaping engines also exist for other technologies and, notably, HarfBuzz supports Apple’s AAT and SIL’s Graphite formats in addition to OpenType. So maybe just say ‘applies parameters from the font’.

    As written, your definition might imply a ‘dumb’ shaping engine, which simply applies whatever is in the font. This would be characteristic of the state table engines used for AAT and Graphite. OpenType shaping engines carry a lot of layout intelligence, much of it derived from Unicode properties, and work in consort with the font. The OpenType Layout model shares responsibilities between the shaping engine and the font tables. So, for example, in shaping Arabic text the OTL GSUB table contains mappings for left, right, and dual joining glyph forms, but it is the shaping engine that analyses the character string and determines where to apply each of these mappings. [Conversely, in AAT or Graphite, the font defines the joining frm substitutions using contextual states at the glyph level.]
  • I define a shaping engine as a piece of software which maps Unicode codepoints to glyphs and their expected positions, in response to the conventions of the script and the rules in the font.
  • pereelmagne
    pereelmagne Posts: 10
    edited February 14
    so not just word processors and page layout applications but also web browsers, mobile apps, embedded systems (e.g. automobile infotainment systems, houshold appliances, etc).
    It was my amateurish understanding that an application (be it Powerpoint, Whatsapp…) doesn't need HarfBuzz to render text chains with simple graphs such as ã or ĉ. In this situation, the raw text chain and OpenType are enough. 

    I infer from your comment that the shaping engine works in every text and in every application. We could even say that a text processor "is" a shaping engine. So then, what's the difference between a word processor and a shaping engine, between Word and HarfBuzz?


  • pereelmagne
    pereelmagne Posts: 10
    edited February 14
    I define a shaping engine as a piece of software which maps Unicode codepoints to glyphs and their expected positions, in response to the conventions of the script and the rules in the font.
    Again, the only remark I have is: what, then, is the difference between a text processor and a shaping engine? (And by 'text processor' I mean Word, Keynote, Signal, any text application.)
  • What I mean is: It seems that a text processor may or may not use a library such as HarfBuzz. It needs to use it in order to render complex graphs, not when a text chain is "simple". Is that right?
  • A text processor always uses a text shaping engine, but it doesn't have to be HarfBuzz. MacOS and Windows provide their own engines by default, such as CoreText and Uniscribe. An application needs to position glyphs on your screen, even if the text is "simple".

    The input of a text shaping engine is a list of Unicode characters and a font. The output is correctly positioned glyphs.

    A text processor provides functionality on top of that. It provides an interface to allow a user to edit the text, i.e. the user can edit the input of the text shaping engine: the list of Unicode characters and the font. That is given to the shaping engine, which creates the correctly positioned glyphs. Then those glyphs are rendered to screen.
  • A text processor always uses a text shaping engine...
    Nice to have this clear explanation!
  • In previous decades, before most of us Westerners had incentives to think about rendering more complex scripts on computer screens, there was a simple 1:1 correspondence between characters and glyphs. Ü was a single precomposed character with its own codepoint. Characters rendered predictably from left to right, and before proportionally spaced fonts came into widespread use, every character had a single predictable width. As text rendering became more complex, the need for shaping engines emerged.
  • the need for shaping engines emerged

    Or: became more apparent even to us westerners.

    The fact that computing was initially largely dominated by the west, and even especially by English speakers (and writers!) meant it initially had a very narrow perspective of what language is and how it works.

    Much of the history of text layout consists of more and more western people realizing—ofttimes even the same people repeatedly—that “wait a moment, this is more complicated than I thought” as they get further and further away from English (or Latin/Greek/Cyrillic) only plus just a handful of special symbols already visible on their keyboard.
  • You can find some of the challenges (the reason why shaping is not enough for layout) here, (I really should finish that chapter someday) and some of the differences between shaping and layout here.
  • A text processor always uses a text shaping engine, but it doesn't have to be HarfBuzz. MacOS and Windows provide their own engines by default, such as CoreText and Uniscribe. An application needs to position glyphs on your screen, even if the text is "simple".

    The input of a text shaping engine is a list of Unicode characters and a font. The output is correctly positioned glyphs.

    A text processor provides functionality on top of that. It provides an interface to allow a user to edit the text, i.e. the user can edit the input of the text shaping engine: the list of Unicode characters and the font. That is given to the shaping engine, which creates the correctly positioned glyphs. Then those glyphs are rendered to screen.
    Thank you very much. Very well explained.
  • You can find some of the challenges (the reason why shaping is not enough for layout) here, (I really should finish that chapter someday) and some of the differences between shaping and layout here.
    Many thanks. I already read some time ago your "How OpenType works". I need to go over your other contributions. Again, many thanks.