From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/105569 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?S3JlxaFpbWlyIENpbmRyacSH?= Newsgroups: gmane.comp.tex.context Subject: Re: ConTeXt: specify a path to font in \definefontfamily Date: Wed, 20 Nov 2019 10:08:19 +0100 Message-ID: References: Reply-To: kresimircindric@gmail.com, mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1924456449850099438==" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="47016"; mail-complaints-to="usenet@blaine.gmane.org" Cc: mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Wed Nov 20 10:08:25 2019 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iXLyL-000C68-Ky for gctc-ntg-context-518@m.gmane.org; Wed, 20 Nov 2019 10:08:25 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 17E3016330C; Wed, 20 Nov 2019 10:07:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I-bzsCROMjEL; Wed, 20 Nov 2019 10:07:56 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 77F45163312; Wed, 20 Nov 2019 10:07:56 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id B832616330B for ; Wed, 20 Nov 2019 10:07:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oX-xssgaGde0 for ; Wed, 20 Nov 2019 10:07:54 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.222.45; helo=mail-ua1-f45.google.com; envelope-from=kresimircindric@gmail.com; receiver= Original-Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 974801632F0 for ; Wed, 20 Nov 2019 10:07:54 +0100 (CET) Original-Received: by mail-ua1-f45.google.com with SMTP id w10so5064713uar.12 for ; Wed, 20 Nov 2019 01:07:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=MGjJY3FiDyhVfDencU06VtYsUvRDAqAv3VXC6rH+ZbQ=; b=MUFo7RXrWdBPwg877lxmGny9MMSTgvFti3nVEcjDWrWX14RibfQjku8yiAkN8vqgv3 0ju2cdoW3RQQagcqCCvQ7IazZA+36rJiPVm4bSVr7JzghNi/h7x3O12mqI1T6KP5RG42 mPo4GmhAzrlUl7r+5ZqIsEakTwJjRVjQrxVXft9OZtNDT4eRBi0p/DPnx2u8ODj7wK85 3BK8S9KbLOQh1Ka4qCyAHUBSCHi4E31B9/hBTkgABlo+cYtD1FRuFLf8Ts9EVDT8Rf8F Ozi/WaUITVZIYfhVtudvADFFZTUehn5Zymco0M1trqUtUdZVmOOGJaV+tYPOwRGZFVu5 f6xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=MGjJY3FiDyhVfDencU06VtYsUvRDAqAv3VXC6rH+ZbQ=; b=gPnvpve0k+6mXAQKFWNC+L0+hzM0QGvZc9GPhpXvVblOuazUMgXuvHziYsObf0rgCV i7kj3vjWmeoZOKOcwgUVRq2Xqv+SslRDrCq5+/qhkjgon5Tcl3vKD3htrulLNTUnlNVd vZQWMEUSwTZsI28P3x+ZZRKYhRfI0fN2LqXHFqRh4KfF48Ih0HC0gu2sQHtQGyhnFonP orXlPIjx6wYLWK2Xh31lsTlM+uhfJSkNKIcNEJXUTkvtUSVa0rQ/2Z9s8YIrLm7PpHoK CRqmQ5OQ8MvA9MP05TlzuoGV/nb7r2lzDEIaJUb8X+QD/sVwUwGASIm17YLXxPvtaAmR cuAg== X-Gm-Message-State: APjAAAV/naP6yRecpn2FERgjkLuXBZmjTVDUEIntEesMkDbxM93VN+Za /SPoqQP7jxDCQZ8zb91NCxwzy3ymeG1UbTTJDLM= X-Google-Smtp-Source: APXvYqzknZq5oq37+kLdyMkOYFvb9Dz6T/Y9jletSilsCT4jhX5DjMv8dm5zcHF0eJxft4z8AWGcc6TPTe9oxmgSfIM= X-Received: by 2002:ab0:2042:: with SMTP id g2mr957155ual.19.1574240872736; Wed, 20 Nov 2019 01:07:52 -0800 (PST) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:105569 Archived-At: --===============1924456449850099438== Content-Type: multipart/alternative; boundary="00000000000002ae090597c384d2" --00000000000002ae090597c384d2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you for the reply. I was aware that I can install fonts in ` tex/texmf-fonts `. However, the idea behind my odd request was the need to have the entire project contained in a single directory. which I can share with people and compile on any computer with a working TeX Live, without them having to install any fonts or dependencies. I tried setting the RUNTIMEFONTS env variable, and it does exactly what I want. The fact that it leaves garbage in the cache that can influence other, unrelated projects, is a bit unsettling, I guess I'll just have to remember to tell people to clean the cache. Thanks again, Kre=C5=A1imir On Wed, 20 Nov 2019 at 09:49, Hans Hagen wrote: > On 11/19/2019 10:50 AM, Kre=C5=A1imir Cindri=C4=87 wrote: > > I'm /very/ new to ConTeXt, so please excuse the newbie question. I'm > > trying to load a font from a file. The |.otf| files are stored in a > > directory named |fonts/| which is in the directory of the |.tex| file > > I'm trying to compile. > > > > This code does not work, and reverts to the default font: > > > > |\definefontfamily[mainface][serif][My Font][tf=3Dfile:./fonts/MyFont.o= tf, > > it=3Dfile:./fonts/MyFont-It.otf, bf=3Dfile:./fonts/MyFont-Bd.otf, > > > bi=3Dfile:./fonts/MyFont-BdIt.otf]\setupbodyfont[mainface]\starttext\titl= e{Hello, > > > world!}Hello World! \emph{Hi!}\stoptext| > > > > However, if I copy the |.otf| files into the same directory as the > > |.tex| file, and write |tf=3Dfile:MyFont.otf| etc, then everything work= s > > fine. > > > > How do I specify a relative path to the font, inside the |.tex| file? > > > > In LaTeX, I would use |fontspec| package and do the following: > > > > |\setmainfont{MyFont.otf}[Path =3D./fonts/, ItalicFont =3DMyFont-It.otf= ]| > > > > However, I couldn't find the equivalent syntax for |\definefontfamily| > > in ConTeXt. > > > > Just to mention, I am using ConTeXt version: 2019.03.21 21:39 as part o= f > > TeX Live, on Manjaro Linux. > It is normally a bad idea to have fonts in such a place. You never know > how it will clash with other fonts (versions, similar names, etc). > > In context, we have > > tex/texmf-fonts > > so best is to use: > > tex/texmf-fonts/data/MyFont-It.otf > > etc, them run mtxrun --generate and let the system sort it out. > > Another option is to set the RUNTIMEFONTS environment variable. > > Like: > > \starttext > > % \ctxlua{fonts.names.addruntimepath("./myfonts")} > \ctxlua{os.setenv("RUNTIMEFONTS","./myfonts")} > > Hello World! > > \definefont[myfont][file:myfont.otf] > > {\myfont Hello World!} > > \stoptext > > But .. you need tio wipe such a font from the cache when you move it and > other projects using a different font with the same name can be in > trobles. Fonts are best managed very careful as they are responsible for > long term inconsistencies. > > There is no official interface from tex this (maybe WS has a suggestion > that fits into the definefontfamily subsystem) > > Hans > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > --00000000000002ae090597c384d2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you for the reply.

I was awa= re that I can install fonts in ` tex/texmf-fonts `. However, the idea behind my odd request was the need to have the entire = project contained in a single directory. which I can share with people and = compile on any computer with a working TeX Live, without them having to ins= tall any fonts or dependencies.

I tried setting the=20 RUNTIMEFONTS env variable, and it does exactly what I want. The fact that i= t leaves garbage in the cache that can influence other, unrelated projects,= is a bit unsettling, I guess I'll just have to remember to tell people= to clean the cache.

Thanks again,

Kre=C5=A1imir

On Wed, 20 Nov 2019 at 09:49, Hans Hagen <= ;j.hagen@xs4all.nl> wrote:
<= /div>
On 11/19/2019 10:50 = AM, Kre=C5=A1imir Cindri=C4=87 wrote:
> I'm /very/ new to ConTeXt, so please excuse the newbie question. I= 'm
> trying to load a font from a file. The |.otf| files are stored in a > directory named |fonts/| which is in the directory of the |.tex| file =
> I'm trying to compile.
>
> This code does not work, and reverts to the default font:
>
> |\definefontfamily[mainface][serif][My Font][tf=3Dfile:./fonts/MyFont.= otf,
> it=3Dfile:./fonts/MyFont-It.otf, bf=3Dfile:./fonts/MyFont-Bd.otf,
> bi=3Dfile:./fonts/MyFont-BdIt.otf]\setupbodyfont[mainface]\starttext\t= itle{Hello,
> world!}Hello World! \emph{Hi!}\stoptext|
>
> However, if I copy the |.otf| files into the same directory as the > |.tex| file, and write |tf=3Dfile:MyFont.otf| etc, then everything wor= ks
> fine.
>
> How do I specify a relative path to the font, inside the |.tex| file?<= br> >
> In LaTeX, I would use |fontspec| package and do the following:
>
> |\setmainfont{MyFont.otf}[Path =3D./fonts/, ItalicFont =3DMyFont-It.ot= f]|
>
> However, I couldn't find the equivalent syntax for |\definefontfam= ily|
> in ConTeXt.
>
> Just to mention, I am using ConTeXt version: 2019.03.21 21:39 as part = of
> TeX Live, on Manjaro Linux.
It is normally a bad idea to have fonts in such a place. You never know how it will clash with other fonts (versions, similar names, etc).

In context, we have

tex/texmf-fonts

so best is to use:

tex/texmf-fonts/data/MyFont-It.otf

etc, them run mtxrun --generate and let the system sort it out.

Another option is to set the RUNTIMEFONTS environment variable.

Like:

\starttext

=C2=A0 =C2=A0% \ctxlua{fonts.names.addruntimepath("./myfonts")} =C2=A0 =C2=A0 =C2=A0\ctxlua{os.setenv("RUNTIMEFONTS","./myfo= nts")}

=C2=A0 =C2=A0 =C2=A0Hello World!

=C2=A0 =C2=A0 =C2=A0\definefont[myfont][file:myfont.otf]

=C2=A0 =C2=A0 =C2=A0{\myfont Hello World!}

\stoptext

But .. you need tio wipe such a font from the cache when you move it and other projects using a different font with the same name can be in
trobles. Fonts are best managed very careful as they are responsible for long term inconsistencies.

There is no official interface from tex this (maybe WS has a suggestion that fits into the definefontfamily subsystem)

Hans

-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.pragma-ade.nl | www.= pragma-pod.nl
-----------------------------------------------------------------
--00000000000002ae090597c384d2-- --===============1924456449850099438== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============1924456449850099438==--