[HarfBuzz] Improvement for hb_buffer_guess_segment_properties()

Grigori Goronzy greg at chown.ath.cx
Mon Mar 4 19:58:53 PST 2013

On 12/24/2012 03:29 PM, Konstantin Ritt wrote:
> Here is an implementation of
> hb_language_get_default_for_script(hb_script_t) that could be used in
> hb_buffer_guess_segment_properties() by default, when there is no
> language set for a segment.

Good idea, but this is quite different from the implementation in Pango
(pango-language.c) that Behdad pointed me to some time ago. For some
ambiguous scripts that I know, this maps to specific languages - for
instance consider the HAN script. It is used equally in Japanese,
Chinese and in various other languages. So there is no representative

Also, shouldn't it be more efficient to use a big switch-case lookup?
This leaves compilers more room for optimization. What do you think
about the implementation in [1]?

I'd really like to see an implementation of such a script-to-language
mapping in Harfbuzz - not only in guess_segment_properties, it should be
offered as a separate function.

Best regards


More information about the HarfBuzz mailing list