z0w0 / helm

A functionally reactive game engine, with headgear to protect you from the headache of game development provided.
http://helm-engine.org/
MIT License
598 stars 69 forks source link

Giving a maximum area for a Text #133

Open Raveline opened 6 years ago

Raveline commented 6 years ago

Though text rendering is done through Pango, the current version of Helm doesn't allow us to leverage Pango line-wrapping abilities. Considering that linewrapping is typically not something one want to do manually, it looks like a good feature to add.

The ideal feature would be to set width and height, but current Pango bindings to not provide us with the setHeight function (I've just added an issue to the Gtk2hs repo that maintain Pango about this).

In the meantime, a possible fix is to:

The beauty of it is that a call to setWidth with Nothing does... nothing, and wrapWholeWords has no effect without a set lineWidth.

I have a small proof of concept and would be happy to push a PR, but I'm troubled by two things: