[HarfBuzz] Alternate/random glyphs

Aleš Mlakar ales.ambits at gmail.com
Fri Feb 14 15:50:18 UTC 2020


Hey Simon,
I think it doesn't use rand feature, because it never gets to that part of
the code or at least not to the random_number() function which is the only
rng function I could find in Harfbuzz :D.
I did some debugging and it goes into some coverage functions inside
hb-ot-layout-common.hh from hb-ot-layout-gsub-table.hh, it's too deep for
me to be able to understand it though.
So, as far as I can understand all of this either one of Indesign or
Harfbuzz is doing it wrong.

Best,
Ales


On Fri, Feb 14, 2020 at 1:04 PM Simon Cozens <simon at simon-cozens.org> wrote:

> 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
>


-- 
Aleš Mlakar,
Programmer/Consultant
*am.bits*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20200214/e7320c5a/attachment.htm>


More information about the HarfBuzz mailing list