Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Aleš Mlakar
Ok I've figured out why my actual text doesn't work correctly now, it's because pango splits the text into parts (because of color changes etc) and calls hb_shape on each part which then restarts the substitution logic. Best, Ales On Fri, Feb 14, 2020 at 6:30 PM Aleš Mlakar wrote: > Thanks

Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Aleš Mlakar
Thanks guys, I've tried to turn off the rand feature (which is on by default in pango it seems) and it really did start working differently. The example image that I've sent earlier now works identically! My actual text doesn't seem to work 100% correctly yet, but there's some (per glyph) open

Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Jonathan Kew
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

Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Simon Cozens
On 14/02/2020 16:56, Jonathan Kew wrote: If the font you're talking about is https://www.myfonts.com/fonts/pintassilgo/daft-brush?tab=techSpecs, then it does claim to include a 'rand' feature. That would explain it, then. I don't know how InDesign attempts to use 'rand' (if at all) My

Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Jonathan Kew
If the font you're talking about is https://www.myfonts.com/fonts/pintassilgo/daft-brush?tab=techSpecs, then it does claim to include a 'rand' feature. I don't know how InDesign attempts to use 'rand' (if at all), but given the description of the feature in

Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Aleš Mlakar
I know, but sadly it's not a free font. I'm still trying to find one that has alternate glyphs but no luck so far. Best, Ales On Fri, Feb 14, 2020 at 5:08 PM Simon Cozens wrote: > On 14/02/2020 15:50, Aleš Mlakar wrote: > > So, as far as I can understand all of this either one of Indesign or >

Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Simon Cozens
On 14/02/2020 15:50, Aleš Mlakar wrote: So, as far as I can understand all of this either one of Indesign or Harfbuzz is doing it wrong. Without having the font or its feature code, it's very hard for someone else to debug. S ___ HarfBuzz mailing

Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Aleš Mlakar
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

Re: [HarfBuzz] Alternate/random glyphs

2020-02-14 Thread Simon Cozens
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

Re: [HarfBuzz] Alternate/random glyphs

2020-02-13 Thread Aleš Mlakar
Hi Khaled, thanks for the tip, hb-view and my application produces the same result though. Here's an image with the differences: https://imgur.com/a/0QOVOWL As far as I can tell it seems that just glyph 72 and 40 are swapped for the g (and the same seems to happen for m) the rest seems to work the

Re: [HarfBuzz] Alternate/random glyphs

2020-02-13 Thread Khaled Hosny
> On Feb 12, 2020, at 9:28 PM, Aleš Mlakar wrote: > > Hi Khaled, > I did a quick debug through that part of HarfBuzz and it seems it's doing > lookups and never gets to the random code. What random code? > Tomorrow I'll try to put something together, would a link to a screen shot > and

Re: [HarfBuzz] Alternate/random glyphs

2020-02-12 Thread Aleš Mlakar
Hi Khaled, I did a quick debug through that part of HarfBuzz and it seems it's doing lookups and never gets to the random code. Tomorrow I'll try to put something together, would a link to a screen shot and font be sufficient for starters? Thanks! Ales On Wed, Feb 12, 2020 at 7:42 PM Khaled

Re: [HarfBuzz] Alternate/random glyphs

2020-02-12 Thread Khaled Hosny
Depends on how the font is doing the randomization, using contextual lookups (most likely) or rand feature (less likely as this does not basically work outside of HarfBuzz and few other less common applications). We would need to see the font and specific examples with output of both to form

Re: [HarfBuzz] Alternate/random glyphs

2020-02-12 Thread Aleš Mlakar
Hi Nikolay, I have a font "Daft Brush" for example, and if I write "gg" I get 4 different glyphs "randomized", and the result is different in Indesign and in my own application with Harfbuzz. So my question is, who is doing it wrong, Indesign or Harfbuzz, or neither and is actually

Re: [HarfBuzz] Alternate/random glyphs

2020-02-12 Thread Nikolay Sivov
On Wed, Feb 12, 2020 at 8:58 PM Aleš Mlakar wrote: > Hey all, > I've been trying to mimic font shaping in Adobe Indesign with Harfbuzz, > most of it works great, but when random/alternate glyphs (for the fonts > that have multiple glyphs for the same code point) are used it's not even > remotely