Skip to content

Sketch out HTML support - #865

Merged
pkgw merged 8 commits into
tectonic-typesetting:masterfrom
pkgw:html
Feb 21, 2022
Merged

Sketch out HTML support#865
pkgw merged 8 commits into
tectonic-typesetting:masterfrom
pkgw:html

Conversation

@pkgw

@pkgw pkgw commented Feb 20, 2022

Copy link
Copy Markdown
Collaborator

I think that I've figured out the key technical pieces to deliver acceptable HTML support. The basic model is that we'll mainly output HTML, but emit special "canvas" sections when precise glyph positioning is needed, as in equations. The challenge in those places is not so much getting glyphs in the right positions — that's tedious but doable if you can control the CSS and examine the details of the active font — but getting the browser to display any desired glyph. Some glyphs are accessible as Unicode characters, which we can reverse-map from the font data, but others aren't.

Our key solution here is to emit new variant font files with customized character maps that deliver the glyphs that we need. This is basically a form of subsetting, although one not generally supported/envisioned by existing workflows.

We implement this all using pinot for font introspection. I need to use a patched version to add some support for the OpenType MATH table to be able to reverse-map certain glyphs to Unicode.

Various things here are labeled "tdux", which is an acronym for the Tectonic Default User Experience. This will be the name given to our standard HTML template and CSS conventions. I have no intention of trying to let people get totally freeform on the HTML/CSS side since I'm 99.9% sure there will inevitably have to be some pretty tight coupling between the TeX outputs and the HTML conversion to get consistently good output.

This code isn't super useful right now since I haven't yet created a repo with the work-in-progress TDUX HTML/CSS files. That will be coming along.

pkgw added 8 commits February 20, 2022 17:16
We need a lot more infrastructure to allow proper HTML rendering.
This will be needed by the new spx2html engine that will be added
shortly. It needs to use `XdvParser::process_with_seeks()` on its input
file.
This is a new engine for creating HTML from TeX. SPX is "semantically
paginated XDV", a slight variant on the XDV output created by the XeTeX
engine during TeX processing. It looks like the it will be a misnomer:
we're going to ignore the pagination of the XDV file. But whatever.

We add a dependency on a patched version of "pinot", a crate for
analyzing OpenType files. In order to deal with some math properly, we
need to parse some of the special OpenType math tables.

Also, update dependencies in Cargo.lock.
@codecov

codecov Bot commented Feb 21, 2022

Copy link
Copy Markdown

Codecov Report

Merging #865 (96c218c) into master (fa60f6d) will decrease coverage by 0.61%.
The diff coverage is 4.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #865      +/-   ##
==========================================
- Coverage   46.63%   46.02%   -0.62%     
==========================================
  Files         146      147       +1     
  Lines       58983    59804     +821     
==========================================
+ Hits        27508    27522      +14     
- Misses      31475    32282     +807     
Impacted Files Coverage Δ
crates/engine_spx2html/src/font.rs 0.00% <0.00%> (ø)
crates/engine_spx2html/src/lib.rs 0.00% <0.00%> (ø)
crates/engine_xetex/xetex/xetex-xetexd.h 66.66% <ø> (ø)
crates/io_base/src/lib.rs 75.41% <0.00%> (-1.28%) ⬇️
crates/xdv/src/lib.rs 0.00% <0.00%> (ø)
src/docmodel.rs 56.79% <0.00%> (-0.18%) ⬇️
src/driver.rs 73.13% <0.00%> (-0.28%) ⬇️
crates/docmodel/src/document.rs 70.37% <40.00%> (-0.26%) ⬇️
crates/engine_xetex/xetex/xetex-math.c 71.29% <50.00%> (-0.09%) ⬇️
crates/engine_xetex/xetex/xetex-xetex0.c 78.91% <50.00%> (-0.13%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa60f6d...96c218c. Read the comment docs.

@pkgw
pkgw merged commit e1c9566 into tectonic-typesetting:master Feb 21, 2022
@pkgw
pkgw deleted the html branch March 2, 2022 02:59
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.

1 participant