[poppler] What is the best way of comparing two GfxFont instances?
lrosenth at adobe.com
Wed Dec 4 11:48:46 PST 2013
3 & 5 are not valid tests. They will not guarantee uniqueness.
On 12/4/13 6:05 PM, "Adrian Perez de Castro" <aperez at igalia.com> wrote:
>Hello to all,
>What is the best way of knowing whether two GfxFont instances are
>actually the same font? I have a tentative implementation that works
>fine in tests, and I would like to know whether it is correct. It
>works like this:
> 1. If the pointers to the GfxFonts are the same, then it is
> the same font.
> 2. (else) If the Ref returned by GfxFont::getID() for the two
> fonts is the same num/gen pair, then it is the same font.
> 3. (else) If the font tags returned by GfxFont::getTag() are
> the same, then it is the same font.
> 5. (else) If the names returned by GfxFont::getName() are the
> same, then it is the same font.
> 6. (else) The fonts are different.
>My main concern is that it seems that comparing the tag seems to
>be enough, and maybe some comparisons can be removed. Also, in
>case the additional comparisons are needed, is the font name a
>Thanks in advance,
More information about the poppler