From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/96359 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:19:06 -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="===============8151966451174760121==" X-Trace: blaine.gmane.org 1475839193 438 195.159.176.226 (7 Oct 2016 11:19:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2016 11:19:53 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Oct 07 13:19:44 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 1bsTBi-0006pV-Gq for gctc-ntg-context-518@m.gmane.org; Fri, 07 Oct 2016 13:19:38 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 5D81D1A86B; Fri, 7 Oct 2016 13:19:22 +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 iDZsTsWk0p0A; Fri, 7 Oct 2016 13:19:21 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 968281A86D; Fri, 7 Oct 2016 13:19:21 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4F99D1A867 for ; Fri, 7 Oct 2016 13:19:20 +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 GYn1TWnQhNPN for ; Fri, 7 Oct 2016 13:19:19 +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 CDD821A863 for ; Fri, 7 Oct 2016 13:19:08 +0200 (CEST) Original-Received: by mail-oi0-f45.google.com with SMTP id n132so53471953oih.1 for ; Fri, 07 Oct 2016 04:19:08 -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=7J5ecezA1FuG27a7skrlUuzyplv+4X72EXP7hKcChns=; b=GdMDOPjmMV/AVUtWIc65CDW8HoHban8nOthtcMe8Cz5T80ZaUmqfFxaFThqbTwZPZ3 iB9SRn1c44igTUFJPfo3dHNXd+wTwoP7YgaU+nxu6Zz1W2qzRA4LzjrD8IFp3l26nDhv 01oDlrGsLvgAaHghJRbKq9sUId/fIvt2qsZD7ogJwhLHA10Lk3QQf67eLapdhURBhhyw YOIP/PpDOqa7CxKXI7LWZaqf8B8bzMUAFjyAf3ki66/eP6DEu/v/nSbcMkPnTSP7UwZi MVSLvMARWk+HNj55NV/+ZeOgtPXIqTD3RV4dyqdZzPMcxSU3sz6alO50MltcMnhVbF4L Hntg== 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=7J5ecezA1FuG27a7skrlUuzyplv+4X72EXP7hKcChns=; b=FNDXIshUKLRDjfsn4kov8k2Mv7Mw84sK0YP17kmkmIlBHPq+wsuS3Zwp/AW3QypYB7 54eP/9rnU20k/NT8uh5lZGZk3Bqf1kIPF23myavC8VwIB/HBxK4npIalNFx6pLF51QHD lEECZAZEgfUMlg9oh0VLMEF/fNga9Fnofr++gWROB7z1NHNDVH+2iLYVpa2As+urbwDU Sm71HEq58luWcxEuP5uRaKie4VrdOqPUR1Po6TfDoYPnLR3KCcISoENHEQM59uJu7lhS QFKRD0mWkF3+1UpngqFPE375ZsGHHTargCXLvtiZzKpVTEAMCkDF748zeB+iYhT1Yt+3 Ghww== X-Gm-Message-State: AA6/9RljroBUglDEOoOihKfEI0IR2B+GYB7s9Qjvp4y0j0pHzOc7rIJ+CiuhMZsqN5uJkOnkrLZ6ybzB0zPb3g== X-Received: by 10.157.51.43 with SMTP id f40mr11566025otc.13.1475839146895; Fri, 07 Oct 2016 04:19:06 -0700 (PDT) Original-Received: by 10.157.34.9 with HTTP; Fri, 7 Oct 2016 04:19:06 -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:96359 Archived-At: --===============8151966451174760121== Content-Type: multipart/alternative; boundary=001a113ce9da18b2f4053e44940a --001a113ce9da18b2f4053e44940a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 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 to > the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/ > listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ____________________________________________________________ > _______________________ --001a113ce9da18b2f4053e44940a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I don't know much about fontsampler but the commands y= ou 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 feature= s that should do the trick is called "arabic".

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

\font\myfont=3Dfile:font.= otf:language=3Ddflt;script=3Darab;ccmp=3Dyes;init=3Dyes;medi=3Dyes;fina=3Dy= es;rlig=3Dyes

=E2=80=94MHB

On Fri, Oct 7, 2016 at 7:01 AM, Mingr= anina 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.at= tributes(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-context@ntg.nl / <= a href=3D"http://www.ntg.nl/mailman/listinfo/ntg-context" rel=3D"noreferrer= " target=3D"_blank">http://www.ntg.nl/mailman/listinfo/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
_________________________________________________________________= __________________

--001a113ce9da18b2f4053e44940a-- --===============8151966451174760121== 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= --===============8151966451174760121==--