<div dir="ltr"><span style="font-size:12.8px">I guess you can wrap hb_font_get_glyph like </span><a href="https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp?sq=package:chromium&dr=C&rcl=1467126994&l=197" target="_blank" style="font-size:12.8px">this</a><span style="font-size:12.8px"> and pass it to hb_font_funcs_set_glyph_</span><span style="font-size:12.8px">func (to make sure they won't be replaced by notdef glyph) and use hb_font_funcs_set_glyph_h_</span><span style="font-size:12.8px">advance_func to set your custom widths.</span><br><div><span style="font-size:12.8px">(reposting directly sent mail)</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 26, 2016 at 7:26 PM, Kelvin Ma <span dir="ltr"><<a href="mailto:kelvinsthirteen@gmail.com" target="_blank">kelvinsthirteen@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 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>_______________________________________________<br>
HarfBuzz mailing list<br>
<a href="mailto:HarfBuzz@lists.freedesktop.org">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></blockquote></div><br></div>