<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us"><generator uri="https://gohugo.io/" version="0.101.0">Hugo</generator><title type="html">Gujarati in Emacs on A Scripter's Notes</title><subtitle type="html">Emacs, scripting and anything text oriented.</subtitle><link href="https://scripter.co/series/gujarati-in-emacs/" rel="alternate" type="text/html" title="HTML"/><link href="https://scripter.co/series/gujarati-in-emacs/index.xml" rel="alternate" type="application/rss+xml" title="RSS"/><link href="https://scripter.co/series/gujarati-in-emacs/atom.xml" rel="self" type="application/atom+xml" title="Atom"/><link href="https://scripter.co/series/gujarati-in-emacs/jf2feed.json" rel="alternate" type="application/jf2feed+json" title="jf2feed"/><updated>2026-04-22T08:24:57-04:00</updated><author><name>Kaushal Modi</name><email>kaushal.modi@gmail.com</email></author><id>https://scripter.co/series/gujarati-in-emacs/</id><entry><title type="html">Gujarati Transliteration</title><link href="https://scripter.co/gujarati-transliteration/?utm_source=atom_feed" rel="alternate" type="text/html"/><link href="https://scripter.co/gujarati-fonts-in-emacs/?utm_source=atom_feed" rel="related" type="text/html" title="Gujarati fonts in Emacs"/><link href="https://scripter.co/cleaning-up-gopath-pkg/?utm_source=atom_feed" rel="related" type="text/html" title="Cleaning up ${GOPATH}/pkg/"/><link href="https://scripter.co/view-github-pull-requests-in-magit/?utm_source=atom_feed" rel="related" type="text/html" title="View GitHub Pull Requests in Magit"/><link href="https://scripter.co/emacs-lisp-advice-combinators/?utm_source=atom_feed" rel="related" type="text/html" title="Emacs Lisp: Advice Combinators"/><link href="https://scripter.co/org-show-only-post-subtree-headings/?utm_source=atom_feed" rel="related" type="text/html" title="Org: Show only Post subtree headings"/><id>https://scripter.co/gujarati-transliteration/</id><author><name>Kaushal Modi</name></author><published>2022-06-27T18:43:00-04:00</published><updated>2022-06-27T18:43:00-04:00</updated><content type="html"><![CDATA[<blockquote>You can phonetically write a non-English language on an English
keyword in Emacs, and that transforms into that non-English
script. This is called <a href="https://en.wikipedia.org/wiki/Transliteration"><em>transliteration</em></a>, and I demonstrate that for
the Gujarati language in this post.</blockquote><div class="ox-hugo-toc toc">
<div class="heading">Table of Contents</div>
<ul>
<li><a href="#enabling-transliteration">Enabling transliteration</a></li>
<li><a href="#toggling-the-input-method">Toggling the input method</a></li>
<li><a href="#caveats-with-gujarati-and-other-indic-language-transliteration">Caveats with Gujarati and other Indic language transliteration</a></li>
<li><a href="#input-method-cheat-sheet">&ldquo;Input method&rdquo; cheat sheet</a></li>
<li><a href="#closing">Closing</a></li>
<li><a href="#gujarati-transliteration-references">References</a></li>
</ul>
</div>
<!--endtoc-->
<p>Emacs provides the transliteration feature using the
<strong>set-input-method</strong> command. I&rsquo;ll introduce that and few related
functions in this post to get to help get started with transliteration
quickly.</p>

<h2 id="enabling-transliteration">Enabling transliteration&nbsp;<a class="headline-hash no-text-decoration" href="#enabling-transliteration">#</a></h2>


<p>Emacs uses the &ldquo;input method&rdquo; feature to do character conversion from
ASCII to the target language or script. The &ldquo;input method&rdquo;, stored in
<code>current-input-method</code>, is <em>nil</em> by default. In this state, you see
the exact ASCII in Emacs buffer, that you typed on the
keyboard<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup>.</p>
<p>In this post, my target non-English language is <a href="https://en.wikipedia.org/wiki/Gujarati_language">Gujarati</a>. So I want to
type on my English keyboard and have Gujarati script letters show up
in the buffer.</p>
<p>Emacs provides the <code>set-input-method</code> command to change the <em>current
input method</em>. This command is bound to <kbd>C-x</kbd> <kbd>RET</kbd>
<kbd>C-\</kbd> by default. Pick the new input method after calling
that command.</p>
<div class="note">
<p>To see the available input methods, do <code>M-x list-input-methods</code>.</p>
</div>
<p>As I want to do Gujarati transliteration, I pick the <code>gujarati-itrans</code>
method.</p>
<p>If you don&rsquo;t know Gujarati, don&rsquo;t fret! The commands shown here will
work when transliterating to other languages too &mdash; only the
Gujarati-specific <em>input method</em> <code>gujarati-itrans</code> will change to the
input method of your choice.</p>

<h2 id="toggling-the-input-method">Toggling the input method&nbsp;<a class="headline-hash no-text-decoration" href="#toggling-the-input-method">#</a></h2>


<p>I often need to switch between the Gujarati and English languages in
the same document. You can see me doing that in this post next section
onwards. The <code>toggle-input-method</code> command bound by default to
<kbd>C-\</kbd> is helpful here.</p>
<p>So if I am already in the &ldquo;Gujarati transliteration mode&rdquo; calling this
command will set <code>current-input-method</code> back to <em>nil</em>. Repeating that
same call will again set <code>current-input-method</code> to <code>gujarati-itrans</code>,
and I will once again be in the &ldquo;Gujarati transliteration mode&rdquo;.</p>

<h2 id="caveats-with-gujarati-and-other-indic-language-transliteration">Caveats with Gujarati and other Indic language transliteration&nbsp;<a class="headline-hash no-text-decoration" href="#caveats-with-gujarati-and-other-indic-language-transliteration">#</a></h2>


<p>Apologies, but this section is meaningful only if you know how to read
Gujarati. So you can safely skip to the next section.</p>
<p>Below table is a quick glimpse of some nuances in Gujarati
transliteration. I will save my explanation and instead show some of
the mistakes I made in transliteration using examples.</p>
<table>
<thead>
<tr>
<th>ASCII input</th>
<th>Gujarati Transliteration</th>
<th>Rough Translation</th>
</tr>
</thead>
<tbody>
<tr>
<td><em>ram</em></td>
<td>રમ્</td>
<td>(incorrect spelling, no meaning)</td>
</tr>
<tr>
<td><em>rama</em></td>
<td>રમ</td>
<td>play</td>
</tr>
<tr>
<td><em>raama</em></td>
<td>રામ</td>
<td>a popular name Raama (as in Lord Raama)</td>
</tr>
<tr>
<td><em>angreji</em></td>
<td>અન્ગ્રેજિ</td>
<td>(incorrect spelling)</td>
</tr>
<tr>
<td><em>hu.n</em></td>
<td>હું</td>
<td>I</td>
</tr>
<tr>
<td><em>chhu.n</em></td>
<td>છું</td>
<td>am</td>
</tr>
<tr>
<td><em>a.ngrejii</em></td>
<td>અંગ્રેજી<sup id="fnref:2"><a href="#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup></td>
<td>English (language)</td>
</tr>
<tr>
<td><em>Ime.cksa</em></td>
<td>ઈમૅક્સ</td>
<td>this literally reads &ldquo;Emacs&rdquo;</td>
</tr>
</tbody>
</table>

<h2 id="input-method-cheat-sheet">&ldquo;Input method&rdquo; cheat sheet&nbsp;<a class="headline-hash no-text-decoration" href="#input-method-cheat-sheet">#</a></h2>


<p>Thankfully Emacs provides full help through the
<code>describe-input-method</code> command bound to <kbd>C-h</kbd>
<kbd>C-\</kbd>
<span class="sidenote-number"><small class="sidenote">
If you haven&rsquo;t already noticed the consistency in these bindings, the
default bindings with <kbd>C-\</kbd> in them are related to &ldquo;input
method&rdquo; commands.
</small></span>
by default.</p>
<p>For example, <code>M-x describe-input-method gujarati-itrans</code> gives this:</p>
<p><a id="figure--gujarati-itrans-help"></a></p>



<figure>
    <a href="gujarati-itrans-help.png">
        <img src="https://scripter.co/gujarati-transliteration/gujarati-itrans-help.png" alt="Figure 1: Partial screen capture of Gujarati transliteration cheat sheet C-h C- gujarati-itrans"/> </a><figcaption>
                <p>
                    <span class="figure-number">Figure 1: </span>Partial screen capture of Gujarati transliteration cheat sheet <code>C-h C- gujarati-itrans</code>
                    
                        
                        </p>
                
            </figcaption></figure>

<p>The ∗Help∗ that shows up looks formidable at the first glance. Though,
I found comfort in the fact that roughly half of the key sequences
were obvious and roughly half resulted in Gujarati characters that I
have never found the need of! 😃</p>

<h2 id="closing">Closing&nbsp;<a class="headline-hash no-text-decoration" href="#closing">#</a></h2>


<p>Typing this in the &ldquo;transliteration mode&rdquo;:</p>
<blockquote>
<p>maaru naama kaushala chhe. mane e jaaNii ne aana.nda thaaya chhe ke
hu.n aa sahelaaI thI lakhI shaku chhu.n. (joDanI-bhula maapha.)</p>
</blockquote>
<p>will result in:</p>
<p>મારુ નામ કૌશલ છે. મને એ જાણી ને આનંદ થાય છે કે હું આ સહેલાઈ થી લખી શકુ
છું. (જોડણી-ભુલ માફ.)</p>
<p><em>Translation: My name is Kaushal. I am happy knowing that I can write
this easily.</em></p>

<h2 id="gujarati-transliteration-references">References&nbsp;<a class="headline-hash no-text-decoration" href="#gujarati-transliteration-references">#</a></h2>


<ul>
<li><a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Input-Methods.html" title="Emacs Lisp: (info &quot;(emacs) Input Methods&quot;)">Emacs Info: Input Methods</a>
<ul>
<li><a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Select-Input-Method.html" title="Emacs Lisp: (info &quot;(emacs) Select Input Method&quot;)">Emacs Info: Select Input Method</a></li>
</ul>
</li>
<li><code>M-x describe-input-method gujarati-itrans</code></li>
</ul>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>I am assuming an English keyboard here.&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:2">
<p>This spelling might still render incorrectly on your browser
depending on the unicode character set available for Gujarati on your
system.&#160;<a href="#fnref:2" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content><category scheme="https://scripter.co/categories/emacs" term="emacs" label="emacs"/><category scheme="https://scripter.co/series/gujarati-in-emacs" term="gujarati-in-emacs" label="Gujarati in Emacs"/><category scheme="https://scripter.co/tags/gujarati" term="gujarati" label="gujarati"/><category scheme="https://scripter.co/tags/transliteration" term="transliteration" label="transliteration"/><category scheme="https://scripter.co/tags/100daystooffload" term="100daystooffload" label="100DaysToOffload"/></entry><entry><title type="html">Gujarati fonts in Emacs</title><link href="https://scripter.co/gujarati-fonts-in-emacs/?utm_source=atom_feed" rel="alternate" type="text/html"/><link href="https://scripter.co/emacs-lisp-advice-combinators/?utm_source=atom_feed" rel="related" type="text/html" title="Emacs Lisp: Advice Combinators"/><link href="https://scripter.co/org-show-only-post-subtree-headings/?utm_source=atom_feed" rel="related" type="text/html" title="Org: Show only Post subtree headings"/><link href="https://scripter.co/firefox-always-open-a-new-tab-after-current/?utm_source=atom_feed" rel="related" type="text/html" title="Firefox: Always open a New Tab after Current"/><link href="https://scripter.co/saving-python-pip-dependencies/?utm_source=atom_feed" rel="related" type="text/html" title="Saving Python pip dependencies"/><link href="https://scripter.co/disarming-the-tar-bomb-in-10-seconds/?utm_source=atom_feed" rel="related" type="text/html" title="Disarming the 'tar' bomb in 10 seconds"/><id>https://scripter.co/gujarati-fonts-in-emacs/</id><author><name>Kaushal Modi</name></author><published>2022-06-19T01:31:00-04:00</published><updated>2022-06-19T01:31:00-04:00</updated><content type="html"><![CDATA[<blockquote>Setting a different font for a specific script or language in Emacs.</blockquote><div class="ox-hugo-toc toc">
<div class="heading">Table of Contents</div>
<ul>
<li><a href="#setting-a-fontset-font">Setting a &ldquo;fontset&rdquo; font</a></li>
<li><a href="#gujarati-fonts">Gujarati fonts</a></li>
</ul>
</div>
<!--endtoc-->
<p>All Emacs versions ship with a nifty <strong>HELLO</strong> file that you can quickly
open using <code>M-x view-hello-file</code> or its default binding <code>C-h h</code>. This
file lists &ldquo;Hello&rdquo; written in dozens of languages to demonstrate some
of the character sets supported by Emacs.</p>
<p><a id="figure--hello-buffer"></a></p>



<figure>
    <a href="hello.png">
        <img src="https://scripter.co/gujarati-fonts-in-emacs/hello.png" alt="Figure 1: &ldquo;Hello&rdquo; buffer in Emacs"/> </a><figcaption>
                <p>
                    <span class="figure-number">Figure 1: </span>&ldquo;Hello&rdquo; buffer in Emacs
                    
                        
                        </p>
                
            </figcaption></figure>

<p>Born and raised in the Gujarat state in India, I grew up
speaking the <a href="https://en.wikipedia.org/wiki/Gujarati_language">Gujarati (ગુજરાતી)</a> language
<span class="sidenote-number"><small class="sidenote">
India officially recognizes <a href="https://en.wikipedia.org/wiki/Languages_of_India">22 languages</a> (as of <span class="timestamp-wrapper"><span class="timestamp">&lt;2022-06-19 Sun&gt;</span></span>) and
Gujarati is one of them.
</small></span>
and so it&rsquo;s also the language closest to my heart. So I was pleasantly
surprised to see a representation of Gujarati in the &ldquo;Hello&rdquo; buffer!
In the above screenshot, in the &ldquo;South Asia&rdquo; section, the script after
the yellow cursor is Gujarati, and it reads <em>namaste</em>.</p>

<h2 id="setting-a-fontset-font">Setting a &ldquo;fontset&rdquo; font&nbsp;<a class="headline-hash no-text-decoration" href="#setting-a-fontset-font">#</a></h2>


<p>It was on <span class="timestamp-wrapper"><span class="timestamp">&lt;2018-08-13 Mon&gt; </span></span> that I discovered the presence of Gujarati
script in that &ldquo;Hello&rdquo; buffer, and the reason I know that exact date
is because I had <a href="https://lists.gnu.org/r/help-gnu-emacs/2018-08/msg00033.html">asked a question</a> regarding that on the
<em>help-gnu-emacs</em> mailing list 😃.</p>
<p>This was the time when Emacs was using the <a href="https://www.nongnu.org/m17n/">m17n</a> library for
multi-lingual font rendering by default. The question was regarding a
font rendering issue I was seeing. As I learn later in that thread, it
was because I didn&rsquo;t have the m17n database installed on my machine
<span class="sidenote-number"><small class="sidenote">
At least in 2022, the <a href="https://github.com/harfbuzz/harfbuzz">harfbuzz</a> library is the recommended library for
text shaping and font rendering. Someone please correct me if that&rsquo;s
wrong. In any case, I have switched to using <em>harfbuzz</em> instead of
<em>m17n</em> for a while now and haven&rsquo;t found any font-rendering issues
with non-English scripts.
</small></span>
. But it&rsquo;s in that support thread that, thanks to <em>Andy Moreton</em>, I
learned that you can change the font for the Gujarati script using
<code>set-fontset-font</code>.</p>
<p>This applies in general to any script. You can read more details about
this function in <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Modifying-Fontsets.html" title="Emacs Lisp: (info &quot;(emacs) Modifying Fontsets&quot;)">Emacs Info: Modifying Fontsets</a>, but here&rsquo;s the gist:</p>
<p><a id="code-snippet--gujarati-set-fontset-font"></a></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nf">set-fontset-font</span> <span class="s">&#34;fontset-default&#34;</span> <span class="ss">&#39;gujarati</span> <span class="s">&#34;&lt;FONT NAME&gt;&#34;</span><span class="p">)</span>
</span></span></code></pre></div><div class="src-block-caption">
  <span class="src-block-number"><a href="#code-snippet--gujarati-set-fontset-font">Code Snippet 1</a>:</span>
  Setting default font for Gujarati script using <code>set-fontset-font</code>
</div>
<p>That led me down the path of exploring the available Gujarati fonts
out there ..</p>

<h2 id="gujarati-fonts">Gujarati fonts&nbsp;<a class="headline-hash no-text-decoration" href="#gujarati-fonts">#</a></h2>


<p>After looking around for a bit, I found a wonderful <a href="https://github.com/samyakbhuta/chhapkaam/wiki/%E0%AA%97%E0%AB%81%E0%AA%9C%E0%AA%B0%E0%AA%BE%E0%AA%A4%E0%AB%80-%E0%AA%AF%E0%AB%81%E0%AA%A8%E0%AA%BF%E0%AA%95%E0%AB%8B%E0%AA%A1-%E0%AA%AB%E0%AB%8B%E0%AA%A8%E0%AB%8D%E0%AA%9F-%E0%AA%B8%E0%AB%82%E0%AA%9A%E0%AB%80---List-of-Gujarati-Unicode-Fonts">collection of
Gujarati fonts</a> in this GitHub repository:
<a href="https://github.com/samyakbhuta/chhapkaam">github.com/samyakbhuta/chhapkaam</a>
<span class="sidenote-number"><small class="sidenote">
The repo name is <em>chhapkaam</em> (I
would have spelled it as <em>chhaapkaam</em>) which is the Gujarati word
છાપકામ, meaning &ldquo;printing&rdquo;.
</small></span>
.</p>
<p>Below is my further curated list of fonts from the above list:</p>
<p><a id="table--gujarati-fonts"></a></p>
<div class="table-caption">
  <span class="table-number"><a href="#table--gujarati-fonts">Table 1</a>:</span>
  Gujarati Fonts
</div>
<table>
<thead>
<tr>
<th>Font Name</th>
<th><em>Namaste</em></th>
<th>Category</th>
<th>Homepage</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Shruti</strong></td>
<td><img src="namaste_shruti.png" alt=""></td>
<td>serif</td>
<td></td>
<td><a href="https://www.wfonts.com/font/shruti">wfonts.com</a></td>
</tr>
<tr>
<td><strong>Mukta Vaani</strong></td>
<td><img src="namaste_mukta_vaani.png" alt=""></td>
<td>serif</td>
<td><a href="https://ektype.in/scripts/gujarati/mukta-vaani.html">Ek Type &ndash; Mukta Vaani</a></td>
<td><a href="https://github.com/EkType/Mukta/releases">GitHub</a></td>
</tr>
<tr>
<td><strong>Lohit Gujarati</strong></td>
<td><img src="namaste_lohit.png" alt=""></td>
<td>sans serif</td>
<td><a href="https://pagure.io/lohit">Pagure &ndash; Lohit</a></td>
<td><a href="https://releases.pagure.org/lohit/">pagure releases</a></td>
</tr>
</tbody>
</table>
<p>To use these fonts, after downloading and installing them on your
system, evaluate <a href="#code-snippet--gujarati-set-fontset-font">Code Snippet 1</a> above with the
correct &ldquo;FONT NAME&rdquo;. For example, to set the Gujarati text to use the
<em>Shruti</em> font, evaluate <code class="code-inline language-emacs-lisp"><span class="p">(</span><span class="nf">set-fontset-font</span> <span class="s">&#34;fontset-default&#34;</span> <span class="ss">&#39;gujarati</span> <span class="s">&#34;Shruti&#34;</span><span class="p">)</span></code>.</p>
<p>Thanks for reading (વાંચવા બદલ આભાર) 🙏!</p>
]]></content><category scheme="https://scripter.co/categories/emacs" term="emacs" label="emacs"/><category scheme="https://scripter.co/series/gujarati-in-emacs" term="gujarati-in-emacs" label="Gujarati in Emacs"/><category scheme="https://scripter.co/tags/gujarati" term="gujarati" label="gujarati"/><category scheme="https://scripter.co/tags/font" term="font" label="font"/><category scheme="https://scripter.co/tags/100daystooffload" term="100daystooffload" label="100DaysToOffload"/></entry></feed>