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: Track Info Panel with ability to change font (Read 752440 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Track Info Panel with ability to change font

This is a modified foo_uie_trackinfo which uses a differet display function, which allows for different fonts / alignment.

Example screenshot:



and the code from the example:

Code: [Select]
$if(%_trackinfo_notrack%,
Stopped,

$align(left,top)
$font(forte,15,shadow,255-255-255)%title%$char(10)
$font(,12,,64-0-0)%album% ['['%date%']']$char(10)
$rgb(0,64,0)%artist%$char(10)
$rgb(64,0,0)%composer%test$char(10)

$align(right,bottom)
$font(Verdana,10,,0-0-0)%__codec%@%__bitrate%$char(10)
[%playback_time% / ]%length%

$align(left,bottom)
$font(Wingdings 2,13,,)
$if(%rating%,
$select(%rating%,
$rgb(155,0,0)ê,
êê,
êêê,
êêêê,
$rgb(0,155,0)êêêêê),
$rgb(155,155,155)ê)
)


This is very much still a beta, so please beware of bugs.

Download here.

For documentation, please refer to the wiki. (thanks to FofR, Sw!ng, and the other contributors).

Requires:

MS Visual C++ 2005 Runtime Library
GDI+ - only needed for Windows 2000

Track Info Panel with ability to change font

Reply #1
Is it possible to use the scrolling feature only on a certain portion of the trackinfo?
With the standard trackinfo, no way.


hey guys...
I have modified trackinfo a little bit to support mixing of different fonts/styles.
Sounds interesting. Will try and report ASAP.

I had to remove some stuff (scrolling, alignment support), but otherwise this is the same as the original. This is my first plugin in for foobar, so beware
Happily, I don't need these, so if your plugin works, it fits my needs perfectly.

I assume the 0-0-0 is R-G-B values?

You PM creator of trackinfo and coordinate your development. Or if that is not possible, change the name so that people will not confuse your trackinfo and the 'standard' trackinfo.

Track Info Panel with ability to change font

Reply #2
Would it be possible for you to change your font code to me more consistent with TAGZ? IE:

'#FONT,tahoma,14,BOLD,0-0-0#'

would become

$font(tahoma,14,bold,$rgb(0,0,0))



Just a suggestion.

Track Info Panel with ability to change font

Reply #3
made a couple of bug fixes, and other changes:

example screenshot:
[a href="http://imageshack.us" target="_blank"]

Track Info Panel with ability to change font

Reply #4
First off I'd like to thank you for continuing the development of this popular plugin. There are, however, a few issues I'd like to point out.

1) No Default Font.  Absolutely no text will appear unless a $font() is defined. So if you have code such as:
Code: [Select]
%album artist% - $font(tahoma,14,,0-0-0)%title%

You will see the title but not the artist. Perhaps you could reimplement the old font settings in the configuration, and use that as the default font. Also, the font appears to reset on every line of code. So unless you define a font at the beginning of every line text will disappear.

2) Inconsistent Font Size.  If I use the function $font(tahoma,8,,0-0-0), text appears significantly smaller than when I choose Tahoma 8pt in other components.


3) Broken $rgb().  Both colors in the format of $rgb(0,0,0) and 000000 no longer appear and are displayed as normal text.  The color can be redefined with a $font() command but this requires everyone to rewrite their existing code. Also, a simple $font(,,,0-0-0) does not work as apparently the $font() function requires an actual font to be specified.

4) Broken $tab().  The use of $tab() appears to simply bump the text to the next tabstop instead of the allignment behavior found in other foobar components. I am unable to figure out a way to right-allign text using this version of trackinfo.


On the other hand, I was pleasantly surprised to see that despite being a component of a different name and chosing not to save the settings for the old component, your component successfully inherited all my existing settings and code from the old component. Also, thank you for changing your font code format to be more consistent with TAGZ :)

Using multiple fonts in the same panel is definitely an improvement for this component, however I think some more development is in order for myself (and I would assume many others) to make the switch. Keep up the good work!

Track Info Panel with ability to change font

Reply #5
Thanks for your comments

1) No Default Font.  Absolutely no text will appear unless a $font() is defined. So if you have code such as:
Code: [Select]
%album artist% - $font(tahoma,14,,0-0-0)%title%


Yes, there needs to be a $font in the beginning and after every $align. I will bring back the font dialog and use that as the default.

Quote
2) Inconsistent Font Size.  If I use the function $font(tahoma,8,,0-0-0), text appears significantly smaller than when I choose Tahoma 8pt in other components.


I am using the font size in pixels, whereas others are using point sizes... I think I can convert to make it more consistant.

Quote
3) Broken $rgb().  Both colors in the format of $rgb(0,0,0) and 000000 no longer appear and are displayed as normal text.  The color can be redefined with a $font() command but this requires everyone to rewrite their existing code. Also, a simple $font(,,,0-0-0) does not work as apparently the $font() function requires an actual font to be specified.


can be fixed also

Quote
4) Broken $tab().  The use of $tab() appears to simply bump the text to the next tabstop instead of the allignment behavior found in other foobar components. I am unable to figure out a way to right-allign text using this version of trackinfo.


unfortunately, this will not be easy to change, since this display system is completly different from the regular one. However, you should be able to achieve the same effect (with even more flexability) by using something like this:

Code: [Select]
$align(left,top)
$font(tahoma,11,,0-0-0)
This text will appear at the top left
$align(right,bottom)
$font(tahoma,11,,0-0-0)
This text will appear at the bottom right

Track Info Panel with ability to change font

Reply #6
2 suggestions:

1.
Please provide a readme.txt too to describe the difference with the old trackinfo, including new commands, how to align, change font, etc. Then put the readme.txt in a zip alongside the new .dll, and presto.

2.
Saving of not only trackinfo text, but also default font, default (background) color, etc. So just in case I screwed up my trackinfo, I only need to reload a .titagz file (or whatever extension) to restore. No need to fiddle manually the background color, fontsize, scroll speed, etc. like the older trackinfo.

Track Info Panel with ability to change font

Reply #7
terrestrial - amazing work, thank you so much for working on this plugin. few questions though:
  • is it possible to change fonts / sizes even on one line, or is it one style per line only?
  • [done: still $font with different arity and specialized style functions could be handy] i would like to be able to change only for example font, size or style, not everything ... does $font(,11,,) work like this? maybe you could add support for multiple $font functions with different arity, like $font(fontname), $font(fontname, style), $font(fontname, style, size). also $size and functions for quick bold / italics / underline would be great - maybe as $b() - or $b(text to be bold).
  • could you support custom info (foo_custominfo)?
  • [done] ability to disable / enable antialiasing or cleartype. some fonts work well only without it. this could be set in the configuration dialog
  • [done] when i change tracks (or during normal playback), when foobar is moving onto new song, there's registrable period of time when trackinfo thinks (probably properly), that there's no song playing - so it reacts to this (redraws itself) with the formatting having no song info available (which in my case means mostly that i do not output anything). this is distracting me *a lot*. could you find some workaround for this, please?
  • extra feature would be to be able to 'measure' text's width (in pixels or % of available space), would that be possible? something like $fontwidth(fontname,style,size,text to measure) or $fontwidth(text to measure using current style).
thoughts, anyone ...
[edit] i tried your version and stroked out things that already work ...


Track Info Panel with ability to change font

Reply #9
Bug
In the latest foobar beta multiple trackinfo fields no longer work.

Track Info Panel with ability to change font

Reply #10
  • i would like to be able to change only for example font, size or style, not everything ... does $font(,11,,) work like this? maybe you could add support for multiple $font functions with different arity, like $font(fontname), $font(fontname, style), $font(fontname, style, size). also $size and functions for quick bold / italics / underline would be great - maybe as $b() - or $b(text to be bold).
added. stuff like $font(,,bold,) should work now.
Quote
  • ability to disable / enable antialiasing or cleartype. some fonts work well only without it. this could be set in the configuration dialog
added (although I haven't tested it). add nocleartype to the option to disable cleartype.

Quote
  • when i change tracks (or during normal playback), when foobar is moving onto new song, there's registrable period of time when trackinfo thinks (probably properly), that there's no song playing - so it reacts to this (redraws itself) with the formatting having no song info available (which in my case means mostly that i do not output anything). this is distracting me *a lot*. could you find some workaround for this, please?
fixed.

Quote
  • extra feature would be to be able to 'measure' text's width (in pixels or % of available space), would that be possible? something like $fontwidth(fontname,style,size,text to measure) or $fontwidth(text to measure using current style).
I do this internally, but why would you need the values exposed?


i would like to be able to change only for example font, size or style, not everything ... does $font(,11,,) work like this? maybe you could add support for multiple $font functions with different arity, like $font(fontname), $font(fontname, style), $font(fontname, style, size). also $size and functions for quick bold / italics / underline would be great - maybe as $b() - or $b(text to be bold).

added. stuff like $font(,,bold,) should work now.
Quote
ability to disable / enable antialiasing or cleartype. some fonts work well only without it. this could be set in the configuration dialog

added (although I haven't tested it). add nocleartype to the option to disable cleartype.

Quote
when i change tracks (or during normal playback), when foobar is moving onto new song, there's registrable period of time when trackinfo thinks (probably properly), that there's no song playing - so it reacts to this (redraws itself) with the formatting having no song info available (which in my case means mostly that i do not output anything). this is distracting me *a lot*. could you find some workaround for this, please?

fixed.

Quote
extra feature would be to be able to 'measure' text's width (in pixels or % of available space), would that be possible? something like $fontwidth(fontname,style,size,text to measure) or $fontwidth(text to measure using current style).

I do this internally, but why would you need the values exposed?

New version can be found here

Track Info Panel with ability to change font

Reply #11
Thanks for fixing the multiple fields bug so quickly

EDIT: Your new feature $font(,,bold,) doesn't work though. Makes the text disappear.

Track Info Panel with ability to change font

Reply #12
Wow thanks for the quick update and thank you for correcting most of the issues I previously mentioned. I installed your latest update and after a few minor code edits I have made the switch. Still still remains a few issues I'd like to mention.

1) With other components, we can use $rgb() with no parameters or double color escape code to reset the text color to the default.  It was easy enough for me to change my $rgb() to $rgb(0,0,0) but otherwise existing code will not work. Would you perhaps consider re-implementing the configuration for the default text color and allow $rgb() or double color escape to reset the text to that color?

2) Bold and Italic on the default font is ignored. Also, $rgb(,,bold,) and $rgb(,,italic,) does not work as expected, instead it changes the text to some totally different font setting (is it filling in the blanks with something?)

3) $align() appears to be buggy, or I am not using it properly. If I use $align(right,) at the beginning of every line like this:

$align(right,)Text line one.$char(10)
$align(right,)Text line two.$char(10)

instead of seeing two lines right alligned, the lines are overlapped on top of each other. This can be corrected with $align(right,top) $align(right,center) $align(right,bottom) but that only fixes up to three lines of aligned text.  After playing around a bit I discovered that the $align() is inherited from one line to another so I can replace the code with:

$align(right,)
Text line one.$char(10)
Text line two.$char(10)

which IMO is actually more efficient code, however with people migrating from the old $tab() system you may want to implement some code to allow for the first example.

There also appears to be something wrong with $align(center,). When using this on multi-line text like this:

Text line one.$char(10)
$align(center,)Text line two.$char(10)

the second line is indeed centered, however the text appears overlapped onto the first line instead of appearing on the second line as expected.  I corrected this by using $align(center,bottom) but as stated before this approach will only help with up to three lines of aligned text.

You have corrected most of the major obsticals and I think that if you could atleast correct the first issue most legacy trackinfo code should migrate, requiring the end user to only to change their $tab() alignments o $align(). Again, keep up the good work!

Track Info Panel with ability to change font

Reply #13
Is this version of trackinfo a branch or just a update in features?

Any links to it? Any requirements?

Track Info Panel with ability to change font

Reply #14
Yotsuya

1) the way $align works right now is, as you found out, like this:

text flows from top-left corner; when new $align is encountered, the reference point / alignment is changed according to it. with this system, you can't truly make lines with both left and right aligned text. you can, though put some text on the left (even on multiple lines) and then put different text on the right. these two texts do not interact though, so they can overlap etc (which may be handy in some cases and not in others).

i think that the logical extension to $align would be to allow inherit-vertical-position mode, when for example $align(right,) would put text to the right border, but stay on the same vertical position as the last text rendered. another would be to allow pixel adjustments to the point's position like this: $align(center-1,top) or $align(+10,20) etc. +/- sign would mean relative adjustment; you could also specify those keywords like center etc. with this system. it would be possible to do quite a few effects including any-size line spacing, pseudo text shadows etc. i think that the way this track info mod works, it opens possibility to even more things in the future, like placement of images

with the current implementation you could do some interesting stuff though, like this:



1) could you please read what i posted in response to Yotsuya? there are still some things broken with the $font when omitting some parameters. plus only 'bold' works for me.

2) that size measuring - i would use it to detect if i can fit some text into the panel (for example when i show some, possibly long, text in one line only). if not, i could skip some parts or show it with smaller font (which is possible with your mod  )

3) as it is now, when text doesn't fit, it flows (wraps) to the next line. there are cases though, when there won't be space on the next line either - like when the word is wider than the width of the panel. i would like to be able to sometime somehow disable wrapping / clipping and show what fits.

4) somehow related to 3) and also to that $align +/- stuff mentioned in the response to Yotsuya. some fonts especially at bigger sizes have quite some space (vertically) around glyphs and it doesn't look right with regards to panel's borders. i would like to compensate for this by using for example $align(left,-3), but that would have to make sure the text as whole wouldn't get rejected as it's not starting inside the panel's boundaries (or is taller than panel's height).

5) this is much off the current scope of track info panel and you (or others) may disagree to go this way (which is fine by me), but it could be interesting to add settings for left / right / double click actions (so one could set it to different commands, not only to switch between playing / focused mode.

advanced possibility would be to define 'regions' in the formatting, either by $region(x,y,width,height,action) like $region(0,0,10,10,playback\cursor follows playback) or $region(text,action) like $region($ifgreater(%rating%,0,+,-),custom info\rate 1)$region($ifgreater(%rating%,1,+,-),custom info\rate 2) ... the latter example could make rating by simply clicking on corresponding symbol.

note: i somehow like that $font takes size parameter in pixels, as it allows much more accurate size setting for some 'pixel' ttf fonts.

Is this version of trackinfo a branch or just a update in features?

Any links to it? Any requirements?

i would say it's more of a branch, as it takes different approach to text positioning and other major issues. link has been posted by terrestrial, the author. it's here. it needs some later 0.9.x version of foobar.

there's also another work-in-progress track info project here, which is more focused on bug fixing (at the moment) the previous official track info panel.

Track Info Panel with ability to change font

Reply #15
i would say it's more of a branch, as it takes different approach to text positioning and other major issues. link has been posted by terrestrial, the author. it's here. it needs some later 0.9.x version of foobar.

there's also another work-in-progress track info project here, which is more focused on bug fixing (at the moment) the previous official track info panel.


Thanks for posting the links! It took me a while find them for foobar 0.9

Track Info Panel with ability to change font

Reply #16
Ok, new version with bug fixes and some additions.

mazy is correct about the way $align works, but I've also added in a "compatibility" mode that should achieve the same effect as the original.

Quote
with the current implementation you could do some interesting stuff though, like this:


interesting  although, it technically shouldn't overlap as the code is supposed to move things out of the way, but I like the idea so I'll have to add in the ability to do this.

Quote
it would be possible to do quite a few effects including any-size line spacing, pseudo text shadows etc.


any-size line spacing is already there but I haven't exposed the function. As for shadows, try adding "shadow" to the font options.

Quote
that size measuring - i would use it to detect if i can fit some text into the panel (for example when i show some, possibly long, text in one line only). if not, i could skip some parts or show it with smaller font (which is possible with your mod  )


I eventually want to add different line ending styles, instead of just wrapping (including some sort of "fit" where the font sizes will be adjusted to fit the text). The idea of showing different text is interesting, though... I'll have to think about how best to implement this.

#4 is on the todo list already, and #5 is interesting... I like the idea of having "buttons" to preform actions, but it may take a while before I have the chance to add it in

Track Info Panel with ability to change font

Reply #17
I received this failure notice from FB2K_v0.9.3b4:

Failed to load DLL: foo_uie_trackinfo_mod.dll
Reason: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

The last version (foo_uie_trackinfo_v0.8) has no problems loading. Was this new mod version created differently? Generally, I get this failure notice due to not having the proper library files. If so, can you let me know which library files are needed? Thank you.
Surf's Up!
"Columnated Ruins Domino"

Track Info Panel with ability to change font

Reply #18
I know someone said that the font sizes where all wrong in the last version, and now you "fixed it". But they where correct in the old version. Now they are wrong. In columns ui and playlist dropdown my font is set to Tahoma 8, in trackinfo the font has to be set to 10 to be the same size as the rest of Foobar. In the version before this one I had the font size set to 8 witch was the same size as everything else.

Btw. Thanks for continuing the development on this component. Keep up the good work.

Track Info Panel with ability to change font

Reply #19
@terrestrial: Now that you have your own thread  ... can you change the link on the first post? It still links to foo_uie_trackinfo.dll . I do think you have renamed your .dll to foo_uie_trackinfo_mod.dll, right?

Edit: Even better if you totally change the first posting like you're announcing a new plugin, e.g. the right download link, state the latest release date, version, etc.

Track Info Panel with ability to change font

Reply #20
terrestrial, thanks for fixes! that shadow stuff is nice hidden feature, i see you think a lot ahead of us . i'm going to report few bugs though.

1) as for style, i can make bold, italics and nocleartype work. underline and strikeout not.

2) also there are some problems with $font interfering with color codes etc. examples:

C8C8C8$font(Charriot Deluxe,9,nocleartype,)artist - the $font resets color to default one. i would think it should stay at the last color set.

$font(Charriot Deluxe,9,nocleartype,)C8C8C8artist - that color code resets anything related to font, so "artist" shows with the default font and style (ignoring everything in the $font, nocleartype including).

imho as with $rgb() returing to default color, maybe $font() could set (return to) the default font too.

Track Info Panel with ability to change font

Reply #21
Nice to see this component is continuing to evolve.

This last release is a considerable improvement and now legacy code appears to migrate with the exception of the alignments.

I think I need a little more practice with the $align() system though.  Is there a way to have a line of text right justified without pushing the text to the top or bottom of the box, and without relying on the alignment of the line before it?  I tried:
Code: [Select]
$align(left,)Text line one.$char(10)
$align(right,)Text line two.$char(10)
But both lines of text appear on the top line. I tried putting numerical values in the second parameter of $align()  but that did not appear to make much dfference. Also, $align(right,) appears to break if it comes after an $align(center,). For example I was trying to create three columns of text:
Code: [Select]
$align(left,)one$align(center,)two$align(right,)three
but the second and third columns get grouped together.

As mil3s already indicated, font sizes appear to have reverted back to the "pixel" size instead of the "point" size you corrected in the last release.

I'd also like to second mazy's request to be able to pull the pixel length of a string of text, and also the height and width of the infobox if possible, I can see how it can be very useful with long song names. Using the $len() function does not really account for different width letters, especially when doublebyte characters are involved.  I'm currently trying to write an infobox that will change font sizes to accomodate different lenghths of song names and this is what I came up with.  I currently rely on static offsets I found with trial/error but it would be much nicer if I could use dynamic offsets computed from the panel and font sizes.. so I can change fonts or resize the panel without rewriting the code:



Code: [Select]
$ifgreater($len(%artist%%title%%album%%date%),45,$font(,12,Bold,),$font(,16,Bold,))
$align(left,)$rgb(233,233,233)$if(%artist%,%artist% $rgb(0,128,255)$char(47)$rgb(233,233,233)  ,)$if2(%title%,)

$ifgreater($len(%artist%%title%%album%%date%),45,$char(10)$align(right,bottom),$align(right,))
$if($strcmp($left(%path%,7),http$char(58)$char(47)$char(47)),,
$ifgreater($len(%artist%%title%%album%%date%),82,$font(,9,,),$font(,,,))
$rgb(180,180,180)$if2(%album%,)$if(%date%, $rgb(0,128,255)$char(40)$rgb(180,180,180)%date%$rgb(0,128,255)$char(41),)
)

Edit: Also, bold still does not appear to work from either the default font or with $font().

Track Info Panel with ability to change font

Reply #22
I received this failure notice from FB2K_v0.9.3b4:

Failed to load DLL: foo_uie_trackinfo_mod.dll
Reason: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

The last version (foo_uie_trackinfo_v0.8) has no problems loading. Was this new mod version created differently? Generally, I get this failure notice due to not having the proper library files. If so, can you let me know which library files are needed? Thank you.


it needs the C runtime library for vs .net 2005 (msvcr80.dll I think). Do you have this file in your system?

--------

The font sizes used to be pixel sizes, but now are point sizes. To convert between them you can use this formula: pixels = points*dpi/72 (where dpi is normally 92). Point size seems to be consistent with Columns UI and everything else, at least to me. Are you sure you have the latest version?

--------

The underline / strikeout have been added, and the font / color issues have been fixed. There may still be some glitches, and if so, please let me know

Track Info Panel with ability to change font

Reply #23
Thank you very much for your development efforts.

But I get the same mistake as drbeachboy. I have msvr80.dll in my system32 folder.

One suggestion: the ability to autoscroll like in Winamp (at least in the 2.8 version I was using), not only on line ending

Track Info Panel with ability to change font

Reply #24
are you guys running the latest version of foobar (0.9x)?