[HarfBuzz] HarfBuzz glyph offsets

Jonathan Blow jon at number-none.com
Thu Dec 24 12:50:42 PST 2015


Khaled wrote:



> Each Unicode character has a script property, so you don’t need to hard
> code it for the text. The only complication is inherited or common
> characters, but there is a simple heuristic to handle them, see for
> example:
> https://github.com/HOST-Oman/libraqm/blob/master/raqm.c#L289
>
> But if you are sure your text is always single script and language (I
> see the Arabic has English words, so doesn’t seem to be the case), then
> you can hard code the script values.
>

​Does this mean that passing UNKNOWN and letting HB figure it out is the
right thing then?

Empirically, I tried setting the script and language to totally incorrect
things a few times, and I have not seen obviously incorrect output, so I
don't know how to isolate test cases for these things; and even if I were
to implement a complicated strategy for picking the language and script, I
have no idea how I am supposed to know when my code is actually working.​


​For example: Is there some sample text in mixed Arabic w/ bidi English
names, etc, that will come out wrong if I just set the language to "arb"
and script to arabic? That is what I am doing in those screenshots, and
whereas "they look fine to me" we all know that is no guarantee things
aren't horrible in some corner case.​



​Simon wrote:

> The confusion comes from the fact that Jonathan seems to be writing a
​> ​
glyph rendering library
​ .​
.
​..
The *problem* comes from the fact that he's mixing
​> ​
layers and using
​ ​
Harfbuzz inside his glyph rendering library, which is
​> ​
totally not where
​ ​
it should be used.
​

​That is not at all what is happening. This is a 300kLOC program that does
really quite a lot of things. One tiny fraction of its functionality is
rendering glyphs; another tiny fraction of its functionality is the
higher-level interface where you say "Draw this text at this location with
this shader etc" and it talks to HB and FT. When one is programming at all
these layers, one chooses the abstractions that make the most sense for
that particular domain.

The confusion is mostly just a cultural issue as I was guessing. Now that
it's clarified things make more sense.​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20151224/e0955204/attachment.html>


More information about the HarfBuzz mailing list