<div dir="ltr">How does <span style="font-size:12.8px">hb.font_get_glyph & </span><span style="font-size:12.8px">hb.font_funcs_set_glyph_h_</span><span style="font-size:12.8px">advance_func work? Not sure i understand the concept here<br></span><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 28, 2016 at 7:05 PM, Behdad Esfahbod <span dir="ltr"><<a href="mailto:behdad@behdad.org" target="_blank">behdad@behdad.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">HarfBuzz already takes care of spaces if the font does not support:<br><br>  <a href="https://github.com/behdad/harfbuzz/blob/master/src/hb-unicode-private.hh#L204" target="_blank">https://github.com/behdad/harfbuzz/blob/master/src/hb-unicode-private.hh#L204</a><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sun, Jun 26, 2016 at 10:56 AM, Kelvin Ma <span dir="ltr"><<a href="mailto:kelvinsthirteen@gmail.com" target="_blank">kelvinsthirteen@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Knockout overwrites most whitespace characters to a hardcoded width and special codepoint since most fonts can’t be trusted to properly construct or even contain these characters. <br><br></div><span style="font-family:monospace,monospace">## Codepoints ##<br><br></span><div><span style="font-family:monospace,monospace">nonbreaking_spaces = {<br>            '\u00A0': -30, # nbsp<br>            '\u2007': -36, # figure<br>            '\u202F': -40, # narrow nbsp<br>            }<br><br>breaking_spaces = {<br>            '\u2003': -31, # em<br>            '\u2002': -32, # en<br>            '\u2004': -33, # 1/3<br>            '\u2005': -34, # 1/4<br>            '\u2006': -35, # 1/6<br>            <br>            '\u2008': -37, # punctuation<br>            '\u2009': -38, # thin<br>            '\u200A': -39, # hair<br>            <br>            '\u205F': -41, # math med<br>            }<br><br><br></span></div><div><span style="font-family:monospace,monospace">## Widths (as fraction of em) ##<br><br>space = self.get_advance(self.character_index(' '), True)/UPM<br>fig = self.get_advance(self.character_index('0'), True)/UPM<br>punc = self.get_advance(self.character_index(','), True)/UPM<br><br></span></div><div><span style="font-family:monospace,monospace">self._widths = {<br>        None: 0,<br>        ' ': space,<br>        '\t': 0,<br>        '\u00A0': space,<br>        '\u2003': 1, # em<br>        '\u2002': 0.5, # en<br>        '\u2004': 1/3, # 1/3<br>        '\u2005': 0.25, # 1/4<br>        '\u2006': 1/6, # 1/6<br>        '\u2007': fig, # figure<br>        '\u2008': punc, # punctuation<br>        '\u2009': 0.2, # thin<br>        '\u200A': 0.1, # hair<br>        '\u202F': 0.2, # narrow nbsp<br>        '\u205F': 4/18, # math med<br>        }<br><br><br></span></div><div><span style="font-family:monospace,monospace">## character labels (for UI) ##<br><br></span></div><div><span style="font-family:monospace,monospace">self.spacenames = {<br>        -30: 'nb', # nbsp<br>        -31: 'em', # em<br>        -32: 'en', # en<br>        -33: '1/3', # 1/3<br>        -34: '1/4', # 1/4<br>        -35: '1/6', # 1/6<br>        -36: 'fig', # figure<br>        -37: 'pn', # punctuation<br>        -38: '1/5', # thin<br>        -39: 'h', # hair<br>        -40: 'nnb', # narrow nbsp<br>        -41: 'mt', # math med<br>        }<br></span><br>My old layout engine would simply output the special negative codepoint and advance like with any other character when it encountered those unicode whitespace characters. (The negative codepoints are so that Knockout’s renderer knows how to display them.) How do I do this in Harfbuzz? They are important for mathematical typesetting.<br><br><img style="margin-right: 0px;" alt="Inline image 1" src="cid:ii_1558d33d7bf7df52"><br></div></div>
<br></div></div><span class="">_______________________________________________<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" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
<br></span></blockquote></div><span class=""><font color="#888888"><br><br clear="all"><br>-- <br><div data-smartmail="gmail_signature">behdad<br><a href="http://behdad.org/" target="_blank">http://behdad.org/</a></div>
</font></span></div>
</blockquote></div><br></div></div>