Skip to content

Commit

Permalink
Merge pull request #473 from gaurav12devloper/main
Browse files Browse the repository at this point in the history
fixed bug for space between two character
  • Loading branch information
AnshumanMahato authored Oct 19, 2023
2 parents 50e4284 + 6d4b536 commit 4c8676f
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Ascii.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ namespace ascii
else if (c == '9')
character = font->nine();

//for space
else if (c == ' ')
character = font->space();

font->pushChar(character);
}
font->printvector();
Expand Down
10 changes: 10 additions & 0 deletions Fonts/Boomer/boomer.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,5 +793,15 @@ class Boomer : public Fonts
character[3][0] = character[5][0] = '\\';
return character;
}

// for space
char **space()
{
char **character = getCharGrid(1,1);

character[0][0] = ' ';

return character;
}
};
#endif
10 changes: 10 additions & 0 deletions Fonts/SevenStar/sevenstar.h
Original file line number Diff line number Diff line change
Expand Up @@ -2461,5 +2461,15 @@ class SevenStar : public Fonts
}
return character;
}

// for space
char **space()
{
char **character = getCharGrid(1,1);

character[0][0] = ' ';

return character;
}
};
#endif
10 changes: 10 additions & 0 deletions Fonts/Straight/straight.h
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,16 @@ class Straight : public Fonts
character[2][3] = '/';
character[1][3] = '\\';

return character;
}

// for space
char **space()
{
char **character = getCharGrid(1,1);

character[0][0] = ' ';

return character;
}
};
Expand Down
11 changes: 11 additions & 0 deletions Fonts/banner/banner.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,5 +694,16 @@ class Banner : public Fonts
}
*/

// for space
char **space()
{
char **character = getCharGrid(1,1);

character[0][0] = ' ';

return character;
}

};
#endif
10 changes: 10 additions & 0 deletions Fonts/carlos/carlos.h
Original file line number Diff line number Diff line change
Expand Up @@ -1012,5 +1012,15 @@ class Carlos : public Fonts
}
*/

// for space
char **space()
{
char **character = getCharGrid(1,1);

character[0][0] = ' ';

return character;
}
};
#endif
7 changes: 7 additions & 0 deletions Fonts/fonts.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ class Fonts
}

/********************************adding virtual functions********************************/
// Virtual functions for space
virtual char **space()
{
std::cout << "space not overridden?" << std::endl;
return nullptr;
}

// Virtual functions for lowercase letters
virtual char **a()
{
Expand Down
10 changes: 10 additions & 0 deletions Fonts/starwar/starwar.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,5 +805,15 @@ class Starwar : public Fonts
character[2][0] = character[2][6] = character[3][6] = '|';
return character;
}

// for space
char **space()
{
char **character = getCharGrid(1,1);

character[0][0] = ' ';

return character;
}
};
#endif
5 changes: 2 additions & 3 deletions example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ using namespace ascii;

int main()
{
Ascii a = Ascii(straight);
a.print("JLK");

Ascii a = Ascii(carlos);
a.print("G A");
return 0;
}

0 comments on commit 4c8676f

Please sign in to comment.