How to write your name using a single letter in rows of 10

I need to write my last name using a single letter such as "L" in rows of 10. I know how to print my name but have no clue how to do it using a single letter nor how to do it in rows of 10. Here is an example of the word LE using only L

LLLL LLLLLLLLLL
LLLL LLLLLLLLLL
LLLL LLLLL
LLLL LLLLL
LLLL LLLLLLLLLL
LLLL LLLLLLLLLL
LLLL LLLLL
LLLL LLLLL
LLLLLLL LLLLLLLLLL
LLLLLLL LLLLLLLLLL
Last edited on
It sounds like you want it to look like this

LLLLLLLLLL
LLLLLLLLLL
LLLLLLLLLL
LLLLLLLLLL
LLLLLLLLLL
LLLLLLLLLL
LLLLLLLLLL
LLLLLLLLLL
LLLLLLLLLLLLLLLLLLLL
LLLLLLLLLLLLLLLLLLLL

EEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEE
EEEEEEEEEE
EEEEEEEEEE
EEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEE
EEEEEEEEEE
EEEEEEEEEE
EEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEE
Last edited on
Uh-Oh, this is hard. I write GUIs all the time and I'd solve this with a pattern array, like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
unsigned short pattern[26][10] = { // 10 rows for 26 characters
	{
		0x0FF0,		//	    LLLLLLLL
		0x3FFC,		//	  LLLLLLLLLLLL
		0xF00F,		//	LLLL        LLLL
		0xF00F,		//	LLLL        LLLL
		0xF00F,		//	LLLL        LLLL
		0xFFFF,		//	LLLLLLLLLLLLLLLL
		0xFFFF,		//	LLLLLLLLLLLLLLLL
		0xF00F,		//	LLLL        LLLL
		0xF00F,		//	LLLL        LLLL
		0xF00F		//	LLLL        LLLL
	},
	{
		0x....,		//	LLLLLLLLLLLL
		0x....,		//	LLLLLLLLLLLLLL
		0x....,		//	LLLL        LLLL
		0x....,		//	LLLL        LLLL
		0x....,		//	LLLLLLLLLLLLLL  
		0x....,		//	LLLLLLLLLLLLLL  
		0x....,		//	LLLL        LLLL
		0x....,		//	LLLL        LLLL
		0x....,		//	LLLLLLLLLLLLLL
		0x.... 		//	LLLLLLLLLLLL
	},
	.
	.
	.
};


In a way this is a 3 dimensional array where the third dimension is the individual bits in the hex number. One bit for each 'L'.

There's pretty much no simpler way because letters are basically little pictures. There is no mathematical way to create letter symbols. Not that I know of, at least.

For the bit test you can use a neat little trick:
1
2
3
4
5
	for(int i=15; i >= 0; i--){
		if( ( pattern[character][line] & (1 << i) ) != 0 ){
			// write 'L'
		}
	}

Note: '&' not '&&' because it's to mask one bit.


EDIT: i >= 0 instead of i != 0
Last edited on
The tricky bit is to put all the letters on the same line.

One way is to output the first row of each letter, then the second row of each letter, and so on.

Another way is to allocate a large 2D character array big enough to store the entire text, and place each character into the array, finally print out the entire array.
Topic archived. No new replies allowed.