[HarfBuzz] Using Harfbuzz & ICU & Glyphy in OpenES2 Engine

Ariel Malka ariel at chronotext.org
Sun Feb 9 10:01:13 CET 2014


Hi Jeremy,

I have developed a solution based on Harfbuzz and ICU for rendering Unicode
text with C++ and OpenGL from the ground-up:
https://github.com/arielm/Unicode

The topic of line-breaking is also on my agenda (more on the long term,
nothing urgent...)
One of the directions I'm planning to check in the future:
https://github.com/adah1972/libunibreak

I wonder how do you handle topics like font-fallback, script-itemization
and BIDI, prior to shaping and line-breaking?

Regarding one of your questions, it's easy to pass to Harfbuzz some text
previously processed with ICU, as demonstrated here:
https://github.com/arielm/Unicode/blob/v4.0.0/Projects/Rendering/src/TextRun.h#L50

HTH,
Ariel
http://chronotext.org


On Sat, Feb 8, 2014 at 12:01 AM, Jeremy Moles <cubicool at gmail.com> wrote:

> Hey guys! I'm working on a Python3-based OpenGL library and I want to use
> the union of Harfbuzz and libicu to do some (a small subset) of what Pango
> currently does. I cannot, unfortunately, simply use Pango, as its
> dependency chain will likely stop my clients' interest dead in its tracks.
> Further, there are some issues when customizing Pango's rendering model
> (and I'm not speaking without experience here, I've done it when I wrote
> osgPango) that aren't ideal to work with.
>
> So, I would like to use hb and icu to accomplish some very basic layout in
> my OpenGL scenes (note: I will also be using Glyphy instead of my own
> rasterized SDF font textures too). I will need basic left|right|center
> alignment (potentitally justify, but it isn't a request yet), some basic
> markup support, etc.
>
> I nearly have everything working locally, but the one area I'm having a
> lot of trouble with is knowing how--and in fact, WHOSE responsibility it
> is--to determine how to break large lines of text given my sizing
> constraints. This doesn't appear to be something harfbuzz attempts to do,
> but it may have helper functions nonetheless.
>
> What I'm looking for are a few hints on how people (Behdad?) might tackle
> this problem. ALL text in this library gets converted in
> whitespace-normalized UTF8 using libicu and line breaks can only be FORCED
> by using <p/> or <br/> markup. Otherwise, all breaks should behave
> similarly to how they do in HTML.
>
> If I feed my force-delimited lines of text (that is, break my input feed
> up by <br>/<p>) one huge chunk at a time to harfbuzz, I can get the extents
> for each glyph as if I had unlimited X coordinate space. I can use these
> extents to position as required by the calling function, but again, I'm
> having trouble determining where it is safe to break.
>
> Is this something libicu can handle? Can harfbuzz make it easier?
>
> NOTE: When I "whitespace normalize" my string before ever passing it
> harfbuzz, I use the UBRK API of libicu. There are also functions like:
>
>     u_isspace()
>
> ...which look promising, but it expects a UChar32, which I do not know how
> to easily fetch while using harfbuzz's UTF8 functions, who operate on
> potential multibyte chars.
>
> Thanks in advance!
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/harfbuzz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20140209/1d96a4c1/attachment.html>


More information about the HarfBuzz mailing list