Re: [dev] GUIs

From: LM <>
Date: Wed, 22 May 2019 15:19:40 -0400

Sylvain .Bertrand wrote:
> The only really tough thing with a GUI toolkit (C or anything else) is what you
>wrote above: "correct" layout/navigation and rendering of unicode text at near
>global scale.

I've been investigating that. Was reading the Unicode information on
the BIDI algorithm among other things. I think there should be a way
to simplify internationalized text layout and still support some (not
all) of the more difficult use cases.

One simplification might be to only allow right to left or left to
right display on a particular line so you don't have to deal with
embedding one in the other. If you're using a GUI to create a form or
to read text displayed on the screen (like a menu or about
information), average programs would display text in the user's
language and not have text displayed in several directions with
characters from multiple languages all at once on the same screen.
So, why not pick left to right or right to left based on the default
language settings (or let the application designate a default) and
display and take input that way?

Then there's the issue with some characters needing diacritics or
vowel characters drawn underneath or above them. The Unicode
character set typically has the consonant and vowel as two different
characters even if they're drawn in the same location. The diacritic
or vowel is specified as having zero width. What I found less than
intuitive was that the consonant with width came first and then the
zero width character. It would make more sense to recognize zero
width and not increment or decrement to the next field. I did see
some examples where other standards placed the zero width character
first, but the Unicode standard does the reverse. So, which would be
the more useful method for a GUI, follow the Unicode standard and
place the zero width character after the character it's combined with
or place the zero width character in front of a standard character?

It doesn't cover every layout scenario, but I'm thinking if a GUI has
the following features it could handle several situations:

1) GUI can be switched from left to right or right to left (for
drawing and input) for a particular line
2) GUI can handle drawing zero width characters over normal characters
3) GUI can draw text where the application requests and allows the
application to decide on positioning/layout on screen

Are there other features someone would find absolutely necessary to
convey information in a particular language they work with?

I'm not a fan of harfbuzz either. I personally dislike the circular
dependency it has with FreeType. When I see a circular dependency, my
first thought is that the code should be refactored so that what's
needed by both libraries ends up in yet another library that can be
used as a base dependency by both. I've been avoiding the issue by
building FreeType without the harfbuzz dependency. FreeType seems to
work fine without it as long as you're only working with TrueType
fonts and not using OpenType fonts. If I'm using someone else's
pre-built packages, I'm stuck with however the packages are built.
However, when I build the libraries myself from source (which I prefer
to do), I leave out harfbuzz and just use FreeType for TrueType font
rendering. Another option would be to leave out FreeType and just use
stb_truetype.h. I'm still investigating that possibility. I did some
reading on what others mentioned were the differences between the
FreeType library and stb_truetype.h and the reports typically favored
FreeType as being faster and clearer to read. If I do get both
techniques implemented in my current project, it'll be interesting to
compare the end results.

By the way, nice job on the charfbuzz port. It would be great if it
wasn't completely necessary and more systems went with FreeType
without the circular dependency or started using stb_truetype.h.
There are a few GUI toolkits (like Nuklear) using stb_truetype.h, but
unfortunately there aren't a lot of basic applications available using
those GUIs. I'd really like to see more active development using
alternative lightweight GUIs.

Received on Wed May 22 2019 - 21:19:40 CEST

This archive was generated by hypermail 2.3.0 : Wed May 22 2019 - 22:24:09 CEST