Skip to content

Commit 4c8676f

Browse files
Merge pull request #473 from gaurav12devloper/main
fixed bug for space between two character
2 parents 50e4284 + 6d4b536 commit 4c8676f

File tree

9 files changed

+74
-3
lines changed

9 files changed

+74
-3
lines changed

Ascii.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ namespace ascii
206206
else if (c == '9')
207207
character = font->nine();
208208

209+
//for space
210+
else if (c == ' ')
211+
character = font->space();
212+
209213
font->pushChar(character);
210214
}
211215
font->printvector();

Fonts/Boomer/boomer.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,5 +793,15 @@ class Boomer : public Fonts
793793
character[3][0] = character[5][0] = '\\';
794794
return character;
795795
}
796+
797+
// for space
798+
char **space()
799+
{
800+
char **character = getCharGrid(1,1);
801+
802+
character[0][0] = ' ';
803+
804+
return character;
805+
}
796806
};
797807
#endif

Fonts/SevenStar/sevenstar.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,5 +2461,15 @@ class SevenStar : public Fonts
24612461
}
24622462
return character;
24632463
}
2464+
2465+
// for space
2466+
char **space()
2467+
{
2468+
char **character = getCharGrid(1,1);
2469+
2470+
character[0][0] = ' ';
2471+
2472+
return character;
2473+
}
24642474
};
24652475
#endif

Fonts/Straight/straight.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,16 @@ class Straight : public Fonts
733733
character[2][3] = '/';
734734
character[1][3] = '\\';
735735

736+
return character;
737+
}
738+
739+
// for space
740+
char **space()
741+
{
742+
char **character = getCharGrid(1,1);
743+
744+
character[0][0] = ' ';
745+
736746
return character;
737747
}
738748
};

Fonts/banner/banner.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,5 +694,16 @@ class Banner : public Fonts
694694
}
695695
696696
*/
697+
698+
// for space
699+
char **space()
700+
{
701+
char **character = getCharGrid(1,1);
702+
703+
character[0][0] = ' ';
704+
705+
return character;
706+
}
707+
697708
};
698709
#endif

Fonts/carlos/carlos.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,5 +1012,15 @@ class Carlos : public Fonts
10121012
}
10131013
10141014
*/
1015+
1016+
// for space
1017+
char **space()
1018+
{
1019+
char **character = getCharGrid(1,1);
1020+
1021+
character[0][0] = ' ';
1022+
1023+
return character;
1024+
}
10151025
};
10161026
#endif

Fonts/fonts.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ class Fonts
8383
}
8484

8585
/********************************adding virtual functions********************************/
86+
// Virtual functions for space
87+
virtual char **space()
88+
{
89+
std::cout << "space not overridden?" << std::endl;
90+
return nullptr;
91+
}
92+
8693
// Virtual functions for lowercase letters
8794
virtual char **a()
8895
{

Fonts/starwar/starwar.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,5 +805,15 @@ class Starwar : public Fonts
805805
character[2][0] = character[2][6] = character[3][6] = '|';
806806
return character;
807807
}
808+
809+
// for space
810+
char **space()
811+
{
812+
char **character = getCharGrid(1,1);
813+
814+
character[0][0] = ' ';
815+
816+
return character;
817+
}
808818
};
809819
#endif

example.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ using namespace ascii;
55

66
int main()
77
{
8-
Ascii a = Ascii(straight);
9-
a.print("JLK");
10-
8+
Ascii a = Ascii(carlos);
9+
a.print("G A");
1110
return 0;
1211
}

0 commit comments

Comments
 (0)