How to make ASCII Art for Nepali Characters?

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

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

These are the vowels and consonants in Nepali.

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

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.

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

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.

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:

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 :slight_smile:

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 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.

1 Like

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.