spiderbit / canta

The main public repo for the Canta project - a free karaoke game
http://www.canta-game.org
16 stars 2 forks source link

long song strings are cutted #9

Open glixx opened 11 years ago

glixx commented 11 years ago

Sollution: to calculate width of string run-time and to determine font.

spiderbit commented 11 years ago

A alternate solution for that would be:

but I will try to fix that with your solution.

spiderbit commented 11 years ago

hmm I just tried if the 0.3 changes fixes that, but it dont, but its more fluent version ^^ so would be nice to switch to that version someday anyway ^^.

its a hard bug, if its a bug ^^. if you dont have 3d fonts or something, where you cant define 3d coordinate, you would have to make that calculation on opening a song, you would have to find the longest line, and then calculate maybe a good fond size, you even have to at least make a difference if you use a 16:9 resolution or 4:3 tried to look into that, did not even find font-size in the code, I think even the theme or songs and different fonts could have different sizes.

spiderbit commented 11 years ago

maybe I am just to tired today but its no small mini-fix ^^ I am not shure if or when I fix that lets sleep over it ;)

spiderbit commented 11 years ago

I am not shure about that bug, its a difficult one... yes would be good to fix that... the question is how... if its fixable through some kind of new fonts written through soya3d with 3d coords instead of the widget engine soya.pudding used now. I would push THAT kind of fix in 0.3.0 and call it a feature ^^.

But if I can do the math and the coding to dynamicaly change the font size to the correct size, it could maybe be integrated into the 0.2 tree.

Its difficult to impossible to do... there are so many variables... as example in canta 0.2 theme and song specs you can theme your song or make a normal theme... in this you can put your own fonts... so how could you calculate that when the fonts have different big letters. there are even fonts where not each letter has the same size... so you would have to count how many of what letter is in the line.

I have to look into pudding maybe I can access the lenght of a label in 3d coordinates and lower the text size till its in the broders if its out of screen. or out of the 2d-resolution, better said...

would be nice to fix that old annoying bug.

spiderbit commented 11 years ago

I just tried it, could access the x possition of the last song-segment of the line... so I can detect that there is a line to long... but then I cant redraw it with a smaller font, because I cant on the fly resize a font, you must compile a font with a specific size...

So real ugly solution could be having each font in 100 different sizes... and that works then only with the fonts that comes with canta, as said we have the possibility to come with own themes and even themed songs ^^ with own fonts.

you could play around with the default font-sizes that are defined by resolution here:

https://github.com/spiderbit/canta/blob/master/canta/theme/theme.py#L72

glixx commented 11 years ago

I wanted to change theme.py, but it's don't work if file theme_cfg.xml exists.