I just created a "count" filter which WOULD help with this, but your idea is not well thought through. Imagine I have a 3 counts: 1, 10 and 100. The resulting sizes would be: "1.1em", "1.10em" and "1.100em". Would you be able to tell the difference? ;)
For completeness sake, this is the source of my count filter:
/*\
title: $:/core/modules/filters/count.js
type: application/javascript
module-type: filteroperator
Filter operator that gives the counts the current list's members
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.count = function(source,operator,options) {
// count the source if it's not an array
var count = 0;
if(!$tw.utils.isArray(source)) {
$tw.utils.each(source,function(element,title) {
++count;
});
return [ "" + count ];
}
// return array's length
return [ "" + source.length ];
};
})();
used like this (using your request)
\define mySize()
"font-size:$(cnt)$em"
\end