From: Mohammad Hossein Bateni <bateni@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: How to use "fontsampler example" with Persian font
Date: Fri, 7 Oct 2016 07:19:06 -0400 [thread overview]
Message-ID: <CAMHZ1dY0CC4tT9JWdHtbiUpx0D6o=VO804+_s6UD11GUTyTyUA@mail.gmail.com> (raw)
In-Reply-To: <CAEEu-TgfPv32LuRmvmwpwmqC7Fc7PNW_vmF3SHYf6mkxdLA4Zg@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3712 bytes --]
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 <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 "حسن" 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
> 10000\font\sample={file:]]},{-2,entry},{[[} at
> 12pt\sample\samplestring\par\penalty 10000\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
> ____________________________________________________________
> _______________________
[-- Attachment #1.2: Type: text/html, Size: 5214 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2016-10-07 11:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 11:01 Mingranina Gingranina
2016-10-07 11:19 ` Mohammad Hossein Bateni [this message]
2016-10-07 11:24 ` Mohammad Hossein Bateni
2016-10-07 15:41 ` Mingranina Gingranina
2016-10-07 15:48 ` Mohammad Hossein Bateni
2016-10-10 9:38 ` Wolfgang Schuster
2016-10-11 3:44 ` Mingranina Gingranina
2016-10-11 10:44 ` Mohammad Hossein Bateni
2016-10-12 14:07 ` Mingranina Gingranina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMHZ1dY0CC4tT9JWdHtbiUpx0D6o=VO804+_s6UD11GUTyTyUA@mail.gmail.com' \
--to=bateni@gmail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).