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 113452 - fallbacks in pango_fc_font_get_metrics()
fallbacks in pango_fc_font_get_metrics()
Status: RESOLVED NOTABUG
Product: pango
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: Small fix
Assigned To: pango-maint
pango-maint
Depends on: 105553
Blocks:
 
 
Reported: 2003-05-21 15:59 UTC by Morten Welinder
Modified: 2009-01-03 00:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10



Description Morten Welinder 2003-05-21 15:59:45 UTC
pango_xft_get_context does...

    context = pango_xft_get_context (display, 0);

which does not look multihead safe to me.

FYI, in my case it is called from pango_xft_font_get_metrics from
pango_font_get_metrics which in turn is called from my code where
I actually have a valid context.
Comment 1 Owen Taylor 2003-05-21 16:18:32 UTC
A single font can be used for multiple PangoContext's (which
is good, since there are usually many PangoContext's for
an app), so we can't retrieve the PangoContext that you
already have.

PangoContext is a lightweight structure, and creating
the context is much less work than the rest of the 
metrics computation you are looking at. (Which is fortunately
cached, so only done once for PangoXftFont)

So, the right fix is entirely trivial:

-          _pango_xft_font_map_get_info (xfont->fontmap, &display, NULL);
-          context = pango_xft_get_context (display, 0);
+          _pango_xft_font_map_get_info (xfont->fontmap, &display,
&screen);
+          context = pango_xft_get_context (display, screen);
Comment 2 Morten Welinder 2003-05-22 20:58:16 UTC
I'm not worried about the weight of the operation, but rather about
whether the locally created context has the right set of attributes.
By construction it must be using default settings for language and
direction, for example.
Comment 3 Owen Taylor 2003-05-27 18:57:11 UTC
A PangoXftFont corresponds directly to a single FreeType font, 
so language, direction and so forth don't matter.

There is a problem that we dont' have any way of disabling
fallbacks, so if the font doesn't have all the characters
in the string being measured, the fallbacks *will* be
language dependent, but that needs to be fixed by turning
off fallbacks 

(Bug 105553, though with the added complication
that we don't want to allow space for the "Unknown Glyph"
character ... in fact, we want to average the characters
in the sample string that we *are* in this font ...
so we'll probably have to iterate through the resulting
glyph string to figure things out.)

Comment 4 Owen Taylor 2003-05-27 19:06:44 UTC
Did the easy part of the fix.

Tue May 27 15:01:24 2003  Owen Taylor  <otaylor@redhat.com>
 
        * pango/pangoxft-font.c (pango_xft_font_get_metrics):
        Get the fontnmap for the right screen (#113452,
        Morten Welinder)
Comment 5 Owen Taylor 2004-02-19 15:27:09 UTC
Should actually be pretty trivial once Bug 105553 is fixed, but
non-critical so punting anyways.
Comment 6 Owen Taylor 2004-11-23 16:13:16 UTC
Retitling to better reflect current code organization and the 
remaining problem.
Comment 7 Behdad Esfahbod 2009-01-03 00:03:23 UTC
I actually don't think the current behaviour is undesirable.  If you ask for Persian metrics of your Latin fonts, whatever fallback font will be used to render Persian text should also be used to compute Persian metrics.  Closing.