Skip to content

berleon/typeengine.js

Repository files navigation

typeengine.js - bring the beauty of LaTeX to the web

Here is the same paragraph set with Firefox (text-align: justify), typengine.js, and LaTex:

I think as long typesetting in the web is ugly, PDF will remain the goto format for scientific publishing. I hope this project encurages more HTML5 based publishing.

typeengine.js uses some advanced micro typography features:

  • Condencing an expansion of the font by a few percent (using transform: yScale()).
  • Protrusion of the Margin, e.g. moving . out of the margin (settings parsed from microtype).
  • Implements the Knuth & Plass linebreaking algorithm.

This project build upon the tex-linebreak by Robert Knight.

How to use?

For now, please see the example code. If people are interested in using this libary, I will add a better explanation.

Possible Improvments

  • When calculating overhangs, match Unicode points to closest ASCII code point: А̊ -> A. see stackoverflow
  • The microtype functionallity is currently not considered when calculating linebreaks.
  • Improve performance, maybe add some server side or static rendering capabilities.
  • Add a slightly larger whitespace at a sentence end as LaTex.
  • Make this project follow good javascript library

Further Links

  • The Hàn Thế Thành's PhD Thesis documents well how microtyping works, is well written and is a nice introduction how pdflatex works.

Contributions

Contributions are always welcome!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages