Hi,

I'd like to suggest the attached patch to
pango/pango-context.c.

Pango's shaper engine (struct _PangoEngineShapeClass) can
have a callback function "covers", but it seems that it is
not utilized that much.  In the function
get_shaper_and_font_foreach(), the return value of
(PangoCoverageLevel) _pango_engine_shape_covers() is simply
checked against PANGO_COVERAGE_NONE, and if any other value
is returned, that font is accepted.

I think it is better to try another font if
PANGO_COVERAGE_FALLBACK or PANGO_COVERAGE_APPROXIMATE is
returned here until PANGO_COVERAGE_EXACT is returned.

That way, pango can use a font most preferred by a shaper
engine while falling back to APPROXIMATE or FALLBACK font.

What do you think?

If the patch is accepted, the next step will be to modify
each shape engine to supply proper "covers" function if the
default "covers" function is not enough.  For instance,
indic shaper should accept only proper OTFs.

---
Kenichi Handa
[EMAIL PROTECTED]

*** pango-context.c     04 Apr 2005 14:07:57 +0900      1.74
--- pango-context.c     22 Jul 2005 16:59:41 +0900      
***************
*** 867,872 ****
--- 867,873 ----
    GSList *engines;
    PangoEngineShape *shape_engine;
    PangoFont *font;
+   PangoCoverageLevel level;
  } GetShaperFontInfo;
  
  static gboolean
***************
*** 884,894 ****
  
        level = _pango_engine_shape_covers (engine, font,
                                          info->lang, info->wc);
!       if (level != PANGO_COVERAGE_NONE)
        {
          info->shape_engine = engine;
          info->font = g_object_ref (font);
!         return TRUE;
        }
      }
  
--- 885,899 ----
  
        level = _pango_engine_shape_covers (engine, font,
                                          info->lang, info->wc);
!       if (level > info->level)
        {
          info->shape_engine = engine;
+         if (info->font)
+           g_object_unref (info->font);
          info->font = g_object_ref (font);
!         info->level = level;
!         if (level == PANGO_COVERAGE_EXACT)
!           return TRUE;
        }
      }
  
***************
*** 926,931 ****
--- 931,937 ----
    info.wc = wc;
    info.shape_engine = NULL;
    info.font = NULL;
+   info.level = PANGO_COVERAGE_NONE;
  
    info.engines = state->exact_engines;
    if (state->enable_fallback)
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Reply via email to