Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubPixel Font Rendering #602

Merged
merged 3 commits into from
Jun 3, 2012
Merged

SubPixel Font Rendering #602

merged 3 commits into from
Jun 3, 2012

Conversation

rodneyrehm
Copy link
Contributor

Here's a test to determine if a browser has support for SubPixel Font Rendering. (DirectWrite vs. GDI on Windows, for example).

This could be used to switch fonts in case SubPixel Font Rendering is not supported and another font would look better.

// get actual width of text
width = window.getComputedStyle
? window.getComputedStyle(inner,null).getPropertyValue("width")
: '44px',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like you don't need this constant/magic-value at all. just checkin with window.getComputedStyle should do the trick?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, obviously. I removed the variable width and the unnecessary assignment. thx!

ryanseddon added a commit that referenced this pull request Jun 3, 2012
SubPixel Font Rendering feature detect, closes #602
@ryanseddon ryanseddon merged commit 0338d1d into Modernizr:master Jun 3, 2012
@ryanseddon
Copy link
Member

Thanks @rodneyrehm

@renancouto
Copy link

Is this feature working right? I'm getting no-subpixelfont (false) every time.
I've tested on Firefox 14 with DirectWrite enabled (true (6.1.7601.17789)), it supposed to return true, right?

@rodneyrehm
Copy link
Contributor Author

There is an issue with initial page zoom. If the page is zoomed, this test currently fails (and we don't have a clue how to circumvent that, yet).
Other than that it should work, yes.

@renancouto
Copy link

Thanks for the reply, but I'm still getting false. Here's the example: http://jsfiddle.net/fHUvY/
I got false on Firefox, Chrome and Opera (at least on FF should it should get true, since I checked on the about:support and the DirectWrite was enabled) and only got true on IE9. I tested on Windows 7 with a GeForce 9400 GT graphics card.

@rodneyrehm
Copy link
Contributor Author

Might detect-zoom help identify the initial zoom level? Looks like an awful lot of code to load for "a simple test", though

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this pull request Feb 22, 2015
SubPixel Font Rendering feature detect, closes Modernizr#602
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants