Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: [ELplaylist] $gettextwidth doesn't resemble real width (Read 3452 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[ELplaylist] $gettextwidth doesn't resemble real width

I'm busy with making my own foobar lay-out, but a stumbled upon a problem.

I want the artist name to have a coloured bar behind it. Therefore I need to know the width of the artist name. I used $gettextwidth to get the length, but that doesn't work perfect.
Sometimes the returned amount is to much, sometimes to little.

Does anyone know what the problem could be? Is it maybe dependable on the font I use (calibri, 8 points, bold)?

This is the code I use:
Code: [Select]
$drawrect(8,3,$gettextwidth(%artist%),20,0-84-44,,)

I also found out that multiplying with an amount like 1.2 or 2.5 is impossible, because $mul() seems only to work with integers in combination with $gettextwidth.

[ELplaylist] $gettextwidth doesn't resemble real width

Reply #1
works fine for me (i even changed my font to the one you're using) 




[ELplaylist] $gettextwidth doesn't resemble real width

Reply #2
you need to include the font in it

example: $gettextwidth(%artist%,Calibri,8,bold)


 

[ELplaylist] $gettextwidth doesn't resemble real width

Reply #4
edit: nvm