[HarfBuzz] Alternate/random glyphs
Simon Cozens
simon at simon-cozens.org
Fri Feb 14 12:08:58 UTC 2020
On 12/02/2020 19:28, Aleš Mlakar wrote:
> I did a quick debug through that part of HarfBuzz and it seems it's
> doing lookups and never gets to the random code.
OpenType randomization on the whole isn't *really* random. Most fonts
implement pseudo-random selection of alternate glyphs by going through a
series of lookup rules (see e.g. the bottom of
http://opentypecookbook.com/common-techniques.html ). As you can see,
none of the techniques there actually use any source of randomness; they
just apply deterministic rules to the input stream.
There *is* a "rand" feature in the OpenType standard, which asks the
shaper for non-deterministic random selection, but for this to work, two
things need to be in place: the shaper needs to support it, and the font
needs to define it. Harfbuzz as a shaper supports it, but no others do.
Because of this, few fonts define it.
Even then, Harfbuzz's random number implementation is only pseudorandom
with a fixed random seed, so you get the same results each time anyway.
I don't know whether Daft Brush uses the "rand" feature. It probably
doesn't. Although if you are seeing differences between harfbuzz and
InDesign, it might be that it does.
In short it is down to the font.
S
More information about the HarfBuzz
mailing list