Closed Zabbum closed 4 months ago
In what kind of "terminal" does this run on windows? cmd.exe ? cygwin ? ... ? or as a graphical application?
Setting the font (I haven't done that, so cannot say, if it's done right) can only work when running as a graphical application.
Another question: is the block-character (of which the large "OEL" consists) the same as the one in the bottom lines e.g. enclosing the text "ZABBUM"? if the latter are just blanks in reverse-color mode, maybe you could use that trick also for the large "OEL" ?
In what kind of "terminal" does this run on windows? cmd.exe ? cygwin ? ... ? or as a graphical application?
It's graphical application I suppose based on that it creates Swing frame. To config and create terminal i use:
// Config terminal
DefaultTerminalFactory terminalFactory = new DefaultTerminalFactory();
terminalFactory.setInitialTerminalSize(new TerminalSize(53, 34));
terminalFactory.setTerminalEmulatorFontConfiguration(SwingTerminalFontConfiguration.newInstance(font));
terminalFactory.setTerminalEmulatorTitle("Window title");
// Initialize terminal
Terminal terminal = terminalFactory.createTerminalEmulator();
Setting the font (I haven't done that, so cannot say, if it's done right) can only work when running as a graphical application.
So i do. (I hope that in right way)
Another question: is the block-character (of which the large "OEL" consists) the same as the one in the bottom lines e.g. enclosing the text "ZABBUM"? if the latter are just blanks in reverse-color mode, maybe you could use that trick also for the large "OEL" ?
In this particular case this would work but there are also other ASCII arts that seem broken.
Now i observed that £
character is broken as well but in a bit different way. (screenshots below)
Linux
Windows
it looks like your application outputs utf-8 but the windowing system expects iso-8859-1 or similar. are the strings embedded in java-source or loaded from a file at runtime?
maybe you could add debugging code (or use the debugger) to see if the string length of the string containing the graphical chars or £ is already wrong... that may help finding out if the problem happens on output, or alreadx on reading the strings from some file...
Paweł Kubas @.***> schrieb am Sa., 20. Juli 2024, 22:45:
In what kind of "terminal" does this run on windows? cmd.exe ? cygwin ? ... ? or as a graphical application?
It's graphical application I suppose based on that it creates Swing frame. To config and create terminal i use:
// Config terminalDefaultTerminalFactory terminalFactory = new DefaultTerminalFactory();terminalFactory.setInitialTerminalSize(new TerminalSize(53, 34));terminalFactory.setTerminalEmulatorFontConfiguration(SwingTerminalFontConfiguration.newInstance(font));terminalFactory.setTerminalEmulatorTitle("Window title"); // Initialize terminalTerminal terminal = terminalFactory.createTerminalEmulator();
Setting the font (I haven't done that, so cannot say, if it's done right) can only work when running as a graphical application.
So i do. (I hope that in right way)
Another question: is the block-character (of which the large "OEL" consists) the same as the one in the bottom lines e.g. enclosing the text "ZABBUM"? if the latter are just blanks in reverse-color mode, maybe you could use that trick also for the large "OEL" ?
In this particular case this would work but there are also other ASCII arts that seem broken. Now i observed that £ character is broken as well but in a bit different way. (screenshots below)
Linux image.png (view on web) https://github.com/user-attachments/assets/48442fec-ac7c-46c9-af40-10ca4af110c4
Windows image.png (view on web) https://github.com/user-attachments/assets/f9031a9a-5165-45df-b0f6-724fe2638419
— Reply to this email directly, view it on GitHub https://github.com/mabe02/lanterna/issues/609#issuecomment-2241289997, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIDBMXEED5YBBMXFXYO2WDZNLEAHAVCNFSM6AAAAABK5F236OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGI4DSOJZG4 . You are receiving this because you commented.Message ID: @.***>
it looks like your application outputs utf-8 but the windowing system expects iso-8859-1 or similar. are the strings embedded in java-source or loaded from a file at runtime?
They are loaded from a file.
maybe you could add debugging code (or use the debugger) to see if the string length of the string containing the graphical chars or £ is already wrong... that may help finding out if the problem happens on output, or alreadx on reading the strings from some file...
Yeah, now I tried to do it with the Û
char (present in file) and it seems that in memory it is present as Ă›
.
Enforced using UTF-8 in reading a file and now works perfectly!
void textLoader(InputStream inputStream) {
// Transform InputStream to File
File dataFile = File.createTempFile("art", ".json");
FileOutputStream out = new FileOutputStream(dataFile);
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
out.close();
// Create JSONObject
JSONParser parser = new JSONParser();
FileReader fileReader = new FileReader(dataFile, StandardCharsets.UTF_8);
Object object = parser.parse(fileReader);
fileReader.close();
JSONObject dataObject = (JSONObject) object;
}
Thank you very much! @avl42
I include truetype font in resources and import it to the application like that:
The application is being develped on linux and everything works great (screenshot below).
But when i run the jar (or compile it from zero) on windows the font is completely broken.
For the fully colored tile i use Û character (Unicode Value U+00db). The font used by me is C64 Pro Mono STYLE from https://style64.org/c64-truetype. I use amazon corretto 17 JDK.
Thank you in advance.