Re: Pango API extension: pango_font_matches_description



Hi,

Alexander Larsson <alla lysator liu se> writes:

> > I'm working on a glyph cache that works with Pango and I got it
> > working with the current Pango API using pango_font_describe()
> > and pango_font_description_equal(). Since I have to call these
> > functions for each glyph I lookup in my cache, the fact that
> > these calls create a new PangoFontDescription by copying it from
> > the internal structs introduces a significant performance problem.
> >
> > As a solution I propose the addition of a new method in the
> > PangoFont class: pango_font_matches_description() which is passed
> > a PangoFont and a PangoFontDescription and does the comparison
> > in place.
>
> This looks totally broken.

Well, it works here...

> First of all a glyph cache on the level you seem to suggest here does not
> fit the pango API at all. If you need a glyph cache you should do so in
> the pango module (i.e. in pangoft2). There was actually a glyph cache in
> the old GtkFB pango/freetype module, but i haven't moved that over to
> pangoft2 when i made that switch.

I'd need to create an entirely new pango module then since the cache I'm
talking about here caches the glyphs in the graphics hardware. Alternatively
there could be a glyph cache in the FT2 module that provides hooks to add 
your own implementation of bitmap creation and storage. This would however 
need significant changes to the pango API.

> Second, there is no-one-to one correspondance between PangoFonts and
> PangoFontDescriptions. There can be aliases, and several fonts may match a
> PangoFontDescription. How would you match "Comic Sans MS, Arial, Helvetica
> 18 bold" to a PangoFT2 font that represents arial for instance?

I'm speaking about checking if a certain font matches a font_description, 
not the other way around.

What is the use of the existing API calls pango_font_describe() and 
pango_font_desription_equal() then? A PangoFontDescription is never 
something like "Comic Sans MS, Arial, Helvetica 18 bold". It's a struct
containing enums for style, variant, weight, stretch and size as well
as a string holding the family_name. This string seems to be always a 
single name, at least if the PangoFontDescription originates from a
call to pango_font_describe (font).

If you consider my approach broken, could you hint me into the correct
direction how to decide if two calls to pango_ft2_render() try to access
glyphs from the same font?


Salut, Sven




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