Comments (9)
+1 Same thing here (but with "Lato").
from fontfaceobserver.
So there are two different things at play here:
- Google Fonts using the same name as a (potentially) locally installed font
- Metric compatible fonts (e.g. Lato)
The problem with 1 is that from the perspective of FontFaceObserver PT Sans (local) and PT Sans (Google fonts) are indistinguishable. So what happens is that FontFaceObserver tries to detect a font by using its font family name. At that point the browser just applies the local font, and FontFaceObserver detects that. So it doesn't wait until the web font has loaded. The reason the promise is rejected for the locally installed font is problem 2.
The problem with 2. is most likely the bug reported in #9. I'm working on a fix for that, and I'm hopeful it will also resolve this one.
The only thing that will not work either now or in the future is detecting a web font that has the same name as a locally installed font (in this case it will resolve as soon as the local font is applied --- which maybe is acceptable behaviour).
from fontfaceobserver.
Ok, so in my case FFO was not working correctly because, by having Lato installed locally, the promise was rejected. However, with the new version of Chrome (41) this bug is gone. So now I have the promise resolving successfully (same code as before...). IMHO, this issue could be closed. 😉
from fontfaceobserver.
I believe I fixed the bug for locally installed fonts with v1.4.3. Could you give that a try and see if it resolves your problems?
from fontfaceobserver.
Yeah, I observe the same — with Chrome 41 and 1.4.2 the bug is gone.
Closing issue, thanks!
from fontfaceobserver.
Hi @bramstein,
Big fan of FontFaceObserver, thanks for that. I've been playing around with it lately but found this same issue. Promise gets rejected when trying to load a local font.
My current project is pretty complex so I've made a minimal demo to test/reproduce the problem more easily. It's testing Arial at the moment, although it doesn't matter, as long as it's a locally installed font, the Promise gets rejected. I added Open Sans to check that switching to it does resolve without any issues.
I'm using FontFaceObserver 1.4.6 with the Promise polyfill, you'll find the relevant code at the bottom of the JS tab. https://jsbin.com/cogipa/edit?html,js,console
So far it fails on almost all modern desktop browsers, as of today Chrome 48, Chrome Canary 50, Firefox 44 and Opera 35, but works fine on Safari 9.0.3.
Thanks
from fontfaceobserver.
@jaicab Hmm. Font Face Observer is using the native font loading API if it is available. The native font loading API does not support detecting locally installed fonts, but it is a huge improvement in performance. Maybe we can do a special build for cases like this? I think for the majority of users it is an improvement.
from fontfaceobserver.
Oh sorry @bramstein, I just realized I was assuming it did detect locally installed fonts all along, that's why I was so surprised with its faulty behavior.
And if it's possible, yes! It would be great, the setup I have works on this basis of being able to detect locally installed fonts.
Let me rephrase all this on a new issue.
from fontfaceobserver.
Ok all moved to #55!
from fontfaceobserver.
Related Issues (20)
- Is this library redundant with "font-display"? HOT 4
- fontfaceobserver.com certificate expired
- Do I need to load observer on each page?
- Do you guys have Metrics ? HOT 1
- 'FontFaceObserver' is not defined no-undef on ReactJS
- fontfaceobserver cause error HOT 1
- Do something for each font loaded by Promise.all() HOT 1
- Promise resolved for variable fonts before variations are available HOT 1
- Fonts fail to load HOT 4
- FFO and variable fonts HOT 1
- fontfaceobserver.min.js flagged as Miner.Jswebcoin virus by Symantec HOT 5
- Unable to load custom font HOT 1
- Unable to load fonts with Number in their Names. HOT 1
- Test partial font (Google Fonts "text" parameter) HOT 2
- Consistently failing to load in macOS Safari when observing Cloud Typography webfont HOT 1
- timeout exceed error HOT 1
- How do I load fonts from fontshare.com HOT 1
- How is this licensed? HOT 2
- verify local limit
- Why does the same font give different results in different browsers?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fontfaceobserver.