## tex4ht - Bugs: bug #123, support fontspec

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

## bug #123: support fontspec

 Submitted by: Karl Berry Submitted on: Wed 13 Jan 2010 01:29:20 AM EET Category: None Priority: 1 - Later Severity: 5 - Normal Status: Fixed Privacy: Public Assigned to: Michal Hoftich Open/Closed: Closed

Sun 11 Dec 2016 01:43:13 AM EET, comment #17:

committed to tl, r42672.

yes, regression testing is desperately needed.

Karl Berry <karl>
Sat 10 Dec 2016 11:22:36 PM EET, comment #16:

I've found some issues when I tried to compile my older document which uses minted for syntax highlighting - calc package failed to load correctly. It uses \@for\sometempvar:=...\do{} command, and as I've found, the : had wrong catcode, so it was seen as part of the command name, instead of delimiter.

After some research I've found that tex4ht saves catcodes before the usepackage.4ht is included, and restores them afterwards. Expl3 is used in fontspec patch and it somewhat messed this catcode business.

It should be fixed by newest commit.

Regarding upgrading, I think it would be great to have some regression testing. To test if testing documents compile without compilation errors and that the resulting files contain correct XML. Both could be done with Lua, in order to be portable.

Michal Hoftich <michal_h21>
Sat 10 Dec 2016 01:53:58 AM EET, comment #15:

it was my mistake. you did mention it in the first changelog entry, but i failed to check that. sorry. committed to tl, along with the new html4.4ht (42665, 42666)

another excellent medium-term project would be to go through the diffs between tl and current tex4ht and ensure it is ok (or make it ok) to update. i think most are due to generic changes long ago (perhaps made by eitan).

Karl Berry <karl>
Sat 10 Dec 2016 01:39:34 AM EET, comment #14:

Karl, I just updated TL and figured out that I didn't mention usepackage.4ht as a modified file in the changelog, so it wasn't updated - it patches Fontspec upon loading, it doesn't work without it. That was my mistake, sorry.

Michal Hoftich <michal_h21>
Sat 10 Dec 2016 01:17:14 AM EET, comment #13:

that's what i thought too, but doing a grep, i see that info4ht.4ht (tex4ht-info.tex) shows \input mktex4ht.4ht being used in an example template (nowhere else). should actually read that file sometime :).

Karl Berry <karl>
Fri 09 Dec 2016 10:22:24 AM EET, comment #12:

Thanks Karl. mktex4ht.4ht is used for generating seeding .4ht files from the literate sources, so it probably doesn't need to be in TL. On the other hand, it already is in TL, some prehistoric version obviously, so it is probably good to make an update.

Michal Hoftich <michal_h21>
Fri 09 Dec 2016 03:01:36 AM EET, comment #11:

make clean got me going again. whew.

committed fontspec files
fontspec-4ht.lua fontspec-luatex.4ht fontspec-xetex.4ht fontspec.4ht
to tl, r42654. also committed mktex4ht.4ht, which i never had before. maybe that was a mistake? or maybe it doesn't matter?

Karl Berry <karl>
Thu 08 Dec 2016 01:02:08 PM EET, comment #10:

No problems on my computer in work

Michal Hoftich <michal_h21>
Thu 08 Dec 2016 02:11:22 AM EET, comment #9:

It compiles without problems on my machine, maybe a issue with some temp files? I will try it tomorrow on a different computer.

Michal Hoftich <michal_h21>
Thu 08 Dec 2016 01:59:08 AM EET, comment #8:

sorry about the double inclusion. i didn't think i had changed anything but the word transposition in the filename. oh well.

anyway, with current repo (rev 210), i get:

! Undefined control sequence.
\at:startdoc ...f }\HtmlEnv \a:Preamble \a:PROLOG
(followed by many more errors)

when processing tex4ht-4ht.tex. help?

Karl Berry <karl>
Sun 04 Dec 2016 01:30:37 PM EET, comment #7:

It was included twice after the change. I fixed that, also I've found that configuration hooks were included only for xetex. it should be fixed as well now. Finally, I moved luatex definitions to fontspec-luatex.4ht.

Michal Hoftich <michal_h21>
Sun 04 Dec 2016 01:53:05 AM EET, comment #6:

i felt the need to rename xetex-fontspec.4ht to fontspec-xetex.4ht (committed in r209 along with administrivia). michal, can you check that all is still working as intended before i commit to tl, please?

Karl Berry <karl>
Sun 27 Nov 2016 01:56:38 AM EET, comment #5:

I've just pushed code to the repo. It works for both LuaTeX and XeTeX now. I've tried it with Latin, Greek, Cyrilics and Devanagari scripts, sample file is attached.

I have an issue with the change to tex4ht-html4.tex, the configurations aren't saved to html4.4ht. I guess that it is related to removal of mktex4ht.4ht generation from tex4ht-4ht.tex. When I add command \lit{fontspec} to mktex4ht.4ht manually, then the configurations are saved. But they aren't executed anyway.

Michal Hoftich <michal_h21>
Sun 30 Oct 2016 07:34:49 PM EET, comment #4:

michal -- just thought i'd check in about updating ... ? tx.

Karl Berry <karl>
Sun 16 Oct 2016 04:34:54 PM EEST, comment #3:

No, this is just a proof of concept at the moment. I was busy last week, I will try to make some more testing in the near future and then update the sources if everything works nicely.

Thanks to Deimi I was able to pass "new-accents" option directly from Fontspec configuration, modified usepackage.4ht is attached.

Michal Hoftich <michal_h21>
Sat 08 Oct 2016 12:52:40 AM EEST, comment #2:

michal, do you want me to install anything in tl at this point?

Karl Berry <karl>
Fri 07 Oct 2016 04:43:53 PM EEST, comment #1:

As we recently found the way how to alter the package loading (using usepackage.4ht), I've created small configuration for the Fontspec package. Basically, what is needed is to prevent Fontspec from loading the EU1 or EU2 font encodings and to prevent loading of OpenType fonts. It works only with LuaLaTeX at the moment, XeLaTeX still tries to load the fonts.

The example file can be called using

The new-accents option is important, you would get bunch of errors otherwise. It should be possible to put

\edef\Preamble{\Preamble,new-accents}

somewhere, but when I do that in usepackage.4ht, then compilation fails with stack overflow, and in fontspec.4ht it doesn't have any effect.

One thing that doesn't work are font styles from the .htf files, resp. it doesn't work when you load a font with \setmainfont. So I put basic configuration for \textit and similar commands to fontspec.4ht, which isn't really clean, but this is just sample, so I hope it is OK.

Michal Hoftich <michal_h21>
Wed 13 Jan 2010 01:29:20 AM EET, original submission:

We need to write fontspec.4ht for use with xelatex. This is a big job!

Karl Berry <karl>

Attached Files
file #266:  usepackage.4ht added by michal_h21 (3kB - application/octet-stream)
file #263:  usepackage.4ht added by michal_h21 (3kB - application/octet-stream)
file #264:  fontspec.4ht added by michal_h21 (549B - application/octet-stream)
file #265:  fontspec-4ht.lua added by michal_h21 (2kB - text/x-lua)

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -unavailable- added by michal_h21 (Updated the item)
• -unavailable- added by cvr (Updated the item)
• -unavailable- added by karl (Submitted the item)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only logged-in users can vote.

Please enter the title of George Orwell's famous dystopian book (it's a date):

11 latest changes follow.

Date Changed By Updated Field Previous Value => Replaced By
Fri 09 Dec 2016 03:01:36 AM EETkarlStatusIn ProgressFixed
Assigned tocvrmichal_h21
Open/ClosedOpenClosed