After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 440603 - Minor ABI change
Minor ABI change
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
unspecified
Other All
: Normal minor
: ---
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2007-05-23 00:50 UTC by Morten Welinder
Modified: 2007-05-23 22:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Morten Welinder 2007-05-23 00:50:24 UTC
Have a look at bug 440514.

It appears that pango_shape in recent times has changed to require that
the analysis has a language set up too.  We have been getting away with
a NULL value in Gnumeric for many years.
Comment 1 Behdad Esfahbod 2007-05-23 00:56:22 UTC
Humm.  We do interesting stuff with language these days, yes.  Technically this has been a bug in Gnumeric, but I'm fine fixing it in Pango.  I believe you are hitting a g_return_val_if_fail() in pango_ot_tag_from_language(), right?  I can change that to legitimately allow NULL and make sure other places taking a language handle NULL too.
Comment 2 Morten Welinder 2007-05-23 01:00:59 UTC
> I believe you are
> hitting a g_return_val_if_fail() in pango_ot_tag_from_language(), right? 

Precisely.

I have put a fix into Gnumeric, but there will be some short-term grief
if a distribution picks up a new Pango, but not a new Gnumeric.  Therefore,
a Pango-side fix would be nice.
Comment 3 Behdad Esfahbod 2007-05-23 01:07:18 UTC
Feel free to revert your gnumeric change.  This only went in pango-1.17.0 that is a devel release.


2007-05-22  Behdad Esfahbod  <behdad@gnome.org>

        Bug 440603 – Minor ABI change

        * pango/pango-language.c (pango_language_includes_script):
        * pango/pango-ot-tag.c (pango_ot_tag_from_language):
        Accept language == NULL as legitimate input.

Comment 4 Owen Taylor 2007-05-23 12:27:58 UTC
Without digging the change out of subversion, I'm not sure exactly what
you did. Historically, NULL had a specific meaning as a language tag:

   Use a "mixed language" string as a sample string for computing what
   fonts were needed for metrics. (There was some comment by that string
   in the sources like "total garbage")

This was pretty much a bad idea - it meant that if a program forgot to
set a language tag, they got a) slow performance and b) bad metrics.
If you went through the GTK+ API for creating a PangoContext you always
got a language tag based on the locale but it was a trap for people 
creating one by hand. Either warning in that case or using something
locale-based would have been better.

Switching to a warning isn't a compatible change, so probably the right
thing to do is to come up with a default language tag from the environment.
which I believe you've already written code for elsewhere in Pango?
Comment 5 Behdad Esfahbod 2007-05-23 22:15:13 UTC
What I did was changing g_return_val_if_fail() to regular if().  The effect is, for NULL language, pango_ot_tag_from_language() returns 'dflt' which results in the default language-system to be used, and pango_language_includes_script() returns TRUE (much like the case for a COMMON script for example).

As for the real problem with NULL language, I made this change:

2007-05-23  Behdad Esfahbod  <behdad@gnome.org>

        Part of Bug 440603 – Minor ABI change

        * pango/pango-context.c (pango_context_init),
        (pango_context_set_language), (pango_context_get_language):
        Make itemization use pango_language_get_default() if context has no
        language set on it.  Ditto for pango_context_get_metrics() if both
        input language and context language are NULL.


So, to summarize, during itemization, an item's language is assigned in the following order:

  - If a language attribute is present, use it, otherwise
  - If a context language is present, use it, otherwise
  - Use pango_language_get_default()

  - Then, if the chosen language is not compatible with the script of the item, use the first language in $PANGO_LANGUAGE or $LANGUAGE that is compatible with the script.  If none matches, use pango_language_from_string("xx").