tsl0922 / ttyd

Share your terminal over the web
https://tsl0922.github.io/ttyd
MIT License
7.75k stars 870 forks source link

Fonts being displayed incorrectly #1298

Open creeper451 opened 6 months ago

creeper451 commented 6 months ago

When I launch ttyd from the browser in a new tab the fonts gets displayed incorrectly the first time, in order to fix it, you would have to refresh the page every time you launch it in a new tab.

I complied ttyd from source and I added the Caskaydia Cove Nerd Font using the instructions described in the Wiki, and then started the ttyd binary using the following parameters: '-p 6175 -W -t fontSize=15 -t enableSixel=true -t enableZmodem=true -t "fontFamily=My Font" login'

Screenshots:

1 2

Environment:

log of ttyd: log.txt

tsl0922 commented 5 months ago

Maybe because the font was not loaded at the first time. It's required to call fitAddon.fit() after font change:

https://github.com/tsl0922/ttyd/blob/89fb69b4806a30143ffecd18738df7a1ef4213dc/html/src/components/terminal/xterm/index.ts#L449

creeper451 commented 3 months ago

Sorry for my late reply, I checked this line on my machine and its there so... I don't understand what you are trying to say, I named the custom font that I added to the source code "MyFont" should I add it to the end of this line or what?