Closed vaibhav135 closed 1 year ago
@vaibhav135 The font size on your terminal is defined in you terminal settings. All characters will be that font size.
Add spaces around the title, and change the color to a more prominent contrasting color from the background to help your visibility.
It is usually dependant on how you utilize the colors, space and characters to make your layouts visibily usable. Need not increase font size.
Here is someone using a figlet font module to print large text using ASCII figlet fonts.
https://github.com/vilmibm/gh-chat/blob/1112f5c5d71fe3c0e508cf55724231150a1ddff7/main.go#L20
Here I use my tdfgo library and use tview.TranslateANSI
to parse the output and write it into a textview.
@digitallyserviced @rivo So I tried to show figlet text in textview but couldn't do it properly
Here is the result that I am getting
I tried to follow this code from here -> https://github.com/vilmibm/gh-chat/blob/1112f5c5d71fe3c0e508cf55724231150a1ddff7/main.go#L20
Downloaded the fonts from here -> http://www.figlet.org/fontdb.cgi
P.S. : If possible, can you guys please give an example as to how I can show the figlet text in the cli-application.
I guess you'll want to disable wrapping.
@rivo unfortunately disabling wrapping didn't work. Can you show me an example of how I can use it with textview if possible.
@rivo @digitallyserviced So I was able to show the figlet text in cli using this library. But here is the problem if I print a long sentence (wrapping enabled) the words will crumble into each other and with wrapping enabled it will go out of the screen. How do I make it so that my sentence remain in the screen viewport and don't crumble. Is there anything I am missing?
For simple words :-
For long Sentences (wrapping enabled) :-
For long Sentences (wrapping disabled) :-
You're creating big letters out of characters like slashes, backslashes, and underscores. If you turn on wrapping, tview
will wrap your slashes, backslashes, and underscores. It has no concept of a "big font" like this. Wrapping will always lead to problems like this.
You might have some luck using the WordWrap()
function:
https://pkg.go.dev/github.com/rivo/tview#WordWrap
Wrap your text before you convert it into big letters. But (A) you'll need to know beforehand how many letters can fit your screen and (B) it will fail in some cases because this seems to be a variable-width font so results will not be consistent. For example, the "i" is more narrow than the "G".
You're trying to do something that terminal UIs are not really made for. Maybe you'll want to look into graphical user interfaces? They are much more suited for variable font sizes.
Got it, thanks for the info. I will close this issue now
Hi, I am new to golang and trying to build a simple cli application. I have a question, is it is possible to increase the font-size of the text ? I tried to find anything related to this, but couldn't find any.
P.S: I also looked at a lot of apps that are using
tview
. It seems like none of them are using any title or heading (as in big size text). but rather this box title thing. Is this the norm that we should follow while building cli-application?