Re: Pango-WARNING failed to choose a font



Thanks.

Pango ignores pangox.aliases, probably pangox.aliases is a legacy thing.
I tried pango-querymodules, it doesn't work.

--------------
I figured out a way to solve the problem, it is not too hard.

I figured out why pango cannot find the font.

In pango-context.c, there is a function called pango_context_init.
The line "pango_font_description_set_family_static (context->font_desc, "serif");" sets the font family but it is not setting to something that is installed on my system.

Using the command ' fc-list : family |grep -i serif', I found out that I have the following serif families:

DejaVu LGC Serif
FreeSerif
Bitstream Vera Serif
Microsoft Sans Serif
Liberation Serif
Luxi Serif
DejaVu Serif,DejaVu LGC Serif Condensed

----------

So, I just need to modify the line to point to the exact family name. For example, if I want to use FreeSerif which is installed on my system, then modify the line:

pango_font_description_set_family_static (context->font_desc, "FreeSerif");

-----------------------
static void
pango_context_init (PangoContext *context)
{
  context->base_dir = PANGO_DIRECTION_WEAK_LTR;
  context->resolved_gravity = context->base_gravity = PANGO_GRAVITY_SOUTH;
  context->gravity_hint = PANGO_GRAVITY_HINT_NATURAL;

  context->set_language = NULL;
  context->language = pango_language_get_default ();
  context->font_map = NULL;

  context->font_desc = pango_font_description_new ();
  /* pango_font_description_set_family_static (context->font_desc, "serif"); */
  pango_font_description_set_family_static (context->font_desc, "FreeSerif");
  pango_font_description_set_style (context->font_desc, PANGO_STYLE_NORMAL);
  pango_font_description_set_variant (context->font_desc, PANGO_VARIANT_NORMAL);
  pango_font_description_set_weight (context->font_desc, PANGO_WEIGHT_NORMAL);
  pango_font_description_set_stretch (context->font_desc, PANGO_STRETCH_NORMAL);
  pango_font_description_set_size (context->font_desc, 12 * PANGO_SCALE);
}
----------------

Recompile pango and probably any libraries or applications that have dependencies on pango and the font loading problem will be resolved.

-------------

--- On Sat, 10/9/10, Sid Kapoor <sidkapoor2000 gmail com> wrote:

From: Sid Kapoor <sidkapoor2000 gmail com>
Subject: Re: Pango-WARNING failed to choose a font
To: "Behdad Esfahbod" <behdad behdad org>
Cc: "William Mok" <wmok6600 yahoo com>, gtk-i18n-list gnome org
Date: Saturday, October 9, 2010, 2:05 AM

Hi William,
 
Did you set the environment properly ?
 
Try some steps as mentioned below:
 
1) export PANGO_RC_FILE=/lib/pango/pangorc
2) Give the path of your pango.modules file in pangorc
3) Check your pango.modules file. Is your pango module path properly mentioned in the pango.modules file ?
4) If not then generate a fresh pango.modules file by running a binary pango-querymodules.
5) Also check your pangox.aliases file. Is your new font mentioned in that file ?
 
Thanks,
Siddharth Kapoor

On Tue, Sep 21, 2010 at 11:24 PM, Behdad Esfahbod <behdad behdad org> wrote:
Try strace'ing to see what files pango is trying to access and go from there.
 There's not much else I can suggest.

behdad

On 09/21/10 13:53, William Mok wrote:
> If you know the part of the code that I should investigate, then I can
> see if I can do some debugging.
>
> Which file or which functions should I pay attention? Thanks.
>
> --- On *Tue, 9/21/10, Behdad Esfahbod /<behdad behdad org>/* wrote:
>
>
>     From: Behdad Esfahbod <behdad behdad org>
>     Subject: Re: Pango-WARNING failed to choose a font
>     To: "William Mok" <wmok6600 yahoo com>
>     Cc: gtk-i18n-list gnome org
>     Date: Tuesday, September 21, 2010, 10:48 AM
>
>     On 09/21/10 13:45, William Mok wrote:
>     > Thanks.
>     >
>     > fc-match returns
>     > Vera.ttf: "Bitstream Vera Sans" "Roman"
>     >
>     > Apparently pango does not like this,
>     >
>     > (gtk-demo:3274): Pango-WARNING **: failed to choose a font, expect
>     ugly
>     > output. engine-type='PangoRenderFc', script='latin'
>     >
>     > (gtk-demo:3274): Pango-WARNING **: failed to choose a font, expect
>     ugly
>     > output. engine-type='PangoRenderFc', script='common'
>     >
>     > **** so, how do I get fc-match to return something else? Or what
>     kind of
>     > font I need to install?
>
>     Donno.  Something wrong with your pango installation.
>
>     behdad
>
>
_______________________________________________
gtk-i18n-list mailing list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]