# How to make ASCII Art for Nepali Characters?

**URL:** <https://forum.kirupa.com/t/how-to-make-ascii-art-for-nepali-characters/659312>\
**Category:** programming\
**Created:** [June 13, 2023, 2:26pm UTC](https://forum.kirupa.com/t/how-to-make-ascii-art-for-nepali-characters/659312 "2023-06-13T14:26:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![polaryeti](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/polaryeti/32/19283_2.png) [@polaryeti](https://forum.kirupa.com/u/polaryeti)\
**Post date:** [June 13, 2023, 2:26pm UTC](https://forum.kirupa.com/t/how-to-make-ascii-art-for-nepali-characters/659312/1 "2023-06-13T14:26:25Z")

</div>

This is an example of Nepali sentence. Nepali is based on Devanagari Script.

यो फोरम मलाई एकदम मन पर्छ|

> **[Nepali alphabet](https://nepalilanguage.org/alphabet/#:~:text=Each%20of%20the%20following%2033,%2F%2C%20%E0%A4%AB%20%2Fp%CA%B0a%2F%2C)**
>
> क, ख, ग ... to ... क्ष, त्र, ज्ञ - an overview of the Nepali alphabet and the Nepali writing system.

These are the vowels and consonants in Nepali.

A Nepali consonant can take these many forms. “Ka” is first letter of Nepali consonant.

 ![](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/1/6/1647b3371cf8fc94cbc61eaeb48edd920d3f0585.png)

Expected Input

यो फोरम मलाई एकदम मन पर्छ|

And any character like a,b,c,.,/,\*,+,- based on which the ASCII art will be generated.

Expected Output

Every letter should be scaled and drawn with the given character, say for example “\*”. Like below.

Plan 1:

1. Accept Nepali characters as input. And parse each character.

example यो फोरम मलाई एकदम मन पर्छ|

1. Get the shape of each character.

2. Scale the shape.

3. Redraw the shape using “\*” or anything given by user as input.

Plan 2:

1. Take Nepali character as input

2. Convert to Unicode.

3. Process the Unicode.

4. Display Nepali as output.

I’m wondering how could I do this? Language doesn’t matter but I’d prefer, C, C++ or Javascript.

 ![](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/d/2/d2fa8c82630ee242cfafab512065089eab03c5d2.jpeg)

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 13, 2023, 3:29pm UTC](https://forum.kirupa.com/t/how-to-make-ascii-art-for-nepali-characters/659312/2 "2023-06-13T15:29:19Z")

</div>

Are Plans 1 and 2 ones you came up with? Or are they part of the assignment?

---

<div class="post-metadata">

**Author:** ![polaryeti](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/polaryeti/32/19283_2.png) [@polaryeti](https://forum.kirupa.com/u/polaryeti)\
**Post date:** [June 13, 2023, 3:49pm UTC](https://forum.kirupa.com/t/how-to-make-ascii-art-for-nepali-characters/659312/3 "2023-06-13T15:49:12Z")

</div>

Haha, I wish I was in college and had such assignments. Would be so fun. College Life is the best. This is my own project.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 13, 2023, 5:09pm UTC](https://forum.kirupa.com/t/how-to-make-ascii-art-for-nepali-characters/659312/4 "2023-06-13T17:09:52Z")

</div>

Ah! In that case, Plan 1 seems more reasonable. For each character, create a NxN array where you designate the shape of the character just like you would in a pixel grid:

```auto
let myArray = [["x", "x", "x", "i", "x", "i"],
               ["x", "i", "x", "i", "x", "i"],
               ["x", "i", "x", "x", "x", "i"],
               ["x", "x", "x", "i", "x", "x"]];

```

For example, everything you see an “x”, you use a space. Every time you see an “i” you print a star \* character.

( **Note:** What I have above doesn’t actually display anything recognizable. Depending on how big you want to make your scaled character go, you may have a 32x32 grid!)

That is one approach that you could consider 🙂

---

<div class="post-metadata">

**Author:** ![PAEz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/paez/32/19607_2.png) [@PAEz](https://forum.kirupa.com/u/PAEz)\
**Post date:** [June 13, 2023, 7:37pm UTC](https://forum.kirupa.com/t/how-to-make-ascii-art-for-nepali-characters/659312/5 "2023-06-13T19:37:01Z")

</div>

Going to bed so dont have time to look up the specifics right now but the general idea is that you print it to the canvas and then read the canvas.  
Theres some things that can help like [TextMetrics - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics) to get the width of what was printed, you know the height (altho theres some quirk with that I cant remember, havent done it in a long time).  
Thats the basics of it.

---

<div class="post-metadata">

**Author:** ![polaryeti](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/polaryeti/32/19283_2.png) [@polaryeti](https://forum.kirupa.com/u/polaryeti)\
**Post date:** [June 14, 2023, 1:47pm UTC](https://forum.kirupa.com/t/how-to-make-ascii-art-for-nepali-characters/659312/6 "2023-06-14T13:47:28Z")

</div>

I really want to do this project But having no clue. I’ll give up on this. Sounds too complicated. I always liked to make a LED for diwali using programming. where I write happy diwali in Nepali and other stuffs…Dreams are better left as dreams as that’s what keeps us awake. Since I’ve been taught assembly in '85 '86 uP, I think I could code a uP to draw it or just use code converter.

I’ll do for english now. My weekend project.
