Re: [NTG-context] How to use "fontsampler example" with Persian font

2016-10-12 Thread Mingranina Gingranina
Dear Mohammad,
Hello,

\pagenumbering is not defined or redined in XePersian. In fact, in
TeXLive 2016, it is only defined in the following files:

texmf-dist/tex/latex/base/latex.ltx
texmf-dist/tex/latex/feupphdteses/feupphdteses.sty
texmf-dist/tex/latex/kluwer/kluedit.sty
texmf-dist/tex/latex/kluwer/kluwer.cls
texmf-dist/tex/latex/pdfwin/pdfwin.sty
texmf-dist/tex/latex/romanneg/romanneg.sty
texmf-dist/tex/plain/gustlib/plmac218/plidxmac.tex
texmf-dist/tex/plain/makeindex/idxmac.tex

I think it would be better to look at arabluatex's code for solving the problem.

Regards,
Mingranina

On 10/11/16, Mohammad Hossein Bateni  wrote:
> This seems to not belong in the ConTeXt mailing list.  You'd be better off
> asking it on Stack Exchange or on luatex mailing list.  The short answer is
> it depends on the "format file" (and perhaps the LaTeX packages) you're
> using.  Most probably, you either use "plain" or "latex", and then you
> should see how they generate the page numbers and define a macro that
> provides the Persian numbers, etc.  See how XePersian package handles it.
>  (Search for \pagenumbering.)
>
> On Mon, Oct 10, 2016 at 11:44 PM, Mingranina Gingranina <
> mingran...@gmail.com> wrote:
>
>> Dear Wolfgang
>>  Hello,
>>
>> First of all, let me thank you very much for your informative answer.
>>
>> On 10/10/16, Wolfgang Schuster  wrote:
>> >> Mingranina Gingranina 
>> >> 7. Oktober 2016 um 17:41
>> >> Dear Mohammad,
>> >> Hi,
>> >>
>> >> Thank you very much for your reply. I forgot to mention that I had
>> >> modified the fontsampler codes so that I can use it in ConTeXt with
>> >> Dabeer module.
>> > 1. What is Dabeer?
>>
>> It is a module for Persian typesetting in ConTeXt. Please see:
>> https://github.com/bateni/dabeer
>>
>> >
>> > 2. You can access the list of known fonts with the "fonts.names.list"
>> > function:
>> >
>> > \setuppapersize[A4,landscape]
>> >
>> > \starttext
>> >
>> > \startluacode
>> >
>> > local fontlist = fonts.names.list("",true,true)
>> >
>> > context.starttabulate({"|l|l|"})
>> > for fontname, fontentry in next, fontlist do
>> >  context.NC()
>> >  context(fontentry["rawname"])
>> >  context.NC()
>> >  context(fontentry["filename"])
>> >  context.NC()
>> >  context.NR()
>> > end
>> > context.stoptabulate()
>> >
>> > \stopluacode
>> >
>> > \stoptext
>> >> However, inspired by your reply I could get it to work in LuaTeX but
>> >> not in ConTeXt with Dabeer module.
>> >>
>> >> Are there any other set of features that I can test?
>> > ConTeXt inludes a few modules which can be used to show font
>> > information
>> > (search for s-fonts-*.mkiv|mkvi and s-math-*.mkiv|mkvi), below is a
>> > example from s-fonts-tables.mkiv:
>> >
>> > \usemodule[fonts-tables]
>> >
>> > \setupbodyfont[pagella]
>> >
>> > \starttext
>> > \showfonttables[title={TeX Gyre Pagella}]
>> > \stoptext
>>
>> I am a novice in LuaTeX and ConTeXt and to learn these I tried to
>> modify FontSampler code (http://wiki.luatex.org/index.php/Fontsampler)
>> to get a sample of Persian fonts in a directory hierarchy too.
>>
>> BTW, at the moment my problem with LuaTeX is that the page numbering
>> is in english. Do you know how to change the page numbering to Persian
>> in LuaTeX?
>>
>>  Thanks,
>>  Mingranina
>> 
>> ___
>> 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://context.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> wiki : http://contextgarden.net
>> 
>> ___
>>
>
___
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://context.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use "fontsampler example" with Persian font

2016-10-11 Thread Mohammad Hossein Bateni
This seems to not belong in the ConTeXt mailing list.  You'd be better off
asking it on Stack Exchange or on luatex mailing list.  The short answer is
it depends on the "format file" (and perhaps the LaTeX packages) you're
using.  Most probably, you either use "plain" or "latex", and then you
should see how they generate the page numbers and define a macro that
provides the Persian numbers, etc.  See how XePersian package handles it.
 (Search for \pagenumbering.)

On Mon, Oct 10, 2016 at 11:44 PM, Mingranina Gingranina <
mingran...@gmail.com> wrote:

> Dear Wolfgang
>  Hello,
>
> First of all, let me thank you very much for your informative answer.
>
> On 10/10/16, Wolfgang Schuster  wrote:
> >> Mingranina Gingranina 
> >> 7. Oktober 2016 um 17:41
> >> Dear Mohammad,
> >> Hi,
> >>
> >> Thank you very much for your reply. I forgot to mention that I had
> >> modified the fontsampler codes so that I can use it in ConTeXt with
> >> Dabeer module.
> > 1. What is Dabeer?
>
> It is a module for Persian typesetting in ConTeXt. Please see:
> https://github.com/bateni/dabeer
>
> >
> > 2. You can access the list of known fonts with the "fonts.names.list"
> > function:
> >
> > \setuppapersize[A4,landscape]
> >
> > \starttext
> >
> > \startluacode
> >
> > local fontlist = fonts.names.list("",true,true)
> >
> > context.starttabulate({"|l|l|"})
> > for fontname, fontentry in next, fontlist do
> >  context.NC()
> >  context(fontentry["rawname"])
> >  context.NC()
> >  context(fontentry["filename"])
> >  context.NC()
> >  context.NR()
> > end
> > context.stoptabulate()
> >
> > \stopluacode
> >
> > \stoptext
> >> However, inspired by your reply I could get it to work in LuaTeX but
> >> not in ConTeXt with Dabeer module.
> >>
> >> Are there any other set of features that I can test?
> > ConTeXt inludes a few modules which can be used to show font information
> > (search for s-fonts-*.mkiv|mkvi and s-math-*.mkiv|mkvi), below is a
> > example from s-fonts-tables.mkiv:
> >
> > \usemodule[fonts-tables]
> >
> > \setupbodyfont[pagella]
> >
> > \starttext
> > \showfonttables[title={TeX Gyre Pagella}]
> > \stoptext
>
> I am a novice in LuaTeX and ConTeXt and to learn these I tried to
> modify FontSampler code (http://wiki.luatex.org/index.php/Fontsampler)
> to get a sample of Persian fonts in a directory hierarchy too.
>
> BTW, at the moment my problem with LuaTeX is that the page numbering
> is in english. Do you know how to change the page numbering to Persian
> in LuaTeX?
>
>  Thanks,
>  Mingranina
> 
> ___
> 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://context.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> 
> ___
>
___
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://context.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use "fontsampler example" with Persian font

2016-10-10 Thread Mingranina Gingranina
Dear Wolfgang
 Hello,

First of all, let me thank you very much for your informative answer.

On 10/10/16, Wolfgang Schuster  wrote:
>> Mingranina Gingranina 
>> 7. Oktober 2016 um 17:41
>> Dear Mohammad,
>> Hi,
>>
>> Thank you very much for your reply. I forgot to mention that I had
>> modified the fontsampler codes so that I can use it in ConTeXt with
>> Dabeer module.
> 1. What is Dabeer?

It is a module for Persian typesetting in ConTeXt. Please see:
https://github.com/bateni/dabeer

>
> 2. You can access the list of known fonts with the "fonts.names.list"
> function:
>
> \setuppapersize[A4,landscape]
>
> \starttext
>
> \startluacode
>
> local fontlist = fonts.names.list("",true,true)
>
> context.starttabulate({"|l|l|"})
> for fontname, fontentry in next, fontlist do
>  context.NC()
>  context(fontentry["rawname"])
>  context.NC()
>  context(fontentry["filename"])
>  context.NC()
>  context.NR()
> end
> context.stoptabulate()
>
> \stopluacode
>
> \stoptext
>> However, inspired by your reply I could get it to work in LuaTeX but
>> not in ConTeXt with Dabeer module.
>>
>> Are there any other set of features that I can test?
> ConTeXt inludes a few modules which can be used to show font information
> (search for s-fonts-*.mkiv|mkvi and s-math-*.mkiv|mkvi), below is a
> example from s-fonts-tables.mkiv:
>
> \usemodule[fonts-tables]
>
> \setupbodyfont[pagella]
>
> \starttext
> \showfonttables[title={TeX Gyre Pagella}]
> \stoptext

I am a novice in LuaTeX and ConTeXt and to learn these I tried to
modify FontSampler code (http://wiki.luatex.org/index.php/Fontsampler)
to get a sample of Persian fonts in a directory hierarchy too.

BTW, at the moment my problem with LuaTeX is that the page numbering
is in english. Do you know how to change the page numbering to Persian
in LuaTeX?

 Thanks,
 Mingranina
___
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://context.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use "fontsampler example" with Persian font

2016-10-10 Thread Wolfgang Schuster

Mingranina Gingranina 
7. Oktober 2016 um 17:41
Dear Mohammad,
Hi,

Thank you very much for your reply. I forgot to mention that I had
modified the fontsampler codes so that I can use it in ConTeXt with
Dabeer module.

1. What is Dabeer?

2. You can access the list of known fonts with the "fonts.names.list" 
function:


\setuppapersize[A4,landscape]

\starttext

\startluacode

local fontlist = fonts.names.list("",true,true)

context.starttabulate({"|l|l|"})
for fontname, fontentry in next, fontlist do
context.NC()
context(fontentry["rawname"])
context.NC()
context(fontentry["filename"])
context.NC()
context.NR()
end
context.stoptabulate()

\stopluacode

\stoptext

However, inspired by your reply I could get it to work in LuaTeX but
not in ConTeXt with Dabeer module.

Are there any other set of features that I can test?
ConTeXt inludes a few modules which can be used to show font information 
(search for s-fonts-*.mkiv|mkvi and s-math-*.mkiv|mkvi), below is a 
example from s-fonts-tables.mkiv:


\usemodule[fonts-tables]

\setupbodyfont[pagella]

\starttext
\showfonttables[title={TeX Gyre Pagella}]
\stoptext

Wolfgang
___
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
___

Re: [NTG-context] How to use "fontsampler example" with Persian font

2016-10-07 Thread Mohammad Hossein Bateni
In ConTeXt, use \definedfont[font-name*arabic] instead of the following two
commands:

\font\myfont=blah blah
\myfont

On Fri, Oct 7, 2016 at 11:41 AM, Mingranina Gingranina  wrote:

>  Dear Mohammad,
>  Hi,
>
>  Thank you very much for your reply. I forgot to mention that I had
> modified the fontsampler codes so that I can use it in ConTeXt with
> Dabeer module.
>
>  However, inspired by your reply I could get it to work in LuaTeX but
> not in ConTeXt with Dabeer module.
>
>  Are there any other set of features that I can test?
>
>  Thanks,
>  Mingranina
>
> On 10/7/16, Mohammad Hossein Bateni  wrote:
> > The following works for me:
> >
> > \input luaotfload.sty
> > \font \myfont =
> > file:HM_XNiloofar.ttf:language=dflt;script=arab;
> ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes
> > \myfont Salam
> >
> > \pardir TRT
> > \textdir TRT
> > سلام
> > حسن
> > \bye
> >
> >
> > On Fri, Oct 7, 2016 at 7:19 AM, Mohammad Hossein Bateni <
> bat...@gmail.com>
> > 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=file:font.otf:language=dflt;script=arab;
> >> ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes
> >>
> >> —MHB
> >>
> >>
> >> On Fri, Oct 7, 2016 at 7:01 AM, Mingranina Gingranina <
> >> mingran...@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 "ح‌س‌ن" instead of "حسن".
> >>>  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=pe,date=\longjalalidatefmt]
> >>> \mainlanguage[fa]
> >>>
> >>> \definefontfeature[tlig][tlig=yes]
> >>> \definefontfeature[slanted][slant=.2]
> >>> \definefontfeature[dlang][language=dflt]
> >>> \definefontfeature[flang][language=far]
> >>>
> >>> Thanks
> >>> Mingranina
> >>>
> >>>
> >>> fontsampler.tex
> >>> 
> >>> =
> >>> \input luaotfload.sty
> >>> \overfullrule 0pt
> >>> \font\mono = {file:lmmono8-regular.otf} at 6pt
> >>> \parindent 0pt
> >>>
> >>> \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890
> >>> äÄöÖüÜ ß !"§\$\%\&()=?}
> >>>
> >>> \directlua{
> >>>   dofile("fontsampler.lua")
> >>>   fontsampler(arg[2])
> >>> }
> >>>
> >>> \bye
> >>> 
> >>> =
> >>> End Of fontsampler.tex
> >>>
> >>>
> >>> fontsampler.lua
> >>> 
> >>> =
> >>> function dirtree(dir)
> >>>   assert(dir and dir ~= "", "directory parameter is missing or empty")
> >>>   if string.sub(dir, -1) == "/" then
> >>> dir=string.sub(dir, 1, -2)
> >>>   end
> >>>
> >>>   local function yieldtree(dir)
> >>> for entry in lfs.dir(dir) do
> >>>   if not entry:match("^%.") then
> >>> entry=dir.."/"..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
> >>> 1\font\sample={file:]]},{-2,entry},{[[} at
> >>> 12pt\sample\samplestring\par\penalty 1\vrule width \hsize height
> >>> 0.25pt depth 0pt\par]]})
> >>> end
> >>>   end
> >>> end
> >>> 
> >>> =
> >>> 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/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
> >>> 

Re: [NTG-context] How to use "fontsampler example" with Persian font

2016-10-07 Thread Mingranina Gingranina
 Dear Mohammad,
 Hi,

 Thank you very much for your reply. I forgot to mention that I had
modified the fontsampler codes so that I can use it in ConTeXt with
Dabeer module.

 However, inspired by your reply I could get it to work in LuaTeX but
not in ConTeXt with Dabeer module.

 Are there any other set of features that I can test?

 Thanks,
 Mingranina

On 10/7/16, Mohammad Hossein Bateni  wrote:
> The following works for me:
>
> \input luaotfload.sty
> \font \myfont =
> file:HM_XNiloofar.ttf:language=dflt;script=arab;ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes
> \myfont Salam
>
> \pardir TRT
> \textdir TRT
> سلام
> حسن
> \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=file:font.otf:language=dflt;script=arab;
>> ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes
>>
>> —MHB
>>
>>
>> On Fri, Oct 7, 2016 at 7:01 AM, Mingranina Gingranina <
>> mingran...@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 "ح‌س‌ن" instead of "حسن".
>>>  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=pe,date=\longjalalidatefmt]
>>> \mainlanguage[fa]
>>>
>>> \definefontfeature[tlig][tlig=yes]
>>> \definefontfeature[slanted][slant=.2]
>>> \definefontfeature[dlang][language=dflt]
>>> \definefontfeature[flang][language=far]
>>>
>>> Thanks
>>> Mingranina
>>>
>>>
>>> fontsampler.tex
>>> 
>>> =
>>> \input luaotfload.sty
>>> \overfullrule 0pt
>>> \font\mono = {file:lmmono8-regular.otf} at 6pt
>>> \parindent 0pt
>>>
>>> \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890
>>> äÄöÖüÜ ß !"§\$\%\&()=?}
>>>
>>> \directlua{
>>>   dofile("fontsampler.lua")
>>>   fontsampler(arg[2])
>>> }
>>>
>>> \bye
>>> 
>>> =
>>> End Of fontsampler.tex
>>>
>>>
>>> fontsampler.lua
>>> 
>>> =
>>> function dirtree(dir)
>>>   assert(dir and dir ~= "", "directory parameter is missing or empty")
>>>   if string.sub(dir, -1) == "/" then
>>> dir=string.sub(dir, 1, -2)
>>>   end
>>>
>>>   local function yieldtree(dir)
>>> for entry in lfs.dir(dir) do
>>>   if not entry:match("^%.") then
>>> entry=dir.."/"..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
>>> 1\font\sample={file:]]},{-2,entry},{[[} at
>>> 12pt\sample\samplestring\par\penalty 1\vrule width \hsize height
>>> 0.25pt depth 0pt\par]]})
>>> end
>>>   end
>>> end
>>> 
>>> =
>>> 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/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
>>> 
>>> ___
>>
>>
>>
>
___
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

Re: [NTG-context] How to use "fontsampler example" with Persian font

2016-10-07 Thread Mohammad Hossein Bateni
The following works for me:

\input luaotfload.sty
\font \myfont =
file:HM_XNiloofar.ttf:language=dflt;script=arab;ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes
\myfont Salam

\pardir TRT
\textdir TRT
سلام
حسن
\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=file:font.otf:language=dflt;script=arab;
> ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes
>
> —MHB
>
>
> On Fri, Oct 7, 2016 at 7:01 AM, Mingranina Gingranina <
> mingran...@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 "ح‌س‌ن" instead of "حسن".
>>  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=pe,date=\longjalalidatefmt]
>> \mainlanguage[fa]
>>
>> \definefontfeature[tlig][tlig=yes]
>> \definefontfeature[slanted][slant=.2]
>> \definefontfeature[dlang][language=dflt]
>> \definefontfeature[flang][language=far]
>>
>> Thanks
>> Mingranina
>>
>>
>> fontsampler.tex
>> 
>> =
>> \input luaotfload.sty
>> \overfullrule 0pt
>> \font\mono = {file:lmmono8-regular.otf} at 6pt
>> \parindent 0pt
>>
>> \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890
>> äÄöÖüÜ ß !"§\$\%\&()=?}
>>
>> \directlua{
>>   dofile("fontsampler.lua")
>>   fontsampler(arg[2])
>> }
>>
>> \bye
>> 
>> =
>> End Of fontsampler.tex
>>
>>
>> fontsampler.lua
>> 
>> =
>> function dirtree(dir)
>>   assert(dir and dir ~= "", "directory parameter is missing or empty")
>>   if string.sub(dir, -1) == "/" then
>> dir=string.sub(dir, 1, -2)
>>   end
>>
>>   local function yieldtree(dir)
>> for entry in lfs.dir(dir) do
>>   if not entry:match("^%.") then
>> entry=dir.."/"..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
>> 1\font\sample={file:]]},{-2,entry},{[[} at
>> 12pt\sample\samplestring\par\penalty 1\vrule width \hsize height
>> 0.25pt depth 0pt\par]]})
>> end
>>   end
>> end
>> 
>> =
>> 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/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
>> 
>> ___
>
>
>
___
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
___

Re: [NTG-context] How to use "fontsampler example" with Persian font

2016-10-07 Thread Mohammad Hossein Bateni
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=file:font.otf:language=dflt;script=arab;ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes

—MHB

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 "ح‌س‌ن" instead of "حسن".
>  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=pe,date=\longjalalidatefmt]
> \mainlanguage[fa]
>
> \definefontfeature[tlig][tlig=yes]
> \definefontfeature[slanted][slant=.2]
> \definefontfeature[dlang][language=dflt]
> \definefontfeature[flang][language=far]
>
> Thanks
> Mingranina
>
>
> fontsampler.tex
> 
> =
> \input luaotfload.sty
> \overfullrule 0pt
> \font\mono = {file:lmmono8-regular.otf} at 6pt
> \parindent 0pt
>
> \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890
> äÄöÖüÜ ß !"§\$\%\&()=?}
>
> \directlua{
>   dofile("fontsampler.lua")
>   fontsampler(arg[2])
> }
>
> \bye
> 
> =
> End Of fontsampler.tex
>
>
> fontsampler.lua
> 
> =
> function dirtree(dir)
>   assert(dir and dir ~= "", "directory parameter is missing or empty")
>   if string.sub(dir, -1) == "/" then
> dir=string.sub(dir, 1, -2)
>   end
>
>   local function yieldtree(dir)
> for entry in lfs.dir(dir) do
>   if not entry:match("^%.") then
> entry=dir.."/"..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
> 1\font\sample={file:]]},{-2,entry},{[[} at
> 12pt\sample\samplestring\par\penalty 1\vrule width \hsize height
> 0.25pt depth 0pt\par]]})
> end
>   end
> end
> 
> =
> 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
> 
> ___
___
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
___

[NTG-context] How to use "fontsampler example" with Persian font

2016-10-07 Thread Mingranina Gingranina
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 "ح‌س‌ن" instead of "حسن".
 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=pe,date=\longjalalidatefmt]
\mainlanguage[fa]

\definefontfeature[tlig][tlig=yes]
\definefontfeature[slanted][slant=.2]
\definefontfeature[dlang][language=dflt]
\definefontfeature[flang][language=far]

Thanks
Mingranina


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

\def \samplestring {Sphinx of black quartz, judge my vow. 1234567890
äÄöÖüÜ ß !"§\$\%\&()=?}

\directlua{
  dofile("fontsampler.lua")
  fontsampler(arg[2])
}

\bye
=
End Of fontsampler.tex


fontsampler.lua
=
function dirtree(dir)
  assert(dir and dir ~= "", "directory parameter is missing or empty")
  if string.sub(dir, -1) == "/" then
dir=string.sub(dir, 1, -2)
  end

  local function yieldtree(dir)
for entry in lfs.dir(dir) do
  if not entry:match("^%.") then
entry=dir.."/"..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
1\font\sample={file:]]},{-2,entry},{[[} at
12pt\sample\samplestring\par\penalty 1\vrule width \hsize height
0.25pt depth 0pt\par]]})
end
  end
end
=
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
___