mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #881] Is it possible to increase the fontSize ? #640
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#640
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @vaibhav135 on GitHub (Sep 4, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/881
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?@vaibhav135 commented on GitHub (Sep 7, 2023):
@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

Here is my code
I tried to follow this code from here ->
github.com/vilmibm/gh-chat@1112f5c5d7/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.
@rivo commented on GitHub (Sep 7, 2023):
I guess you'll want to disable wrapping.
@vaibhav135 commented on GitHub (Sep 7, 2023):
@rivo unfortunately disabling wrapping didn't work. Can you show me an example of how I can use it with textview if possible.
@vaibhav135 commented on GitHub (Sep 8, 2023):
@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?
Here is my new code
Here are the results :-
For simple words :-

For long Sentences (wrapping enabled) :-
For long Sentences (wrapping disabled) :-
@rivo commented on GitHub (Sep 8, 2023):
You're creating big letters out of characters like slashes, backslashes, and underscores. If you turn on wrapping,
tviewwill 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.
@vaibhav135 commented on GitHub (Sep 8, 2023):
Got it, thanks for the info. I will close this issue now