[poppler] What is the best way of comparing two GfxFont instances?

Adrian Perez de Castro aperez at igalia.com
Thu Dec 5 06:14:22 PST 2013


Leonard Rosenthol <lrosenth at adobe.com> writes:

> 3 & 5 are not valid tests.  They will not guarantee uniqueness.

Thanks Leonard, I am sticking with comparing the IDs for the fonts.
I did some tests more and just comparing the IDs does the right
thing.

Cheers,

-Adrian


> 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
>>good discriminator?
>>
>>Thanks in advance,
>>
>>
>>-Adrian
>>
>
>

-- 
-Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20131205/05a0532d/attachment.pgp>


More information about the poppler mailing list