Re: Using pango in KMSCON (terminal-emulator)

On 13-02-22 09:45 AM, David Herrmann wrote:
Hi Behdad

Hi David,

Minor comments below.

On Tue, Feb 19, 2013 at 8:28 AM, Behdad Esfahbod <behdad behdad org> wrote:
4) It's important that I get full access to the 2D buffer of the
glyph. I sometimes need to change stride/size/etc. and the
hardware-blitters have different constraints. Hence, I cannot use any
opaque "glyph"/gtk/etc. structures but instead need _direct_ buffer

You can get that with pangocairo.  I hear you want to do your own blitting.
That's fine.

So you mean I should allocate a cairo_image_surface_t, draw to it and
then use the buffer of the image_surface? Yeah, ok, that sounds about


3) How am I notified about font-updates in the system? If the
currently used font is updated I'd like to clear my cache and let
pango re-render the glyphs.

For fontconfig changes, you can do something like this:

Awesome! Thanks! dnotify/inotify on the font-config files, few-seconds
timeout to combine multiple notifications and then clear the caches.
One thing is missing though: You don't update the monitor itself if
the configuration changes? Is that on purpose? There might be new
font-directories or configuration files that we should add to the

Humm.  Isn't that done here:

        if (fontconfig_cache_update ()) {
                notify = TRUE;
                monitors_free (handle->monitors);
                handle->monitors = monitors_create (data);

Also, which pango object do I need to recreate on change? Everything
down to the font-map?

pango_fc_font_map_cache_clear() should do it.  You would also need to notify
PangoContext / PangoLayout that "some things changed" by calling their
changed() method.  Or just recreate those, since I assume you would need one
at a time.

4) What should I use as default render-mode? High-DPI (>300?) no AA
but subpixel? Low-DPI AA but no subpixel? I have actually no idea what
looks best... And what to do if I cannot get DPI or subpixel-layout
information for a display?

If anything, you should enable subpixel for low DPI and siable for high.  It's
tricky though.  Best to not try to out-guess the user.  Just do nothing?

I recently read your article about font-rendering with high DPI and
was wondering what to do. But maybe that decision belongs to
font-config and pango, and I should just let them chose the default
and not care at all. Users can always use font-configurations to
overwrite it, anyway.

The problem I was addressing had constraints such as linear layout and metric
compatibility.  None applies to your application AFAIU.


Thanks a lot for your help! I will give pangocairo a try.


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