On 14/02/2020 15:50, Aleš Mlakar wrote:
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.
HarfBuzz will only use this if the font has a 'rand' feature with an
AlternateSubstFormat1 subtable, to pick from among the available
alternates for a glyph. You could try dumping the font's GSUB table
(e.g. with fonttools) to see what's actually in there.
It's entirely possible for a font's 'rand' feature to be implemented in
some other way, such as a collection of contextual substitutions; then
no real (pseudo-)randomness is involved.
JK
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 <[email protected]
<mailto:[email protected]>> 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*
_______________________________________________
HarfBuzz mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/harfbuzz
_______________________________________________
HarfBuzz mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/harfbuzz