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

Letter spacing #11

Open
zmanring-zz opened this issue Jan 2, 2018 · 3 comments
Open

Letter spacing #11

zmanring-zz opened this issue Jan 2, 2018 · 3 comments

Comments

@zmanring-zz
Copy link

Looks like after you add more than .5px of letter spacing that it breaks the ... to a new line. Does the code handle scenarios like this?

@gareys
Copy link

gareys commented Mar 21, 2018

I have reproduced a similar issue where the ellipsis and characters in the text or html string are breaking onto a new line on initial load. I don't think it has to do with letter spacing, but the main font is loading in AFTER the react ellipsis component has mounted. Essentially, the fallback font has a smaller footprint than the downloaded font, thus breaking the truncation. This could be circumvented by allowing the user to pass an argument to the responsiveHOC to forceReload the ellipsis component after a setTimeout. The argument should be a timeout in milliseconds.

@xiaody
Copy link
Owner

xiaody commented Mar 22, 2018

@gareys good catch about the web font issue.

But I don't think this component should provide a timeout param, which would be quite weird. You can set a timeout outside the component and pass a different key to force this component to re-mount.

Also, there seems some APIs better than timeout to listen a font loaded event, like document.fonts.ready, maybe you can try those. If any of them really works, maybe we can add it to the responsiveHOC.

Using prefetch or preconnect can also help you load the fonts faster, though they can't guarantee you to finish loading fonts before JavaScript files.

@zmanring-zz
Copy link
Author

zmanring-zz commented Jul 9, 2018

I am still trying to find a solution for this.. I tried the prefetch/preload css and it doesn't seem to help :/ It seems as if the plugin is only pulling from Times where we have a custom font that isn't being recognized. I got around this by forcing a font on .LinesEllipsis but that's not a solution unless the whole site is the same font.

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

No branches or pull requests

3 participants