Add in HorizontalLegend.

Lists entries side-by-side in the available width, after which the
entries wrap onto the next row. If an entry is too wide it is
truncated. If there are too many entries some rows will not be shown.

Close #755.
It's to address the scenario where the text has zero height (due to non-rendering or other issues). Elsewhere in the code, something gets divided by `this.textHeight`, which can cause problems if that something is also zero (`NaN`s spread throughout the code). I'll move the safety catch to that part.