Something simple I came up with, add it in the scale parameter of the text layer:
myWidth = sourceRectAtTime(time).width;
myHeight = sourceRectAtTime(time).height;
MaxWidth = 500;
MaxHeight = 500;
[100*(MaxWidth/myWidth),100*(MaxHeight/myHeight)];
To explain: it reads the width and height of the text layer (sourcerect) then scales it by the ratio compared to the maximum width or height.
You should connect the MaxWidth and MaxHeigth variables to a slider effect, then it would be something like that:
MaxWidth = effect("MaxWidth")("Slider");
If you want only 1 value, you can remove the MaxHeight and then it would be:
[100*(MaxWidth/myWidth),100*(MaxWidth/myHeight)];
Doesn’t seem to be 100% the pixel value, but maybe it’s good enough ☺ (if I find the time I will try to find out why it’s not 100% the given pixel value)