<div dir="ltr"><div><div>It’s only a character in a conceptual sense, the text is really a list of chars and objects like<br><br></div><span style="font-family:monospace,monospace">['t', 'h', 'i', 's', ' ', {FONT_POSITIVE: 'bold'}, 'i', 's', ' ', 'b', 'o', 'l', 'd', 'e', 'd', {FONT_NEGATIVE: 'bold'}, ' ', 't', 'e', 'x', 't']<br><br></span></div><span style="font-family:monospace,monospace"></span><div>These types of characters are all over a Knockout document; they can create fractions, formulas, radicals, page numbers, etc. (They can also be nested but let’s not get into that). They can take up horizontal space and they get set into the line just like any Harfbuzz glyph output, though the fontstyle chars have a width of zero by default (but they can be set to have width to do useful stuff like italic correction)<br></div><div><br><img style="margin-right: 0px;" alt="Inline image 1" src="cid:ii_15589511f0ef8ea9"><br><br></div><div>^ See the small pink triangles? Those are the font characters; they can be selected, typed, and deleted just like any other character. (The square root is also another object-character, but one that takes up horizontal space.)<br><br></div><div>I may be able to replace all the object-chars with spaces to make a big paragraph string that could be passed into the shaper on an index basis, though the mere presence of a space character would probably ruin the cross-run arabic shaping. Alternatively I could just strip the object-chars, but that would destroy the cluster values which would make editing impossible. 🙃<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 25, 2016 at 4:27 PM, Behdad Esfahbod <span dir="ltr"><<a href="mailto:behdad.esfahbod@gmail.com" target="_blank">behdad.esfahbod@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><p dir="ltr">On Jun 25, 2016 12:33 PM, <<a href="mailto:kelvinsthirteen@gmail.com" target="_blank">kelvinsthirteen@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> > On Jun 25, 2016, at 1:39 PM, Khaled Hosny <<a href="mailto:khaledhosny@eglug.org" target="_blank">khaledhosny@eglug.org</a>> wrote:<br>
> ><br>
> > On Sat, Jun 25, 2016 at 01:06:27PM -0400, Kelvin Ma wrote:<br>
> >>>>>> Don’t you<br>
> >>>>> need<br>
> >>>>>> context to be ignored if the boundaries of the text you want to shape<br>
> >>>>> fall<br>
> >>>>>> inside a cluster? Like in the string 'af[fluency s]tate' where only<br>
> >>> the<br>
> >>>>>> 'fluency s' is supposed to be shaped?<br>
> >>>>><br>
> >>>>> Depends on why you are shaping “fluency s” alone, if it is because of,<br>
> >>>>> say, font change, then you need HarfBuzz to know the context otherwise<br>
> >>>>> you get broken Arabic shaping.<br>
> >>>><br>
> >>>> Well font change would produce a separate run that wouldn’t know about<br>
> >>> the<br>
> >>>> other runs so context can only be within a same-direction, same-font run.<br>
> >>><br>
> >>> This is wrong, font change shouldn’t break Arabic shaping, so you have<br>
> >>> to pass the context even in this case.<br>
> >>><br>
> >><br>
> >> If the text consists of text strings separated by formating objects, each<br>
> >> text string doesn’t know about what’s around it. Because that’s at a much<br>
> >> higher level in the code and harfbuzz can only handle a single font in a<br>
> >> single run at a time. To artificially jam in the neighboring runs for each<br>
> >> shaping attempt would involve an inordinate amount of string concatenation<br>
> >> and searching on the fly.<br>
> ><br>
> > One can always fix his code to not do wrong assumptions. When doing text<br>
> > layout you always need the full paragraph, and you should have it around<br>
> > after itemisation. Itemisation does not have to be done by splitting<br>
> > text, you can just store run start indices and lengths.<br>
><br>
> No, meaning font styling is created by inline styling objects. They’re like inline images except they have zero width. So a font change is really stored as a special character in between the two sections. This character is not understood by harfbuzz, which is why it does not make sense to pass anything containing it into the shaper.</p>
</div></div><p dir="ltr">That's your design's limitation. You still can fix it by using custom Unicode funcs with HarfBuzz, that returns a "default-ignorable" Unicode property for your placeholder codepoints. I just checked and it wouldn't work right now; I'll fix that. What placeholder character do you use? Can you change that?<br>
><br>
> ><br>
> > Regards,<br>
> > Khaled<br>
> _______________________________________________<br>
> HarfBuzz mailing list<br>
><a href="mailto:HarfBuzz@lists.freedesktop.org" target="_blank"> HarfBuzz@lists.freedesktop.org</a><br>
><a href="https://lists.freedesktop.org/mailman/listinfo/harfbuzz" target="_blank"> https://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
</p>
</blockquote></div><br></div>