Bug#897233: openttd: Replace ICU ParagraphLayout usage

2018-10-04 Thread Matthijs Kooijman
Hey folks,

I've (finally) opened an upstream bug for this to track progress:
https://github.com/OpenTTD/OpenTTD/issues/6922

If this cannot be fixed upstream in a timely manner, one additional
option would be to simply not compile OpenTTD with ICU layout support.
There is already a simpler fallback layouter in place that is probably
satisfactory for western languages, but probably provides bad results
for RTL languages, or languages where word-breaking works differently.

I'm wouldn't be too happy with this, though I'm not sure how much users
would really be affected (From a quick glance, popcon does not collect
locales...).

Gr.

Matthijs


signature.asc
Description: PGP signature


Bug#897233: openttd: Replace ICU ParagraphLayout usage

2018-04-30 Thread Matthijs Kooijman
Package: openttd
Version: 1.7.1-1
Severity: normal

Hi,

OpenTTD currently uses the ICU ParagraphLayout API for doing
internationalized wordwrapping. This usage is a problematic, since
ICU deprecated and removed their layout API for being buggy and
unmaintained. The ParagraphLayout API that OpenTTD uses is still present
in ICU, but it relies on the removed Layout API. This gap can be be
filled using the icu-le-hb library, which implements the layout API on
top of the Harfbuzz library.

However, it seems icu-le-hb is more of a proof of concept and not really
maintained either. Additionally, because ParagraphLayout is in ICU and
icu-le-hb depends on ICU, this gives an undesirable circular dependency
which complicates updating to new ICU versions.

See https://bugs.debian.org/894159 for more info on this, in particular
https://bugs.debian.org/894159#45 and onwards.


It seems it would be beneficial to move away from the ICU
ParagraphLayout API, so it can be removed (OpenTTD is the only user in
Debian), but also because it has indeed proven to be buggy in the past
(OpenTTD talks about ICU-related crashes, though this was before the
icu-le-hb implementation).

In the above linked bug, the following was written:

> > Another solution is of course to disable ParagraphLayout. László also
> > asked if OpenTTD, being the only user of this API, could migrate to
> > another solution. I've discussed this with OpenTTD upstream yesterday,
> > and they were already aware of the layout API removal and have been
> > casually looking at Harfbuzz and Pango as a replacement, but they do not
> > see an easy solution yet. ParagraphLayout seems to fit their usecase
> > quite neatly: they need internationalized word-wrapping of text (e.g.
> > also supporting right-to-left locales). Harfbuzz does not seem to offer
> > that, and Pango seems heavy-handed (and might not be easy to adapt to
> > OpenTTD's SDL renderer, and might not be portable enough).
> This is bad to read. I had the hope there's an easy solution and/or the
> replacement might be already in the making.
>
> > Neither me or upstream has much experience in this field, perhaps you
> > have a different suggestion for an alternative?
> I don't know any other alternative. Only OpenTTD uses the Paragraph Layout
> API and it makes me wonder what other solution the other projects use? I
> may think other games like Lincity-NG[3] also need internationalized text
> placement and/or LibreOffice still need to handle this as well. Do these
> have an alternative solution?

I'm currently dicussing these options with upstream, hopefull we can
find some alternative that works well and is maintained better.

Gr.

Matthijs