Text appears to be drew twice #344

Closed
rdougan opened this Issue Mar 14, 2013 · 8 comments

Comments

Projects
None yet
2 participants
Contributor

rdougan commented Mar 14, 2013

I recently switch from NMCustomLabel to DTCoreText but noticed some weird behaviour.

Screenshot (DTCoreText above, NMCustomLabel below):

Screen Shot 2013-03-14 at 11 49 45 AM

It looks like the font weight is higher, even though it is using the same font family and font size. I think the cause is because the text is being drew twice.

Do you know what could cause this? I am using a DTAttributedTextContentView with some options passed in to set the font family, font size and color.

Thanks!

Collaborator

odrobnik commented Mar 14, 2013

I don't know anything about this. It would be great if you could find out the reason for this and submit a fix.

Collaborator

odrobnik commented Mar 14, 2013

maybe it has to do with the graphics context not doing sub-pixel text rendering, has anti-aliasing on and the other doesn't... I doubt that it is actually drawing twice, but you could check that too.

Contributor

rdougan commented Mar 14, 2013

OK thanks. Will dig through the code-

Contributor

rdougan commented Mar 14, 2013

I created a fresh project with nothing but DTCoreText and NMCustomLabel and created the same test:

Screen Shot 2013-03-14 at 12 17 13 PM

Looks fine. It must be something else in my project, as the view definitely isn't created twice.

rdougan closed this Mar 14, 2013

Contributor

rdougan commented Mar 14, 2013

Reopening. Figured out it the text-shadow causing it.

rdougan reopened this Mar 14, 2013

@rdougan rdougan added a commit to rdougan/DTCoreText that referenced this issue Mar 14, 2013

@rdougan rdougan Don't save the current context when drawing shadows. #344 0c7c2dc

@rdougan rdougan added a commit to rdougan/DTCoreText that referenced this issue Mar 15, 2013

@rdougan rdougan Do not drawInContext for each shadow. #344
`drawInContext:context` appears to draw the entire text for each shadow, which means if you have a shadow, the text will be drew twice. This causes strange antialiasing issues which makes the text looks weird.
699f3ac

@rdougan rdougan added a commit to rdougan/DTCoreText that referenced this issue Mar 15, 2013

@rdougan rdougan Use CGContextBeginTransparencyLayer to draw shadows without drawing t…
…he text. #344
eec77db
Collaborator

odrobnik commented Mar 15, 2013

@rdougan Please inspect 536321e and verify that this still works for you.

odrobnik closed this Mar 15, 2013

Contributor

rdougan commented Mar 15, 2013

Verified. Thanks.

Collaborator

odrobnik commented Mar 15, 2013

@rdougan Thank YOU for your research. You see if you can pinpoint the place where the problem occurs then we can fix it fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment