<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>