[PATCH weston v2 1/2] Add font entry to shell section for title fonts
Ryo Munakata
ryomnktml at gmail.com
Sat Oct 4 17:50:35 PDT 2014
On Sat, 04 Oct 2014 15:08:12 -0700
Bill Spitzak <spitzak at gmail.com> wrote:
> On 10/04/2014 04:37 AM, Ryo Munakata wrote:
> > cairo-util has used sans font family for title fonts so far.
> > But sans doesn't support glyphs of some non-ascii characters.
> > So now let users choose a font family for titles.
> >
> > To show texts correctly now using pangocairo for redering fonts.
> > If any single font in 'fonts' entry doesn't contain all the needed glyphs,
> > we use the fallback mode of pango.
>
> As far as I can tell Pango does this fallback without any setup, not
> sure why you have all this code for turning on fallback. The following
> seems to produce all the assigned glyphs in just about every block I
> tried, and certainly produces glyphs that are not in sans:
>
> PangoFontDescription *font_description = pango_font_description_new ();
> pango_font_description_set_family (font_description, "sans");
> pango_font_description_set_weight (font_description,
> PANGO_WEIGHT_NORMAL);
> pango_font_description_set_absolute_size (font_description, 32 *
> PANGO_SCALE);
> PangoLayout *layout = pango_cairo_create_layout (cr);
> pango_layout_set_font_description (layout, font_description);
> pango_layout_set_markup (layout, text, -1);
> pango_layout_set_width(layout, (W-20) * PANGO_SCALE);
> pango_layout_set_height(layout, (H-100) * PANGO_SCALE);
> cairo_move_to (cr, 10.0, 100.0);
> pango_cairo_show_layout (cr, layout);
> g_object_unref (layout);
> pango_font_description_free (font_description);
Hi, Bill.
Thank you for reviewing!
Yeah, pango does fallback without any setup but that isn't what I want.
What I want to do with 'fonts' entry is: if *every single* font in the list
doesn't have *all the needed* glyphs, then, we set the first font in the list
and use pango fallback mode.
The code you wrote is something like:
sans doesn't seem to have some glyphs. Let's use pango fallback mode.
pango_layout_set_best_font() does the followings:
1. Oops, sans doesn't have all the needed glyphs.
2. So then, try the next font in the list.
3. It also doen't contain some glyphs. Let's try the third one.
4. Finally, it contains all the needed glyphs. Let's use the third one.
or:
4. It also doesn't. Set the first font and let's use pango fallback mode.
(This is the case you showed me)
The point is pango_layout_set_best_font() respects the fonts list users specified as much as possible.
Maybe the commit message I wrote is unclear or broken.
Sorry about that.
--
Ryo Munakata <ryomnktml at gmail.com>
More information about the wayland-devel
mailing list