[HarfBuzz] Some questions about scripts and languages

Khaled Hosny khaledhosny at eglug.org
Sat Dec 5 07:07:42 PST 2015


On Sat, Dec 05, 2015 at 06:52:34PM +0400, Khaled Hosny wrote:
> On Sat, Dec 05, 2015 at 04:52:13PM +0530, Deepak Jois wrote:
> > I have a few questions about script and language handling in Harfbuzz APIs
> > 
> > 1. It seems that hb_buffer_guess_segment_properties uses the LC_TYPE
> > as the language. In my case, for whatever reason it is reporting it as
> > ‘c’.
> 
> If your application does not call setlocale(), you will get the C
> locale.

BTW, you shouldn’t be really using hb_buffer_guess_segment_properties,
it is just for quick testing or a last measure when you absolutely has
to use it. Text direction should be determined by applying the Unicode
bidi algorithm, script has to be derived from the Unicode character
properties after resolving characters with common and inherited script
properties. Language can’t be auto detected, so the user has to supply
it, using the system locale is just a good enough measure in case the
user can’t select a language, otherwise using the `dflt` language might
be better (ensure the text renders the same regardless of the locale).

BTW, here is a tiny library that user FriBiDi, HarfBuzz, FreeType and
its own script resolving code to layout text:

https://github.com/HOST-Oman/libraqm

The code is a bit messy right now, though.

Regards,
Khaled


More information about the HarfBuzz mailing list