Re: pango_font_description_better_match background and documentation



Hello Behdad,

Oh, is there any way that we can host those tests in pango itself?  That would
be freaking awesome.

Binary packages of our tests (test framework and the tests themselves) are here:
ftp://ftp.linux-foundation.org/pub/lsb/snapshots/t2c-desktop-tests/

There are only rpm at this time, but soon there'll be deb as well.

Tests source code will be placed at:
http://bzr.linux-foundation.org/lsb/devel/t2c-desktop-tests

At the meantime tests for pango library are under development. As soon as they ready they will appear in both these places.

Also pango test suite version will be released that do not depend on any of our specialized tools, so it will be easier to use pango test on your end.

I think you should interpret that sentence in the context introduced by the
sentence before it: "Determines if the style attributes of @new_match are a
closer match...".  So, "other attributes" here really refers to "other style
attributes".  With "style attributes" implicitly meaning all attributes sans
family and size.

Nice, that explains.

The docs can improved for sure.  Feel free to open a bug and
submit a patch.

OK, will do.

Well, it says "Approximate matching is done for weight and style".  Again,
docs can be improved to say that that approximate always creates a match.
Again, feel free to reword.

Right, I thought so too, that approximate always creates a match. But it's not:

PangoFontDescription *desc      = pango_font_description_new();
PangoFontDescription *new_match = pango_font_description_new();

pango_font_description_set_style(new_match, PANGO_STYLE_ITALIC);

pango_font_description_better_match(desc, NULL, new_match) will not return TRUE, although only style is different in these structures (PANGO_STYLE_ITALIC in desc and PANGO_STYLE_ITALIC in new_match).

The thing is why you need in compute_distance function:

else if (a->style != PANGO_STYLE_NORMAL &&
	 b->style != PANGO_STYLE_NORMAL)
{
    /* Equate oblique and italic, but with a big penalty
     */
    return 1000000 + abs (a->weight - b->weight);
}
else
    return G_MAXINT;

Why not just:

else
{
    return 1000000 + abs (a->weight - b->weight);
}

IMHO, I'd sort like this: Normal, Oblique (as it's just like Normal but slants to the right) and then Italic (as it's just like Oblique but looks handwritten (different glyphs)).

Thank you.

Regards,
Michael


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