[PATCH weston] Add font entry to shell section for title fonts

Pekka Paalanen ppaalanen at gmail.com
Tue Sep 2 23:50:05 PDT 2014


On Tue, 2 Sep 2014 13:13:17 +0900
Ryo Munakata <ryomnktml at gmail.com> wrote:

> On Mon, 1 Sep 2014 14:05:42 +0300
> Pekka Paalanen <ppaalanen at gmail.com> wrote:
> 
> > On Thu, 28 Aug 2014 20:31:37 +0900
> > 
> > Hi,
> > 
> > considering that the toytoolkit (well, shared/cairo-util.h here) uses
> > cairo_show_text(), which is documented as:
> > 
> > 	"The cairo_show_text() function call is part of what the cairo
> > designers call the "toy" text API. It is convenient for short demos and
> > simple programs, but it is not expected to be adequate for serious
> > text-using applications. See cairo_show_glyphs() for the "real" text
> > display API in cairo."
> > - http://cairographics.org/manual/cairo-text.html#cairo-show-text
> > 
> > I'm not sure being able to choose the font is appropriate. If we wanted
> > text to work right, we cannot trust any single font to contain all the
> > needed glyphs, which is what cairo_show_text() assumes. We'd need a
> > list of fonts to fall back when a glyph is not found.
> > 
> > If this was just about the toytoolkit alone, I would probably not
> > bother with it, but since we use the same code to draw Xwayland
> > decorations, maybe doing text rendering properly would be worth it?
> > 
> > Would be much better to rely on pangocairo, as it seems we already use
> > pangocairo when it's available. When pangocairo is disabled in the
> > build, we should fall back to the current cairo_show_text().
> > 
> > Does that make sense?
> > 
> > 
> > Thanks,
> > pq
> 
> Hi, Pekka.
> 
> I agree with you. It makes sense.
> I'm working on it.
> 
> Here's a few questions:
>  * Is pangocairo optional, not a requirement?
>    Should I write the code like:
>    #ifdef HAVE_PANGOCAIRO	
>     /* use pangocairo */
>    #else
>     /* use cairo */
>    #endif
>    or can I assume we can use pangocairo for sure?

The "editor" demo client already uses pangocairo, so see what it does.
I haven't really looked myself.

Yeah, the #ifdef HAVE_PANGO is indeed what I meant, because I
don't think we want to unconditionally require pangocairo for Weston.
We need the old approach for when pangocairo is disabled.

If you are getting many places with #ifdefs, try to think if it would be
possible to restructure the code to either have two sets of function
definitions chosen by a single #ifdef, or maybe even two separate files
of which only one gets into the build as configured.

>  * I will add 'fonts' entry to shell section. Is that okay?
>    'fonts' entry is a list of fonts: fonts=font1,font2,font3
>    Is 'shell' section the right place to add fonts entry?

If it's necessary, sounds fine.

Btw. in your original patch, I'd probably prefer if
config_get_font_family() or similar would not be in shared/. I suppose
most programs already parse the .ini file, and all they want is to
feed, say, a string to shared code to set up the fonts.

> I think we need a way to choose the fonts.
> For example, if you search for something on Google Japan using firefox,
> the title of firefox will be garbled because of sans which is a default font.
> (I mean mojibake: http://en.wikipedia.org/wiki/Mojibake)
> 
> I know Weston is just a reference implementation, not to use for real.
> What do you think about it considering the policy of Weston?
> Should I continue to work on it?

I think it would be good, yes. I don't expect the code required to be
too much when using pangocairo.

I'd expect this to be a Weston 1.7 thing rather than 1.6, so no rush.


Thanks,
pq


More information about the wayland-devel mailing list