There are 3 letters at the entrance "AB" In need to output to the console? This is what the letter should look like.

* * * * * * 

If you can some universal solution for other letters of the alphabet. Give advice in which direction to move?

3 answers 3

I think it is necessary to look towards ASCII Art.

 public static void main(String[] args) { int width = 100; int height = 30; BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics g = image.getGraphics(); g.setFont(new Font("SansSerif", Font.PLAIN, 24)); Graphics2D graphics = (Graphics2D) g; graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); graphics.drawString("JAVA", 10, 20); for (int y = 0; y < height; y++) { StringBuilder sb = new StringBuilder(); for (int x = 0; x < width; x++) sb.append(image.getRGB(x, y) == -16777216 ? " " : "*"); if (sb.toString().trim().isEmpty()) continue; System.out.println(sb); } } 

Examples here , here and here

    It used to be called bit fonts. The idea is that you create an array of, for example, N 16thric numbers and then where bit = 1 - output an asterisk, where 0 is a space. That is, the letters "I" array in binary representation will look like this:

     00000000 00011000 00011000 00011000 00011000 00011000 00011000 00000000 

    Then you simply choose such letters, such as, for example, through dict and draw them. The main problem for you will be that since the letters have a height, you need to use a library that can position the pointer at the desired point on the screen. For python, you can use ncurses, for Java you need to search. I did just that for myself in the game - but there I displayed the text in the graphic.

      For python there is a pyfiglet library, the number of characters for the displayed letter is 3x5. Example:

       > from pyfiglet import figlet_format > > print(figlet_format('AB B', font='3x5')) # ## ## # # # # # # ### ## ## # # # # # # # # ## ##