Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #150, on March 8th, 2012, 03:59 PM »
Oh, I like the fact the size is in the box, just that the text size is bigger than the box it's inside!

I like the font being shown like that, too, looks good.

* Arantor is suddenly reminded of another micro feature he should add.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #151, on March 8th, 2012, 04:04 PM »
Quote from Arantor on March 8th, 2012, 03:59 PM
Oh, I like the fact the size is in the box, just that the text size is bigger than the box it's inside!
Well, the alternative would be to increase the box size dynamically, but it would look even worse because it'd break the layout for the first line of buttons ;)
Quote
* Arantor is suddenly reminded of another micro feature he should add.
Where do we stop? :P

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #152, on March 8th, 2012, 04:33 PM »
Quote
Well, the alternative would be to increase the box size dynamically, but it would look even worse because it'd break the layout for the first line of buttons
Hmm, good point!
Quote
Where do we stop?
hahahahahahahahahahahahahahahahahahahahahhaah

Actually this one's really simple and will mean I can commit something useful this afternoon rather than wading through more FTP crap.
Posted: March 8th, 2012, 04:07 PM

And presto, micro-feature.

📎 font_list.png - 25.57 kB, 625x311, viewed 149 times.


Dr. Deejay

  • Happy new year all!
  • Posts: 118
Re: Selectbox
« Reply #153, on March 8th, 2012, 04:37 PM »
Nice :D

billy2

  • Trying to earn brownie points for a lads trip to the Red Sea. Minus 1 already - just for asking!!
  • Posts: 350
Re: Selectbox
« Reply #154, on March 8th, 2012, 05:01 PM »
A stroke of genius
 :wow:
<br /><br />cough, cough.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #155, on March 8th, 2012, 05:11 PM »
Pete probably got scared when I removed so many of The fonts :P
Re: Selectbox
« Reply #156, on March 8th, 2012, 05:48 PM »
Re: font code

Code: [Select]
$fonts = explode("\n", $settings['editorFonts']);
foreach ($fonts as $k => $v)
if (trim($v) == '')
unset($fonts[$k]);
else
$fonts[$k] = trim($v);

Dunno which is faster, probably my solution because it only applies trim once -- I'd like to suggest a one-line replacement (it's one of my things, you know it too well...):

Code: [Select]
$fonts = array_filter(array_map('trim', explode("\n", $settings['editorFonts'])));

The array_map will call trim() on all members, and array_filter() with no callback function will remove anything that looks like '0', 0, false, 'false' and empty strings. Since there are no fonts called '0' or 'false', it'll simply remove the empty lines. :)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #157, on March 8th, 2012, 05:52 PM »
Heh, that works. The extra trim came about because I wasn't thinking so clearly at the time of originally writing it, and yes that would be an improvement.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #158, on March 8th, 2012, 06:22 PM »
Could even ensure that comma separated fonts will be taken into account... ;)
(Heck, I wrote such a feature yesterday for the upcoming <languages> tag in skin.xml... Hopefully to be committed today.)
I'll do that at the same time.
Re: Selectbox
« Reply #159, on March 8th, 2012, 06:26 PM »
Heck, I'll just copy it from my code :P

Code: [Select]
if (strpos($set, '</languages>') !== false && preg_match('~<languages>(.*?)</languages>~s', $set, $match))
$context['skin_available_languages'] = array_filter(array_map('trim', preg_split('~[\s,]+~', $match[1])));

As you can see, I only need to rename $match[1] to your $settings var... :P
I'll probably do without the array_filter in the code above, though, because come to think of it, I'm only doing a single in_array() call on it, so it won't care whether there are empty lines or not...