# How to install HarfTeX on TeXLive?

I've Installed TeX Live 2019 and downloaded HarfTeX. I'm using Visual Studio Code along with LatexWorkshop on Windows 10 and without any problem tex files compile with xelatex and lualatex. What to do now to make HarfTex work with it or with TexStudio?

Here's my problem with lualatex without HarfTeX.

Hm. Looks like I lured you into an adventure.

## Update

There exist now an experimental luatex (version 1.11) which contains harfbuzz too. It is alreay in w32tex.org (pay attention on the date: it should be after 18.06.2019), and can be installed and used in a similar way.

## First step

As you are on windows, get binaries from http://w32tex.org/. If you follow the link ctan you will find a link to harftex-w32.tar.xz.

Unpack it and copy harftex.dll, perhaps icudt64.dll, harflatex.exe and harftex.exe to your texlive/<year>/bin/win32 folder.

Create in texmf-local/web2c a fmtutil.cnf with this content

harflatex harftex language.dat,language.dat.lua lualatex.ini
harftex harftex language.def,language.dat.lua luatex.ini


Then create a texmf.cnf in the same directory with this content

TEXINPUTS.harftex   = $TEXMFDOTDIR;$TEXMF/tex/{harftex,luatex,plain,generic,}//
TEXINPUTS.harflatex = $TEXMFDOTDIR;$TEXMF/tex/{harflatex,lualatex,latex,luatex,generic,}//

LUAINPUTS.harflatex = $TEXMFDOTDIR;$TEXMF/scripts/{$progname,$engine,}/{lua,}//;\$TEXMF/tex/{harflatex,lualatex,latex,luatex,generic,}//


Then run in command line

mktexlsr
fmtutil-sys --byengine=harftex


You can then try if harflatex works by running a small document with

harflatex test-document


You will see no real difference to using lualatex here. To make use of the additional feature of harflatex more files are needed, but this is then the second step.

## Second step

get from https://github.com/khaledhosny/harf/tree/master/src all luafiles and the harfload.sty file. Put them e.g. in texmf-local/tex/latex/harf. Run mktexlsr.

Then test e.g. with this document (I used the noto-font as I don't have yours). The important part is (beside loading the harfload-package) the mode=harf in the font definitions. Fonts with this settings will use harfbuzz in the background. Don't use it for fonts that should use the "normal" lualatex fontloader.

\documentclass{article}
\usepackage{fontspec}

\setmainfont{notosansbengali-regular.ttf}[RawFeature={mode=harf}]
\begin{document}
কণ্যা এখন কি করিবে? \

\end{document}


### output with lualatex for comparision:

harftex for (currently) x86_64-linux, i386-linux, and win32 is now in contrib.texlive.info. One can install it with

  tlmgr --repository https://contrib.texlive.info/current install harftex