The TEXT_TabbedTextOut didn't set correctly the text starting point (x0) for left-aligned tabs and was ignoring the last tab. I've also changed GetTextMetricsA to W as this should be slightly faster.