From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/96360 Path: news.gmane.org!.POSTED!not-for-mail From: Mohammad Hossein Bateni Newsgroups: gmane.comp.tex.context Subject: Re: How to use "fontsampler example" with Persian font Date: Fri, 7 Oct 2016 07:24:32 -0400 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4254840488435508622==" X-Trace: blaine.gmane.org 1475839510 19932 195.159.176.226 (7 Oct 2016 11:25:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2016 11:25:10 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Oct 07 13:25:05 2016 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 esmtp (Exim 4.84_2) (envelope-from ) id 1bsTGw-0004CO-KB for gctc-ntg-context-518@m.gmane.org; Fri, 07 Oct 2016 13:25:02 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id DB4681A8AE; Fri, 7 Oct 2016 13:24:47 +0200 (CEST) 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 Lc8OXCAbwtyJ; Fri, 7 Oct 2016 13:24:47 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 266A31A8B3; Fri, 7 Oct 2016 13:24:47 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 19CA31A8AD for ; Fri, 7 Oct 2016 13:24:46 +0200 (CEST) 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 BMtrpZXGBa3v for ; Fri, 7 Oct 2016 13:24:45 +0200 (CEST) Original-Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id D56631A8AC for ; Fri, 7 Oct 2016 13:24:34 +0200 (CEST) Original-Received: by mail-oi0-f45.google.com with SMTP id d132so53433338oib.2 for ; Fri, 07 Oct 2016 04:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=M4gxgDrAM65DD46rXGGbcjyI/f1poGL2jfH2RJSx/1E=; b=ECu7wpw74pkyLKBk+lJEXjU9/slN2BUEGDyLE7ceqzOSZ8hvocIVJunggbJuuk5uVQ 6QZeRjjr1NP098ZGeSTB6EY+SpEJIj9kr227h6oDxPgVfz7WTDij2rdAv83g7gVY/74g F2XQFwr4+kvLMuM1VxK71eDh+FSdXF1jFuq7GkR4p5KNJX+Nz/dPotlHwoMYvft0ADh1 ccT8Pq7yw+GjInbY7tAgMiw6Vk/vZi/wzExoRpFaUGS1in6IbM7yoCV+q9ungfcgyZQf wq4nw1Wt5HAEAo2xkY18e5KNxwCBvVCQRB/yKLzkrJm0KLoeu9kNHpoh3sdGnaaWYI0y 8qpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=M4gxgDrAM65DD46rXGGbcjyI/f1poGL2jfH2RJSx/1E=; b=A3fQwWtGqqEASUawdAJDOvHUUf0c4VkUZ2VtflGEMheawbXYD+/cUUiio0Hm7ikznB 0fXUa05IynKCaC6zH3sjAQsVY2cSGuY/40IJyyZMfV8eaixLBmXCLSsHd3EBoMlP9T89 beqFffDOkHsDVquIzEHmv52fhZTtwH7he4ejubltuGArK3xmsQhe+JCK+f2TVHWd9yOE tHKz1cqTM9Ec3GUaLj6Jq+LYTtIWdE1VEwTERYXKAGtqZYkrtEzRa1+hnjCgw7yevzCR gX1d5ymVWzHBV/hJNpvMdeWEGdoXBiuegEMOvzJnyO9THOFW0sYZtNNPOWCFD7m8tPrQ yb6g== X-Gm-Message-State: AA6/9RldVyIidzzWA2eOaVEL4Q7lzf1YAPJ5P1sdgC7846PSUd6AfN8CL6t1HH0//mjNjAEUg0iJxWrMdGNUSw== X-Received: by 10.202.91.133 with SMTP id p127mr15695646oib.115.1475839473147; Fri, 07 Oct 2016 04:24:33 -0700 (PDT) Original-Received: by 10.157.34.9 with HTTP; Fri, 7 Oct 2016 04:24:32 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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:96360 Archived-At: --===============4254840488435508622== Content-Type: multipart/alternative; boundary=001a113d08008ae671053e44a7f6 --001a113d08008ae671053e44a7f6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The following works for me: \input luaotfload.sty \font \myfont =3D file:HM_XNiloofar.ttf:language=3Ddflt;script=3Darab;ccmp=3Dyes;init=3Dyes;m= edi=3Dyes;fina=3Dyes;rlig=3Dyes \myfont Salam \pardir TRT \textdir TRT =D8=B3=D9=84=D8=A7=D9=85 =D8=AD=D8=B3=D9=86 \bye On Fri, Oct 7, 2016 at 7:19 AM, Mohammad Hossein Bateni wrote: > I don't know much about fontsampler but the commands you list here are > mostly irrelevant. My guess is you will need to set the features in the > font to get proper shaping. A good set of features that should do the > trick is called "arabic". > > When loading the font, you should do something like the following, but I > have not tried it myself. > > \font\myfont=3Dfile:font.otf:language=3Ddflt;script=3Darab; > ccmp=3Dyes;init=3Dyes;medi=3Dyes;fina=3Dyes;rlig=3Dyes > > =E2=80=94MHB > > > On Fri, Oct 7, 2016 at 7:01 AM, Mingranina Gingranina < > mingranina@gmail.com> wrote: > >> Dear All, >> Hello, >> >> I am trying to use "fontsampler example" with Persian fonts (please >> see below or "http://wiki.luatex.org/index.php/Fontsampler" >> for fontsampler codes). >> The problem is that Persian words apears as a string of separate >> glyphs, for example I get "=D8=AD=E2=80=8C=D8=B3=E2=80=8C=D9=86" instead= of "=D8=AD=D8=B3=D9=86". >> Do I have to use commands like the followings inside \directlua or >> tex.tprint to fix the problem? If yes, how can I do that? >> >> \installlanguage [fa][default=3Dpe,date=3D\longjalalidatefmt] >> \mainlanguage[fa] >> >> \definefontfeature[tlig][tlig=3Dyes] >> \definefontfeature[slanted][slant=3D.2] >> \definefontfeature[dlang][language=3Ddflt] >> \definefontfeature[flang][language=3Dfar] >> >> Thanks >> Mingranina >> >> >> fontsampler.tex >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> \input luaotfload.sty >> \overfullrule 0pt >> \font\mono =3D {file:lmmono8-regular.otf} at 6pt >> \parindent 0pt >> >> \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890 >> =C3=A4=C3=84=C3=B6=C3=96=C3=BC=C3=9C =C3=9F !"=C2=A7\$\%\&()=3D?} >> >> \directlua{ >> dofile("fontsampler.lua") >> fontsampler(arg[2]) >> } >> >> \bye >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> End Of fontsampler.tex >> >> >> fontsampler.lua >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> function dirtree(dir) >> assert(dir and dir ~=3D "", "directory parameter is missing or empty") >> if string.sub(dir, -1) =3D=3D "/" then >> dir=3Dstring.sub(dir, 1, -2) >> end >> >> local function yieldtree(dir) >> for entry in lfs.dir(dir) do >> if not entry:match("^%.") then >> entry=3Ddir.."/"..entry >> if not lfs.isdir(entry) then >> coroutine.yield(entry,lfs.attributes(entry)) >> end >> if lfs.isdir(entry) then >> yieldtree(entry) >> end >> end >> end >> end >> >> return coroutine.wrap(function() yieldtree(dir) end) >> end >> >> >> function fontsampler( dir ) >> for entry in dirtree(dir) do >> if entry:match(".otf","-4") then >> tex.tprint({[[\mono ]]},{-2,entry},{[[ >> (]]},{-2,fontloader.info(entry).fontname},{[[)\par\penalty >> 10000\font\sample=3D{file:]]},{-2,entry},{[[} at >> 12pt\sample\samplestring\par\penalty 10000\vrule width \hsize height >> 0.25pt depth 0pt\par]]}) >> end >> end >> end >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> End Of fontsampler.lua >> ____________________________________________________________ >> _______________________ >> If your question is of interest to others as well, please add an entry t= o >> the Wiki! >> >> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/list >> info/ntg-context >> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net >> archive : http://foundry.supelec.fr/projects/contextrev/ >> wiki : http://contextgarden.net >> ____________________________________________________________ >> _______________________ > > > --001a113d08008ae671053e44a7f6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The following works for me:

\input luaotfload.= sty
\font \myfont =3D file:HM_XNiloofar.ttf:language=3Ddflt;script=3Dara= b;ccmp=3Dyes;init=3Dyes;medi=3Dyes;fina=3Dyes;rlig=3Dyes
\myfont Salam
\pardir TRT
\textdir TRT
=D8=B3=D9=84=D8=A7=D9=85
=D8=AD=D8= =B3=D9=86
\bye


=
On Fri, Oct 7, 2016 at 7:19 AM, Mohammad Hossein= Bateni <bateni@gmail.com> wrote:
I don't know much about fontsampler but the com= mands you list here are mostly irrelevant.=C2=A0 My guess is you will need = to set the features in the font to get proper shaping.=C2=A0 A good set of = features that should do the trick is called "arabic".

When loading the font, you should do something like the following, = but I have not tried it myself.

\font\myfont=3Dfil= e:font.otf:language=3Ddflt;script=3Darab;ccmp=3Dyes;init=3Dyes;me= di=3Dyes;fina=3Dyes;rlig=3Dyes

=E2=80=94MHB


On Fri, Oct 7, 2016 = at 7:01 AM, Mingranina Gingranina <mingranina@gmail.com> = wrote:
Dear All,
=C2=A0Hello,

=C2=A0I am trying to use "fontsampler example" with Persian fonts= (please
see below or "http://wiki.luatex.org/index.php= /Fontsampler"
=C2=A0for fontsampler codes).
=C2=A0The problem is that Persian words apears as a string of separate
glyphs, for example I get "=D8=AD=E2=80=8C=D8=B3=E2=80=8C=D9=86" = instead of "=D8=AD=D8=B3=D9=86".
=C2=A0Do I have to use commands like the followings inside \directlua or tex.tprint to fix the problem? If yes, how can I do that?

\installlanguage [fa][default=3Dpe,date=3D\longjalalidatefmt]
\mainlanguage[fa]

\definefontfeature[tlig][tlig=3Dyes]
\definefontfeature[slanted][slant=3D.2]
\definefontfeature[dlang][language=3Ddflt]
\definefontfeature[flang][language=3Dfar]

Thanks
Mingranina


fontsampler.tex
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
\input luaotfload.sty
\overfullrule 0pt
\font\mono =3D {file:lmmono8-regular.otf} at 6pt
\parindent 0pt

\def \samplestring {Sphinx of black quartz, judge my vow. 1234567890
=C3=A4=C3=84=C3=B6=C3=96=C3=BC=C3=9C =C3=9F !"=C2=A7\$\%\&()=3D?}<= br>
\directlua{
=C2=A0 dofile("fontsampler.lua")
=C2=A0 fontsampler(arg[2])
}

\bye
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
End Of fontsampler.tex


fontsampler.lua
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
function dirtree(dir)
=C2=A0 assert(dir and dir ~=3D "", "directory parameter is m= issing or empty")
=C2=A0 if string.sub(dir, -1) =3D=3D "/" then
=C2=A0 =C2=A0 dir=3Dstring.sub(dir, 1, -2)
=C2=A0 end

=C2=A0 local function yieldtree(dir)
=C2=A0 =C2=A0 for entry in lfs.dir(dir) do
=C2=A0 =C2=A0 =C2=A0 if not entry:match("^%.") then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 entry=3Ddir.."/"..entry
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if not lfs.isdir(entry) then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 coroutine.yield(entry,lfs.attributes(entry))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if lfs.isdir(entry) then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 yieldtree(entry)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 end
=C2=A0 =C2=A0 =C2=A0 end
=C2=A0 =C2=A0 end
=C2=A0 end

=C2=A0 return coroutine.wrap(function() yieldtree(dir) end)
end


function fontsampler( dir )
=C2=A0 for entry in dirtree(dir) do
=C2=A0 =C2=A0 if entry:match(".otf","-4") then
=C2=A0 =C2=A0 =C2=A0 tex.tprint({[[\mono ]]},{-2,entry},{[[
(]]},{-2,fontloader.info(entry).fontname},{[[)\par\penalty
10000\font\sample=3D{file:]]},{-2,entry},{[[} at
12pt\sample\samplestring\par\penalty 10000\vrule width \hsize height 0.25pt depth 0pt\par]]})
=C2=A0 =C2=A0 end
=C2=A0 end
end
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
End Of fontsampler.lua
_________________________________________________________________= __________________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listin= fo/ntg-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://tex.aanhet.net
archive=C2=A0 : http://foundry.supelec.fr/project= s/contextrev/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
_________________________________________________________________= __________________


--001a113d08008ae671053e44a7f6-- --===============4254840488435508622== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============4254840488435508622==--