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

Not properly typeset #10

Open
purpleidea opened this issue May 24, 2020 · 9 comments
Open

Not properly typeset #10

purpleidea opened this issue May 24, 2020 · 9 comments

Comments

@purpleidea
Copy link

Great idea, I love it! However the most important feature of LaTeX is proper typesetting, IOW, variable spaces, etc... Any way this can be implemented? I'm not sure how HTML would really support this. Perhaps that is an upstream browser issue that someone can fix first?

Cheers!

@vincentdoerig
Copy link
Owner

I agree, but I doubt there is a way to properly typeset HTML. Hyphenation is a mess and having text-align: justify; doesn't really help. Check out this comment from yesterday's HN thread.

The line-height, font-size and letter-spacing can probably be tweaked, but other than that there is not much that can be done using CSS only in terms of typesetting. Hopefully, the situation improves in the near future.

@purpleidea
Copy link
Author

Yeah, I always hated reading on screens for exactly this purpose. Maybe it's time for HTML to grow up and grow proper type setting? Maybe you can use this issue to track links to upstream issue trackers? Maybe open an issue with w3c, firefox, chrome, and whatever M$ is doing these days?

Thanks for the nice idea, hopefully you can properly fix ugly text everywhere!

@jotaf98
Copy link

jotaf98 commented May 24, 2020

Actually I don't think that's true anymore. Firefox apparently uses the same algorithm as TeX, see here:

mnater/Hyphenopoly#116

So for the same font and geometry, the results should be the same.

The Hyphenopoly library could be used as a polyfill for the rare cases that don't support it, but with up-to-date browsers it's becoming less and less relevant.

@purpleidea
Copy link
Author

@jotaf98 Hyphenation is only one aspect of typesetting. Open a LaTeX document and look put calipers up to your screen and measure the difference between the size of the space between two words, and the size of the space between two sentences. And there's much more...

@jotaf98
Copy link

jotaf98 commented Jun 10, 2020

That's true -- it's a start, not a full solution.

Building on Hypohenopoly's example, which iterates the words and adds hyphens at strategic places, could it theoretically be possible to iterate the words and wrap them in <span> tags with custom left/right margins and letter-spacing, following TeX's spacing algorithm?

The CSS font ligatures handle quite a bit of odd inter-letter spacing. I wonder if the level of granularity of per-word letter-spacing plus inter-word margins would be enough to achieve an almost indistinguishable effect!

@nvictor
Copy link

nvictor commented Jan 20, 2021

Nice project guys,

I have had this link in my bookmarks for quite some time: https://github.com/bramstein/typeset

Would that help with the typesetting?

@jotaf98
Copy link

jotaf98 commented Jan 22, 2021

Good find! @purpleidea and @vincentdoerig does this seem to address the issues you mentioned before?

@purpleidea
Copy link
Author

@jotaf98 I don't have time to look into it, but I hope the state of the art gets better!

@vincentdoerig
Copy link
Owner

Thanks for the link @nvictor! The project looks very interesting. Unfortunately, I'm currently also busy and don't have time to explore it further. But it's definitely something I'd like to look at in the future 👍.

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

No branches or pull requests

4 participants