It is currently March 28th, 2024, 6:49 pm

Auto font size change based on character count

Get help with creating, editing & fixing problems with skins
the_metal_lord
Posts: 27
Joined: April 3rd, 2018, 12:50 pm

Auto font size change based on character count

Post by the_metal_lord »

Hi!
Is it possible to automatically adjust font size based on the number of letters in the string? Like, if there's 20 letters than font size will be 80, if there's 100 letters font size will be 20 and adjust the numbers in between.
[MeasureFile]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#CURRENTPATH#Quotes.txt
UpdateDivider=300

[Calculation]
Measure=Calc
Formula=1
DynamicVariables=1
RegExpSubstitute=1
Substitute="1":"[MeasureFile]<20?"80":"100"

;-----------------------------
[MeterFile]
Meter=STRING
MeasureName=MeasureFile
StringAlign=Center
FontSize=Calculation
DynamicVariables=1
Pretty sure the [Calculation] I've written there is totally wrong. :(
Last edited by the_metal_lord on December 3rd, 2019, 7:42 am, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Auto font size change

Post by mak_kawa »

I think, maybe there is no way to directly get numbers of letters in the string. Not sure I am right...But anyway, I have tried indirest way of "Auto font size change".

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=128,128,128,192

[Variables]
BaseFontSize=24
TextString1=aaaaa
TextString2=aaaaabb
TextString3=aaaaabbbbb

[TextMeter1]
Meter=String
FontColor=0,0,0,255
X=0
Y=0
FontSize=#BaseFontSize#
Text=#TextString1#

[DummyTextMeter2]
Meter=String
X=0
Y=0
FontSize=#BaseFontSize#
FontColor=0,0,0,1
Text=#TextString2#

[DummyTextMeter3]
Meter=String
X=0
Y=0
FontSize=#BaseFontSize#
FontColor=0,0,0,1
Text=#TextString3#

[TextLength1]
Measure=Calc
Formula=[TextMeter1:W]
DynamicVariables=1

[TextLength2]
Measure=Calc
Formula=[DummyTextMeter2:W]
DynamicVariables=1

[TextLength3]
Measure=Calc
Formula=[DummyTextMeter3:W]
DynamicVariables=1

[TextFontSize2]
Measure=Calc
Formula=Round(#BaseFontSize#*([TextLength1]/[TextLength2]))
DynamicVariables=1

[TextFontSize3]
Measure=Calc
Formula=Round(#BaseFontSize#*([TextLength1]/[TextLength3]))
DynamicVariables=1

[TextMeter2]
Meter=String
FontColor=255,255,255,255
X=0
Y=30
FontSize=[TextFontSize2]
Text=#TextString2#
DynamicVariables=1

[TextMeter3]
Meter=String
FontColor=255,255,255,255
X=0
Y=55
FontSize=[TextFontSize3]
Text=#TextString3#
DynamicVariables=1
That is, this skin gets width of string meter from its section variable [(meter name):W], and calculates font size to show with equivalent string width. The result of this method is as follows.
Untitled-1.png
Probably, relation of letter numbers and its display width is not proportional, depends on font species and contents of the string. So, strict size matching is impossible. But anyway, this result is somehow reasonable?
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Auto font size change

Post by balala »

the_metal_lord wrote: November 27th, 2019, 6:16 am Pretty sure the [Calculation] I've written there is totally wrong. :(
Beside mak_kawa's solution, you have to know that yes, your code is definitely wrong, because:
  • The [MeasureFile] section variable doesn't return the length of the string returned by the measure, but the measure itself.
  • Even if it would do, you can't use formulas into the Substitute option. This option substitutes a string by another string, no calculations allowed.
  • Looking further, even if the [Calculation] measure would return a font size properly, the FontSize option of the [MeterFile] meter wouldn't work, because Calculation should be set as a section variable: FontSize=[Calculation].
What have you asked (getting the length of a string), in most cases can be done through a lua script. Such a script is versatile enough to properly return the length of a string. But if those strings are not too long, this can be done even with a native Rainmeter code.
What you need is a String measure, which converts all characters of the string into 0s, excepting the first one, which is converted to a 1. This way you get a number which represents the string. Using a base 10 logarithm function, you can get the number of characters into the string.
There is one single limitation: the string can't be longer then 309 characters, otherwise the skin fails.
Here is an example:

Code: Select all

[Rainmeter]
Update=-1
AccurateText=1

[Variables]
Text=This is a longer string, for testing purposes. It has 100 characters, but if needed, you can further ones, extending the string as much as you want, supposing you don't exceed 309 characters.

[MeasureString]
Measure=String
String=#Text#
RegExpSubstitute=1
Substitute="(.)":"0","^(.)":"1"

[MeasureLength]
Measure=Calc
Formula=( 1 + Log ( [MeasureString] ))
Substitute="inf":"too many"
DynamicVariables=1

[MeasureSize]
Measure=Calc
Formula=( 1600 / [MeasureLength] )
DynamicVariables=1

[MeterString]
Meter=STRING
MeasureName=MeasureLength
MeasureName2=MeasureSize
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=(1600/[MeasureLength])
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Text##CRLF#------------------------------#CRLF#Length of string above: %1 characters#CRLF#Size: %2
DynamicVariables=1
As you can see [MeasureString] converts all characters of the string into 0s, excepting the first one, which is converted into an 1. After this,
[MeasureLength] returns the length of the string, calculating the base 10 logarithm of the number returned by the above [MeasureString] measure.
The value returned by the [MeasureLength] measure is used to calculate the font size of the [MeterString] meter. As the string has more and more characters, the font size decreases even more.
the_metal_lord
Posts: 27
Joined: April 3rd, 2018, 12:50 pm

Re: Auto font size change

Post by the_metal_lord »

balala wrote: November 27th, 2019, 6:52 pm Beside mak_kawa's solution, you have to know that yes, your code is definitely wrong, because:
  • The [MeasureFile] section variable doesn't return the length of the string returned by the measure, but the measure itself.
  • Even if it would do, you can't use formulas into the Substitute option. This option substitutes a string by another string, no calculations allowed.
  • Looking further, even if the [Calculation] measure would return a font size properly, the FontSize option of the [MeterFile] meter wouldn't work, because Calculation should be set as a section variable: FontSize=[Calculation].
What have you asked (getting the length of a string), in most cases can be done through a lua script. Such a script is versatile enough to properly return the length of a string. But if those strings are not too long, this can be done even with a native Rainmeter code.
What you need is a String measure, which converts all characters of the string into 0s, excepting the first one, which is converted to a 1. This way you get a number which represents the string. Using a base 10 logarithm function, you can get the number of characters into the string.
There is one single limitation: the string can't be longer then 309 characters, otherwise the skin fails.
Here is an example:

Code: Select all

[Rainmeter]
Update=-1
AccurateText=1

[Variables]
Text=This is a longer string, for testing purposes. It has 100 characters, but if needed, you can further ones, extending the string as much as you want, supposing you don't exceed 309 characters.

[MeasureString]
Measure=String
String=#Text#
RegExpSubstitute=1
Substitute="(.)":"0","^(.)":"1"

[MeasureLength]
Measure=Calc
Formula=( 1 + Log ( [MeasureString] ))
Substitute="inf":"too many"
DynamicVariables=1

[MeasureSize]
Measure=Calc
Formula=( 1600 / [MeasureLength] )
DynamicVariables=1

[MeterString]
Meter=STRING
MeasureName=MeasureLength
MeasureName2=MeasureSize
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=(1600/[MeasureLength])
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Text##CRLF#------------------------------#CRLF#Length of string above: %1 characters#CRLF#Size: %2
DynamicVariables=1
As you can see [MeasureString] converts all characters of the string into 0s, excepting the first one, which is converted into an 1. After this,
[MeasureLength] returns the length of the string, calculating the base 10 logarithm of the number returned by the above [MeasureString] measure.
The value returned by the [MeasureLength] measure is used to calculate the font size of the [MeterString] meter. As the string has more and more characters, the font size decreases even more.
How to apply this here?

Code: Select all

[Rainmeter]
Update=1000
UseD2D=1
AccurateText=1
DynamicWindowSize=1

[MeasureFile]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#CURRENTPATH#Quotes.txt
Subfolders=0
UpdateDivider=300
Substitute="---":"#CRLF#"

[MeasureFontFace]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#CURRENTPATH#FontFace 2.txt
RegExpSubstitute=1
Substitute="\r":"","\n":""
UpdateDivider=300
;-----------------------------

[MeterFile]
Meter=STRING
MeasureName=MeasureFile
StringAlign=Center
X=(#WORKAREAWIDTH# / 2)
Y=20
W=(#WORKAREAWIDTH# - 150)
H=#WORKAREAHEIGHT#
FontFace=[MeasureFontFace]

FontSize=50

FontColor=250,250,250,125
FontEffectColor=90,90,90,25
StringEffect=Shadow
Clipstring=2
DynamicVariables=1
AntiAlias=1
User avatar
Yamajac
Posts: 134
Joined: June 30th, 2014, 8:44 am

Re: Auto font size change

Post by Yamajac »

Got a bit of a silly solution to the problem.

Code: Select all

[DoIt2]
Measure = String
DynamicVariables=1
String = TestStringFo#CRLF#rTesting
RegExpSubstitute = 1
Substitute = "(?s)^(.{1})$" : "1", "(?s)^(.{2})$" : "2", "(?s)^(.{3})$" : "3", "(?s)^(.{4})$" : "4", "(?s)^(.{5})$" : "5", "(?s)^(.{6})$" : "6", "(?s)^(.{7})$" : "7", "(?s)^(.{8})$" : "8", "(?s)^(.{9})$" : "9", "(?s)^(.{10})$" : "10", "(?s)^(.{11})$" : "11", "(?s)^(.{12})$" : "12", "(?s)^(.{13})$" : "13", "(?s)^(.{14})$" : "14", "(?s)^(.{15})$" : "15", "(?s)^(.{16})$" : "16", "(?s)^(.{17})$" : "17", "(?s)^(.{18})$" : "18", "(?s)^(.{19})$" : "19", "(?s)^(.{20})$" : "20", "(?s)^(.{21})$" : "21", "(?s)^(.{22})$" : "22", "(?s)^(.{23})$" : "23", "(?s)^(.{24})$" : "24", "(?s)^(.{25})$" : "25", "(?s)^(.{26})$" : "26", "(?s)^(.{27})$" : "27", "(?s)^(.{28})$" : "28", "(?s)^(.{29})$" : "29", "(?s)^(.{30})$" : "30", "(?s)^(.{31})$" : "31", "(?s)^(.{32})$" : "32", "(?s)^(.{33})$" : "33", "(?s)^(.{34})$" : "34", "(?s)^(.{35})$" : "35", "(?s)^(.{36})$" : "36", "(?s)^(.{37})$" : "37", "(?s)^(.{38})$" : "38", "(?s)^(.{39})$" : "39", "(?s)^(.{40})$" : "40", "(?s)^(.{41})$" : "41", "(?s)^(.{42})$" : "42", "(?s)^(.{43})$" : "43", "(?s)^(.{44})$" : "44", "(?s)^(.{45})$" : "45", "(?s)^(.{46})$" : "46", "(?s)^(.{47})$" : "47", "(?s)^(.{48})$" : "48", "(?s)^(.{49})$" : "49", "(?s)^(.{50})$" : "50", "(?s)^(.{51})$" : "51", "(?s)^(.{52})$" : "52", "(?s)^(.{53})$" : "53", "(?s)^(.{54})$" : "54", "(?s)^(.{55})$" : "55", "(?s)^(.{56})$" : "56", "(?s)^(.{57})$" : "57", "(?s)^(.{58})$" : "58", "(?s)^(.{59})$" : "59", "(?s)^(.{60})$" : "60", "(?s)^(.{61})$" : "61", "(?s)^(.{62})$" : "62", "(?s)^(.{63})$" : "63", "(?s)^(.{64})$" : "64", "(?s)^(.{65})$" : "65", "(?s)^(.{66})$" : "66", "(?s)^(.{67})$" : "67", "(?s)^(.{68})$" : "68", "(?s)^(.{69})$" : "69", "(?s)^(.{70})$" : "70", "(?s)^(.{71})$" : "71", "(?s)^(.{72})$" : "72", "(?s)^(.{73})$" : "73", "(?s)^(.{74})$" : "74", "(?s)^(.{75})$" : "75", "(?s)^(.{76})$" : "76", "(?s)^(.{77})$" : "77", "(?s)^(.{78})$" : "78", "(?s)^(.{79})$" : "79", "(?s)^(.{80})$" : "80", "(?s)^(.{81})$" : "81", "(?s)^(.{82})$" : "82", "(?s)^(.{83})$" : "83", "(?s)^(.{84})$" : "84", "(?s)^(.{85})$" : "85", "(?s)^(.{86})$" : "86", "(?s)^(.{87})$" : "87", "(?s)^(.{88})$" : "88", "(?s)^(.{89})$" : "89", "(?s)^(.{90})$" : "90", "(?s)^(.{91})$" : "91", "(?s)^(.{92})$" : "92", "(?s)^(.{93})$" : "93", "(?s)^(.{94})$" : "94", "(?s)^(.{95})$" : "95", "(?s)^(.{96})$" : "96", "(?s)^(.{97})$" : "97", "(?s)^(.{98})$" : "98", "(?s)^(.{99})$" : "99", "(?s)^(.{100})$" : "100", "(?s)^(.{101})$" : "101", "(?s)^(.{102})$" : "102", "(?s)^(.{103})$" : "103", "(?s)^(.{104})$" : "104", "(?s)^(.{105})$" : "105", "(?s)^(.{106})$" : "106", "(?s)^(.{107})$" : "107", "(?s)^(.{108})$" : "108", "(?s)^(.{109})$" : "109", "(?s)^(.{110})$" : "110", "(?s)^(.{111})$" : "111", "(?s)^(.{112})$" : "112", "(?s)^(.{113})$" : "113", "(?s)^(.{114})$" : "114", "(?s)^(.{115})$" : "115", "(?s)^(.{116})$" : "116", "(?s)^(.{117})$" : "117", "(?s)^(.{118})$" : "118", "(?s)^(.{119})$" : "119", "(?s)^(.{120})$" : "120", "(?s)^(.{121})$" : "121", "(?s)^(.{122})$" : "122", "(?s)^(.{123})$" : "123", "(?s)^(.{124})$" : "124", "(?s)^(.{125})$" : "125", "(?s)^(.{126})$" : "126", "(?s)^(.{127})$" : "127", "(?s)^(.{128})$" : "128", "(?s)^(.{129})$" : "129", "(?s)^(.{130})$" : "130", "(?s)^(.{131})$" : "131", "(?s)^(.{132})$" : "132", "(?s)^(.{133})$" : "133", "(?s)^(.{134})$" : "134", "(?s)^(.{135})$" : "135", "(?s)^(.{136})$" : "136", "(?s)^(.{137})$" : "137", "(?s)^(.{138})$" : "138", "(?s)^(.{139})$" : "139", "(?s)^(.{140})$" : "140", "(?s)^(.{141})$" : "141", "(?s)^(.{142})$" : "142", "(?s)^(.{143})$" : "143", "(?s)^(.{144})$" : "144", "(?s)^(.{145})$" : "145", "(?s)^(.{146})$" : "146", "(?s)^(.{147})$" : "147", "(?s)^(.{148})$" : "148", "(?s)^(.{149})$" : "149", "(?s)^(.{150})$" : "150", "(?s)^(.{151})$" : "151", "(?s)^(.{152})$" : "152", "(?s)^(.{153})$" : "153", "(?s)^(.{154})$" : "154", "(?s)^(.{155})$" : "155", "(?s)^(.{156})$" : "156", "(?s)^(.{157})$" : "157", "(?s)^(.{158})$" : "158", "(?s)^(.{159})$" : "159", "(?s)^(.{160})$" : "160", "(?s)^(.{161})$" : "161", "(?s)^(.{162})$" : "162", "(?s)^(.{163})$" : "163", "(?s)^(.{164})$" : "164", "(?s)^(.{165})$" : "165", "(?s)^(.{166})$" : "166", "(?s)^(.{167})$" : "167", "(?s)^(.{168})$" : "168", "(?s)^(.{169})$" : "169", "(?s)^(.{170})$" : "170", "(?s)^(.{171})$" : "171", "(?s)^(.{172})$" : "172", "(?s)^(.{173})$" : "173", "(?s)^(.{174})$" : "174", "(?s)^(.{175})$" : "175", "(?s)^(.{176})$" : "176", "(?s)^(.{177})$" : "177", "(?s)^(.{178})$" : "178", "(?s)^(.{179})$" : "179", "(?s)^(.{180})$" : "180", "(?s)^(.{181})$" : "181", "(?s)^(.{182})$" : "182", "(?s)^(.{183})$" : "183", "(?s)^(.{184})$" : "184", "(?s)^(.{185})$" : "185", "(?s)^(.{186})$" : "186", "(?s)^(.{187})$" : "187", "(?s)^(.{188})$" : "188", "(?s)^(.{189})$" : "189", "(?s)^(.{190})$" : "190", "(?s)^(.{191})$" : "191", "(?s)^(.{192})$" : "192", "(?s)^(.{193})$" : "193", "(?s)^(.{194})$" : "194", "(?s)^(.{195})$" : "195", "(?s)^(.{196})$" : "196", "(?s)^(.{197})$" : "197", "(?s)^(.{198})$" : "198", "(?s)^(.{199})$" : "199", "(?s)^(.{200})$" : "200", "(?s)^(.{201})$" : "201", "(?s)^(.{202})$" : "202", "(?s)^(.{203})$" : "203", "(?s)^(.{204})$" : "204", "(?s)^(.{205})$" : "205", "(?s)^(.{206})$" : "206", "(?s)^(.{207})$" : "207", "(?s)^(.{208})$" : "208", "(?s)^(.{209})$" : "209", "(?s)^(.{210})$" : "210", "(?s)^(.{211})$" : "211", "(?s)^(.{212})$" : "212", "(?s)^(.{213})$" : "213", "(?s)^(.{214})$" : "214", "(?s)^(.{215})$" : "215", "(?s)^(.{216})$" : "216", "(?s)^(.{217})$" : "217", "(?s)^(.{218})$" : "218", "(?s)^(.{219})$" : "219", "(?s)^(.{220})$" : "220", "(?s)^(.{221})$" : "221", "(?s)^(.{222})$" : "222", "(?s)^(.{223})$" : "223", "(?s)^(.{224})$" : "224", "(?s)^(.{225})$" : "225", "(?s)^(.{226})$" : "226", "(?s)^(.{227})$" : "227", "(?s)^(.{228})$" : "228", "(?s)^(.{229})$" : "229", "(?s)^(.{230})$" : "230", "(?s)^(.{231})$" : "231", "(?s)^(.{232})$" : "232", "(?s)^(.{233})$" : "233", "(?s)^(.{234})$" : "234", "(?s)^(.{235})$" : "235", "(?s)^(.{236})$" : "236", "(?s)^(.{237})$" : "237", "(?s)^(.{238})$" : "238", "(?s)^(.{239})$" : "239", "(?s)^(.{240})$" : "240", "(?s)^(.{241})$" : "241", "(?s)^(.{242})$" : "242", "(?s)^(.{243})$" : "243", "(?s)^(.{244})$" : "244", "(?s)^(.{245})$" : "245", "(?s)^(.{246})$" : "246", "(?s)^(.{247})$" : "247", "(?s)^(.{248})$" : "248", "(?s)^(.{249})$" : "249", "(?s)^(.{250})$" : "250", "(?s)^(.{251})$" : "251", "(?s)^(.{252})$" : "252", "(?s)^(.{253})$" : "253", "(?s)^(.{254})$" : "254", "(?s)^(.{255})$" : "255", "(?s)^(.{256})$" : "256", "(?s)^(.{257})$" : "257", "(?s)^(.{258})$" : "258", "(?s)^(.{259})$" : "259", "(?s)^(.{260})$" : "260", "(?s)^(.{261})$" : "261", "(?s)^(.{262})$" : "262", "(?s)^(.{263})$" : "263", "(?s)^(.{264})$" : "264", "(?s)^(.{265})$" : "265", "(?s)^(.{266})$" : "266", "(?s)^(.{267})$" : "267", "(?s)^(.{268})$" : "268", "(?s)^(.{269})$" : "269", "(?s)^(.{270})$" : "270", "(?s)^(.{271})$" : "271", "(?s)^(.{272})$" : "272", "(?s)^(.{273})$" : "273", "(?s)^(.{274})$" : "274", "(?s)^(.{275})$" : "275", "(?s)^(.{276})$" : "276", "(?s)^(.{277})$" : "277", "(?s)^(.{278})$" : "278", "(?s)^(.{279})$" : "279", "(?s)^(.{280})$" : "280", "(?s)^(.{281})$" : "281", "(?s)^(.{282})$" : "282", "(?s)^(.{283})$" : "283", "(?s)^(.{284})$" : "284", "(?s)^(.{285})$" : "285", "(?s)^(.{286})$" : "286", "(?s)^(.{287})$" : "287", "(?s)^(.{288})$" : "288", "(?s)^(.{289})$" : "289", "(?s)^(.{290})$" : "290", "(?s)^(.{291})$" : "291", "(?s)^(.{292})$" : "292", "(?s)^(.{293})$" : "293", "(?s)^(.{294})$" : "294", "(?s)^(.{295})$" : "295", "(?s)^(.{296})$" : "296", "(?s)^(.{297})$" : "297", "(?s)^(.{298})$" : "298", "(?s)^(.{299})$" : "299", "(?s)^(.{300})$" : "300", "(?s)^(.{301})$" : "301", "(?s)^(.{302})$" : "302", "(?s)^(.{303})$" : "303", "(?s)^(.{304})$" : "304", "(?s)^(.{305})$" : "305", "(?s)^(.{306})$" : "306", "(?s)^(.{307})$" : "307", "(?s)^(.{308})$" : "308", "(?s)^(.{309})$" : "309", "(?s)^(.{310})$" : "310", "(?s)^(.{311})$" : "311", "(?s)^(.{312})$" : "312", "(?s)^(.{313})$" : "313", "(?s)^(.{314})$" : "314", "(?s)^(.{315})$" : "315", "(?s)^(.{316})$" : "316", "(?s)^(.{317})$" : "317", "(?s)^(.{318})$" : "318", "(?s)^(.{319})$" : "319", "(?s)^(.{320})$" : "320", "(?s)^(.{321})$" : "321", "(?s)^(.{322})$" : "322", "(?s)^(.{323})$" : "323", "(?s)^(.{324})$" : "324", "(?s)^(.{325})$" : "325", "(?s)^(.{326})$" : "326", "(?s)^(.{327})$" : "327", "(?s)^(.{328})$" : "328", "(?s)^(.{329})$" : "329", "(?s)^(.{330})$" : "330", "(?s)^(.{331})$" : "331", "(?s)^(.{332})$" : "332", "(?s)^(.{333})$" : "333", "(?s)^(.{334})$" : "334", "(?s)^(.{335})$" : "335", "(?s)^(.{336})$" : "336", "(?s)^(.{337})$" : "337", "(?s)^(.{338})$" : "338", "(?s)^(.{339})$" : "339", "(?s)^(.{340})$" : "340", "(?s)^(.{341})$" : "341", "(?s)^(.{342})$" : "342", "(?s)^(.{343})$" : "343", "(?s)^(.{344})$" : "344", "(?s)^(.{345})$" : "345", "(?s)^(.{346})$" : "346", "(?s)^(.{347})$" : "347", "(?s)^(.{348})$" : "348", "(?s)^(.{349})$" : "349", "(?s)^(.{350})$" : "350", "(?s)^(.{351})$" : "351", "(?s)^(.{352})$" : "352", "(?s)^(.{353})$" : "353", "(?s)^(.{354})$" : "354", "(?s)^(.{355})$" : "355", "(?s)^(.{356})$" : "356", "(?s)^(.{357})$" : "357", "(?s)^(.{358})$" : "358", "(?s)^(.{359})$" : "359", "(?s)^(.{360})$" : "360", "(?s)^(.{361})$" : "361", "(?s)^(.{362})$" : "362", "(?s)^(.{363})$" : "363", "(?s)^(.{364})$" : "364", "(?s)^(.{365})$" : "365", "(?s)^(.{366})$" : "366", "(?s)^(.{367})$" : "367", "(?s)^(.{368})$" : "368", "(?s)^(.{369})$" : "369", "(?s)^(.{370})$" : "370", "(?s)^(.{371})$" : "371", "(?s)^(.{372})$" : "372", "(?s)^(.{373})$" : "373", "(?s)^(.{374})$" : "374", "(?s)^(.{375})$" : "375", "(?s)^(.{376})$" : "376", "(?s)^(.{377})$" : "377", "(?s)^(.{378})$" : "378", "(?s)^(.{379})$" : "379", "(?s)^(.{380})$" : "380", "(?s)^(.{381})$" : "381", "(?s)^(.{382})$" : "382", "(?s)^(.{383})$" : "383", "(?s)^(.{384})$" : "384", "(?s)^(.{385})$" : "385", "(?s)^(.{386})$" : "386", "(?s)^(.{387})$" : "387", "(?s)^(.{388})$" : "388", "(?s)^(.{389})$" : "389", "(?s)^(.{390})$" : "390", "(?s)^(.{391})$" : "391", "(?s)^(.{392})$" : "392", "(?s)^(.{393})$" : "393", "(?s)^(.{394})$" : "394", "(?s)^(.{395})$" : "395", "(?s)^(.{396})$" : "396", "(?s)^(.{397})$" : "397", "(?s)^(.{398})$" : "398", "(?s)^(.{399})$" : "399", "(?s)^(.{400})$" : "400", "(?s)^(.{401})$" : "401", "(?s)^(.{402})$" : "402", "(?s)^(.{403})$" : "403", "(?s)^(.{404})$" : "404", "(?s)^(.{405})$" : "405", "(?s)^(.{406})$" : "406", "(?s)^(.{407})$" : "407", "(?s)^(.{408})$" : "408", "(?s)^(.{409})$" : "409", "(?s)^(.{410})$" : "410", "(?s)^(.{411})$" : "411", "(?s)^(.{412})$" : "412", "(?s)^(.{413})$" : "413", "(?s)^(.{414})$" : "414", "(?s)^(.{415})$" : "415", "(?s)^(.{416})$" : "416", "(?s)^(.{417})$" : "417", "(?s)^(.{418})$" : "418", "(?s)^(.{419})$" : "419", "(?s)^(.{420})$" : "420", "(?s)^(.{421})$" : "421", "(?s)^(.{422})$" : "422", "(?s)^(.{423})$" : "423", "(?s)^(.{424})$" : "424", "(?s)^(.{425})$" : "425", "(?s)^(.{426})$" : "426", "(?s)^(.{427})$" : "427", "(?s)^(.{428})$" : "428", "(?s)^(.{429})$" : "429", "(?s)^(.{430})$" : "430", "(?s)^(.{431})$" : "431", "(?s)^(.{432})$" : "432", "(?s)^(.{433})$" : "433", "(?s)^(.{434})$" : "434", "(?s)^(.{435})$" : "435", "(?s)^(.{436})$" : "436", "(?s)^(.{437})$" : "437", "(?s)^(.{438})$" : "438", "(?s)^(.{439})$" : "439", "(?s)^(.{440})$" : "440", "(?s)^(.{441})$" : "441", "(?s)^(.{442})$" : "442", "(?s)^(.{443})$" : "443", "(?s)^(.{444})$" : "444", "(?s)^(.{445})$" : "445", "(?s)^(.{446})$" : "446", "(?s)^(.{447})$" : "447", "(?s)^(.{448})$" : "448", "(?s)^(.{449})$" : "449", "(?s)^(.{450})$" : "450", "(?s)^(.{451})$" : "451", "(?s)^(.{452})$" : "452", "(?s)^(.{453})$" : "453", "(?s)^(.{454})$" : "454", "(?s)^(.{455})$" : "455", "(?s)^(.{456})$" : "456", "(?s)^(.{457})$" : "457", "(?s)^(.{458})$" : "458", "(?s)^(.{459})$" : "459", "(?s)^(.{460})$" : "460", "(?s)^(.{461})$" : "461", "(?s)^(.{462})$" : "462", "(?s)^(.{463})$" : "463", "(?s)^(.{464})$" : "464", "(?s)^(.{465})$" : "465", "(?s)^(.{466})$" : "466", "(?s)^(.{467})$" : "467", "(?s)^(.{468})$" : "468", "(?s)^(.{469})$" : "469", "(?s)^(.{470})$" : "470", "(?s)^(.{471})$" : "471", "(?s)^(.{472})$" : "472", "(?s)^(.{473})$" : "473", "(?s)^(.{474})$" : "474", "(?s)^(.{475})$" : "475", "(?s)^(.{476})$" : "476", "(?s)^(.{477})$" : "477", "(?s)^(.{478})$" : "478", "(?s)^(.{479})$" : "479", "(?s)^(.{480})$" : "480", "(?s)^(.{481})$" : "481", "(?s)^(.{482})$" : "482", "(?s)^(.{483})$" : "483", "(?s)^(.{484})$" : "484", "(?s)^(.{485})$" : "485", "(?s)^(.{486})$" : "486", "(?s)^(.{487})$" : "487", "(?s)^(.{488})$" : "488", "(?s)^(.{489})$" : "489", "(?s)^(.{490})$" : "490", "(?s)^(.{491})$" : "491", "(?s)^(.{492})$" : "492", "(?s)^(.{493})$" : "493", "(?s)^(.{494})$" : "494", "(?s)^(.{495})$" : "495", "(?s)^(.{496})$" : "496", "(?s)^(.{497})$" : "497", "(?s)^(.{498})$" : "498", "(?s)^(.{499})$" : "499", "(?s)^(.{500})$" : "500"

This will count up to 500 characters. I tried 1000 as well but it had significant cpu impact whereas this makes no identifiable difference to CPU usage in rainmeter even updating every 16ms on my system.


It IS possible to count the number of characters in a string with no upper limits too. Doing so instantly is trickier but I believe it to be possible, I just haven't figured out how exactly yet..
the_metal_lord
Posts: 27
Joined: April 3rd, 2018, 12:50 pm

Re: Auto font size change

Post by the_metal_lord »

Yamajac wrote: November 28th, 2019, 6:29 am Got a bit of a silly solution to the problem.
This is so cool!
Is it possible to make the font size auto adjust to fill up the entire skin size?
User avatar
Yamajac
Posts: 134
Joined: June 30th, 2014, 8:44 am

Re: Auto font size change

Post by Yamajac »

the_metal_lord wrote: November 28th, 2019, 6:39 am This is so cool!
Is it possible to make the font size auto adjust to fill up the entire skin size?
This will auto adjust based on the character count. Just adjust the fontsize calculation to whatever makes more sense for your use case. To make the fontsize adjust to fill up the skin's width would be different. If your skin has a dedicated width - like a background or something that you want to fill up then you'd just use (#CONFIGWIDTH#/100) or whatever number fits better for you. You'd probably be better off centering the text instead in that case though anyway.

Code: Select all

[RandomNumber]
Measure = Calc
UpdateRandom = 1
HighBound = 2147483647
Formula = Random 

[DoIt2]
Measure = String
DynamicVariables=1
String = [RandomNumber]
RegExpSubstitute = 1
Substitute = "(?s)^(.{1})$" : "1", "(?s)^(.{2})$" : "2", "(?s)^(.{3})$" : "3", "(?s)^(.{4})$" : "4", "(?s)^(.{5})$" : "5", "(?s)^(.{6})$" : "6", "(?s)^(.{7})$" : "7", "(?s)^(.{8})$" : "8", "(?s)^(.{9})$" : "9", "(?s)^(.{10})$" : "10", "(?s)^(.{11})$" : "11", "(?s)^(.{12})$" : "12", "(?s)^(.{13})$" : "13", "(?s)^(.{14})$" : "14", "(?s)^(.{15})$" : "15", "(?s)^(.{16})$" : "16", "(?s)^(.{17})$" : "17", "(?s)^(.{18})$" : "18", "(?s)^(.{19})$" : "19", "(?s)^(.{20})$" : "20", "(?s)^(.{21})$" : "21", "(?s)^(.{22})$" : "22", "(?s)^(.{23})$" : "23", "(?s)^(.{24})$" : "24", "(?s)^(.{25})$" : "25", "(?s)^(.{26})$" : "26", "(?s)^(.{27})$" : "27", "(?s)^(.{28})$" : "28", "(?s)^(.{29})$" : "29", "(?s)^(.{30})$" : "30", "(?s)^(.{31})$" : "31", "(?s)^(.{32})$" : "32", "(?s)^(.{33})$" : "33", "(?s)^(.{34})$" : "34", "(?s)^(.{35})$" : "35", "(?s)^(.{36})$" : "36", "(?s)^(.{37})$" : "37", "(?s)^(.{38})$" : "38", "(?s)^(.{39})$" : "39", "(?s)^(.{40})$" : "40", "(?s)^(.{41})$" : "41", "(?s)^(.{42})$" : "42", "(?s)^(.{43})$" : "43", "(?s)^(.{44})$" : "44", "(?s)^(.{45})$" : "45", "(?s)^(.{46})$" : "46", "(?s)^(.{47})$" : "47", "(?s)^(.{48})$" : "48", "(?s)^(.{49})$" : "49", "(?s)^(.{50})$" : "50", "(?s)^(.{51})$" : "51", "(?s)^(.{52})$" : "52", "(?s)^(.{53})$" : "53", "(?s)^(.{54})$" : "54", "(?s)^(.{55})$" : "55", "(?s)^(.{56})$" : "56", "(?s)^(.{57})$" : "57", "(?s)^(.{58})$" : "58", "(?s)^(.{59})$" : "59", "(?s)^(.{60})$" : "60", "(?s)^(.{61})$" : "61", "(?s)^(.{62})$" : "62", "(?s)^(.{63})$" : "63", "(?s)^(.{64})$" : "64", "(?s)^(.{65})$" : "65", "(?s)^(.{66})$" : "66", "(?s)^(.{67})$" : "67", "(?s)^(.{68})$" : "68", "(?s)^(.{69})$" : "69", "(?s)^(.{70})$" : "70", "(?s)^(.{71})$" : "71", "(?s)^(.{72})$" : "72", "(?s)^(.{73})$" : "73", "(?s)^(.{74})$" : "74", "(?s)^(.{75})$" : "75", "(?s)^(.{76})$" : "76", "(?s)^(.{77})$" : "77", "(?s)^(.{78})$" : "78", "(?s)^(.{79})$" : "79", "(?s)^(.{80})$" : "80", "(?s)^(.{81})$" : "81", "(?s)^(.{82})$" : "82", "(?s)^(.{83})$" : "83", "(?s)^(.{84})$" : "84", "(?s)^(.{85})$" : "85", "(?s)^(.{86})$" : "86", "(?s)^(.{87})$" : "87", "(?s)^(.{88})$" : "88", "(?s)^(.{89})$" : "89", "(?s)^(.{90})$" : "90", "(?s)^(.{91})$" : "91", "(?s)^(.{92})$" : "92", "(?s)^(.{93})$" : "93", "(?s)^(.{94})$" : "94", "(?s)^(.{95})$" : "95", "(?s)^(.{96})$" : "96", "(?s)^(.{97})$" : "97", "(?s)^(.{98})$" : "98", "(?s)^(.{99})$" : "99", "(?s)^(.{100})$" : "100", "(?s)^(.{101})$" : "101", "(?s)^(.{102})$" : "102", "(?s)^(.{103})$" : "103", "(?s)^(.{104})$" : "104", "(?s)^(.{105})$" : "105", "(?s)^(.{106})$" : "106", "(?s)^(.{107})$" : "107", "(?s)^(.{108})$" : "108", "(?s)^(.{109})$" : "109", "(?s)^(.{110})$" : "110", "(?s)^(.{111})$" : "111", "(?s)^(.{112})$" : "112", "(?s)^(.{113})$" : "113", "(?s)^(.{114})$" : "114", "(?s)^(.{115})$" : "115", "(?s)^(.{116})$" : "116", "(?s)^(.{117})$" : "117", "(?s)^(.{118})$" : "118", "(?s)^(.{119})$" : "119", "(?s)^(.{120})$" : "120", "(?s)^(.{121})$" : "121", "(?s)^(.{122})$" : "122", "(?s)^(.{123})$" : "123", "(?s)^(.{124})$" : "124", "(?s)^(.{125})$" : "125", "(?s)^(.{126})$" : "126", "(?s)^(.{127})$" : "127", "(?s)^(.{128})$" : "128", "(?s)^(.{129})$" : "129", "(?s)^(.{130})$" : "130", "(?s)^(.{131})$" : "131", "(?s)^(.{132})$" : "132", "(?s)^(.{133})$" : "133", "(?s)^(.{134})$" : "134", "(?s)^(.{135})$" : "135", "(?s)^(.{136})$" : "136", "(?s)^(.{137})$" : "137", "(?s)^(.{138})$" : "138", "(?s)^(.{139})$" : "139", "(?s)^(.{140})$" : "140", "(?s)^(.{141})$" : "141", "(?s)^(.{142})$" : "142", "(?s)^(.{143})$" : "143", "(?s)^(.{144})$" : "144", "(?s)^(.{145})$" : "145", "(?s)^(.{146})$" : "146", "(?s)^(.{147})$" : "147", "(?s)^(.{148})$" : "148", "(?s)^(.{149})$" : "149", "(?s)^(.{150})$" : "150", "(?s)^(.{151})$" : "151", "(?s)^(.{152})$" : "152", "(?s)^(.{153})$" : "153", "(?s)^(.{154})$" : "154", "(?s)^(.{155})$" : "155", "(?s)^(.{156})$" : "156", "(?s)^(.{157})$" : "157", "(?s)^(.{158})$" : "158", "(?s)^(.{159})$" : "159", "(?s)^(.{160})$" : "160", "(?s)^(.{161})$" : "161", "(?s)^(.{162})$" : "162", "(?s)^(.{163})$" : "163", "(?s)^(.{164})$" : "164", "(?s)^(.{165})$" : "165", "(?s)^(.{166})$" : "166", "(?s)^(.{167})$" : "167", "(?s)^(.{168})$" : "168", "(?s)^(.{169})$" : "169", "(?s)^(.{170})$" : "170", "(?s)^(.{171})$" : "171", "(?s)^(.{172})$" : "172", "(?s)^(.{173})$" : "173", "(?s)^(.{174})$" : "174", "(?s)^(.{175})$" : "175", "(?s)^(.{176})$" : "176", "(?s)^(.{177})$" : "177", "(?s)^(.{178})$" : "178", "(?s)^(.{179})$" : "179", "(?s)^(.{180})$" : "180", "(?s)^(.{181})$" : "181", "(?s)^(.{182})$" : "182", "(?s)^(.{183})$" : "183", "(?s)^(.{184})$" : "184", "(?s)^(.{185})$" : "185", "(?s)^(.{186})$" : "186", "(?s)^(.{187})$" : "187", "(?s)^(.{188})$" : "188", "(?s)^(.{189})$" : "189", "(?s)^(.{190})$" : "190", "(?s)^(.{191})$" : "191", "(?s)^(.{192})$" : "192", "(?s)^(.{193})$" : "193", "(?s)^(.{194})$" : "194", "(?s)^(.{195})$" : "195", "(?s)^(.{196})$" : "196", "(?s)^(.{197})$" : "197", "(?s)^(.{198})$" : "198", "(?s)^(.{199})$" : "199", "(?s)^(.{200})$" : "200", "(?s)^(.{201})$" : "201", "(?s)^(.{202})$" : "202", "(?s)^(.{203})$" : "203", "(?s)^(.{204})$" : "204", "(?s)^(.{205})$" : "205", "(?s)^(.{206})$" : "206", "(?s)^(.{207})$" : "207", "(?s)^(.{208})$" : "208", "(?s)^(.{209})$" : "209", "(?s)^(.{210})$" : "210", "(?s)^(.{211})$" : "211", "(?s)^(.{212})$" : "212", "(?s)^(.{213})$" : "213", "(?s)^(.{214})$" : "214", "(?s)^(.{215})$" : "215", "(?s)^(.{216})$" : "216", "(?s)^(.{217})$" : "217", "(?s)^(.{218})$" : "218", "(?s)^(.{219})$" : "219", "(?s)^(.{220})$" : "220", "(?s)^(.{221})$" : "221", "(?s)^(.{222})$" : "222", "(?s)^(.{223})$" : "223", "(?s)^(.{224})$" : "224", "(?s)^(.{225})$" : "225", "(?s)^(.{226})$" : "226", "(?s)^(.{227})$" : "227", "(?s)^(.{228})$" : "228", "(?s)^(.{229})$" : "229", "(?s)^(.{230})$" : "230", "(?s)^(.{231})$" : "231", "(?s)^(.{232})$" : "232", "(?s)^(.{233})$" : "233", "(?s)^(.{234})$" : "234", "(?s)^(.{235})$" : "235", "(?s)^(.{236})$" : "236", "(?s)^(.{237})$" : "237", "(?s)^(.{238})$" : "238", "(?s)^(.{239})$" : "239", "(?s)^(.{240})$" : "240", "(?s)^(.{241})$" : "241", "(?s)^(.{242})$" : "242", "(?s)^(.{243})$" : "243", "(?s)^(.{244})$" : "244", "(?s)^(.{245})$" : "245", "(?s)^(.{246})$" : "246", "(?s)^(.{247})$" : "247", "(?s)^(.{248})$" : "248", "(?s)^(.{249})$" : "249", "(?s)^(.{250})$" : "250", "(?s)^(.{251})$" : "251", "(?s)^(.{252})$" : "252", "(?s)^(.{253})$" : "253", "(?s)^(.{254})$" : "254", "(?s)^(.{255})$" : "255", "(?s)^(.{256})$" : "256", "(?s)^(.{257})$" : "257", "(?s)^(.{258})$" : "258", "(?s)^(.{259})$" : "259", "(?s)^(.{260})$" : "260", "(?s)^(.{261})$" : "261", "(?s)^(.{262})$" : "262", "(?s)^(.{263})$" : "263", "(?s)^(.{264})$" : "264", "(?s)^(.{265})$" : "265", "(?s)^(.{266})$" : "266", "(?s)^(.{267})$" : "267", "(?s)^(.{268})$" : "268", "(?s)^(.{269})$" : "269", "(?s)^(.{270})$" : "270", "(?s)^(.{271})$" : "271", "(?s)^(.{272})$" : "272", "(?s)^(.{273})$" : "273", "(?s)^(.{274})$" : "274", "(?s)^(.{275})$" : "275", "(?s)^(.{276})$" : "276", "(?s)^(.{277})$" : "277", "(?s)^(.{278})$" : "278", "(?s)^(.{279})$" : "279", "(?s)^(.{280})$" : "280", "(?s)^(.{281})$" : "281", "(?s)^(.{282})$" : "282", "(?s)^(.{283})$" : "283", "(?s)^(.{284})$" : "284", "(?s)^(.{285})$" : "285", "(?s)^(.{286})$" : "286", "(?s)^(.{287})$" : "287", "(?s)^(.{288})$" : "288", "(?s)^(.{289})$" : "289", "(?s)^(.{290})$" : "290", "(?s)^(.{291})$" : "291", "(?s)^(.{292})$" : "292", "(?s)^(.{293})$" : "293", "(?s)^(.{294})$" : "294", "(?s)^(.{295})$" : "295", "(?s)^(.{296})$" : "296", "(?s)^(.{297})$" : "297", "(?s)^(.{298})$" : "298", "(?s)^(.{299})$" : "299", "(?s)^(.{300})$" : "300", "(?s)^(.{301})$" : "301", "(?s)^(.{302})$" : "302", "(?s)^(.{303})$" : "303", "(?s)^(.{304})$" : "304", "(?s)^(.{305})$" : "305", "(?s)^(.{306})$" : "306", "(?s)^(.{307})$" : "307", "(?s)^(.{308})$" : "308", "(?s)^(.{309})$" : "309", "(?s)^(.{310})$" : "310", "(?s)^(.{311})$" : "311", "(?s)^(.{312})$" : "312", "(?s)^(.{313})$" : "313", "(?s)^(.{314})$" : "314", "(?s)^(.{315})$" : "315", "(?s)^(.{316})$" : "316", "(?s)^(.{317})$" : "317", "(?s)^(.{318})$" : "318", "(?s)^(.{319})$" : "319", "(?s)^(.{320})$" : "320", "(?s)^(.{321})$" : "321", "(?s)^(.{322})$" : "322", "(?s)^(.{323})$" : "323", "(?s)^(.{324})$" : "324", "(?s)^(.{325})$" : "325", "(?s)^(.{326})$" : "326", "(?s)^(.{327})$" : "327", "(?s)^(.{328})$" : "328", "(?s)^(.{329})$" : "329", "(?s)^(.{330})$" : "330", "(?s)^(.{331})$" : "331", "(?s)^(.{332})$" : "332", "(?s)^(.{333})$" : "333", "(?s)^(.{334})$" : "334", "(?s)^(.{335})$" : "335", "(?s)^(.{336})$" : "336", "(?s)^(.{337})$" : "337", "(?s)^(.{338})$" : "338", "(?s)^(.{339})$" : "339", "(?s)^(.{340})$" : "340", "(?s)^(.{341})$" : "341", "(?s)^(.{342})$" : "342", "(?s)^(.{343})$" : "343", "(?s)^(.{344})$" : "344", "(?s)^(.{345})$" : "345", "(?s)^(.{346})$" : "346", "(?s)^(.{347})$" : "347", "(?s)^(.{348})$" : "348", "(?s)^(.{349})$" : "349", "(?s)^(.{350})$" : "350", "(?s)^(.{351})$" : "351", "(?s)^(.{352})$" : "352", "(?s)^(.{353})$" : "353", "(?s)^(.{354})$" : "354", "(?s)^(.{355})$" : "355", "(?s)^(.{356})$" : "356", "(?s)^(.{357})$" : "357", "(?s)^(.{358})$" : "358", "(?s)^(.{359})$" : "359", "(?s)^(.{360})$" : "360", "(?s)^(.{361})$" : "361", "(?s)^(.{362})$" : "362", "(?s)^(.{363})$" : "363", "(?s)^(.{364})$" : "364", "(?s)^(.{365})$" : "365", "(?s)^(.{366})$" : "366", "(?s)^(.{367})$" : "367", "(?s)^(.{368})$" : "368", "(?s)^(.{369})$" : "369", "(?s)^(.{370})$" : "370", "(?s)^(.{371})$" : "371", "(?s)^(.{372})$" : "372", "(?s)^(.{373})$" : "373", "(?s)^(.{374})$" : "374", "(?s)^(.{375})$" : "375", "(?s)^(.{376})$" : "376", "(?s)^(.{377})$" : "377", "(?s)^(.{378})$" : "378", "(?s)^(.{379})$" : "379", "(?s)^(.{380})$" : "380", "(?s)^(.{381})$" : "381", "(?s)^(.{382})$" : "382", "(?s)^(.{383})$" : "383", "(?s)^(.{384})$" : "384", "(?s)^(.{385})$" : "385", "(?s)^(.{386})$" : "386", "(?s)^(.{387})$" : "387", "(?s)^(.{388})$" : "388", "(?s)^(.{389})$" : "389", "(?s)^(.{390})$" : "390", "(?s)^(.{391})$" : "391", "(?s)^(.{392})$" : "392", "(?s)^(.{393})$" : "393", "(?s)^(.{394})$" : "394", "(?s)^(.{395})$" : "395", "(?s)^(.{396})$" : "396", "(?s)^(.{397})$" : "397", "(?s)^(.{398})$" : "398", "(?s)^(.{399})$" : "399", "(?s)^(.{400})$" : "400", "(?s)^(.{401})$" : "401", "(?s)^(.{402})$" : "402", "(?s)^(.{403})$" : "403", "(?s)^(.{404})$" : "404", "(?s)^(.{405})$" : "405", "(?s)^(.{406})$" : "406", "(?s)^(.{407})$" : "407", "(?s)^(.{408})$" : "408", "(?s)^(.{409})$" : "409", "(?s)^(.{410})$" : "410", "(?s)^(.{411})$" : "411", "(?s)^(.{412})$" : "412", "(?s)^(.{413})$" : "413", "(?s)^(.{414})$" : "414", "(?s)^(.{415})$" : "415", "(?s)^(.{416})$" : "416", "(?s)^(.{417})$" : "417", "(?s)^(.{418})$" : "418", "(?s)^(.{419})$" : "419", "(?s)^(.{420})$" : "420", "(?s)^(.{421})$" : "421", "(?s)^(.{422})$" : "422", "(?s)^(.{423})$" : "423", "(?s)^(.{424})$" : "424", "(?s)^(.{425})$" : "425", "(?s)^(.{426})$" : "426", "(?s)^(.{427})$" : "427", "(?s)^(.{428})$" : "428", "(?s)^(.{429})$" : "429", "(?s)^(.{430})$" : "430", "(?s)^(.{431})$" : "431", "(?s)^(.{432})$" : "432", "(?s)^(.{433})$" : "433", "(?s)^(.{434})$" : "434", "(?s)^(.{435})$" : "435", "(?s)^(.{436})$" : "436", "(?s)^(.{437})$" : "437", "(?s)^(.{438})$" : "438", "(?s)^(.{439})$" : "439", "(?s)^(.{440})$" : "440", "(?s)^(.{441})$" : "441", "(?s)^(.{442})$" : "442", "(?s)^(.{443})$" : "443", "(?s)^(.{444})$" : "444", "(?s)^(.{445})$" : "445", "(?s)^(.{446})$" : "446", "(?s)^(.{447})$" : "447", "(?s)^(.{448})$" : "448", "(?s)^(.{449})$" : "449", "(?s)^(.{450})$" : "450", "(?s)^(.{451})$" : "451", "(?s)^(.{452})$" : "452", "(?s)^(.{453})$" : "453", "(?s)^(.{454})$" : "454", "(?s)^(.{455})$" : "455", "(?s)^(.{456})$" : "456", "(?s)^(.{457})$" : "457", "(?s)^(.{458})$" : "458", "(?s)^(.{459})$" : "459", "(?s)^(.{460})$" : "460", "(?s)^(.{461})$" : "461", "(?s)^(.{462})$" : "462", "(?s)^(.{463})$" : "463", "(?s)^(.{464})$" : "464", "(?s)^(.{465})$" : "465", "(?s)^(.{466})$" : "466", "(?s)^(.{467})$" : "467", "(?s)^(.{468})$" : "468", "(?s)^(.{469})$" : "469", "(?s)^(.{470})$" : "470", "(?s)^(.{471})$" : "471", "(?s)^(.{472})$" : "472", "(?s)^(.{473})$" : "473", "(?s)^(.{474})$" : "474", "(?s)^(.{475})$" : "475", "(?s)^(.{476})$" : "476", "(?s)^(.{477})$" : "477", "(?s)^(.{478})$" : "478", "(?s)^(.{479})$" : "479", "(?s)^(.{480})$" : "480", "(?s)^(.{481})$" : "481", "(?s)^(.{482})$" : "482", "(?s)^(.{483})$" : "483", "(?s)^(.{484})$" : "484", "(?s)^(.{485})$" : "485", "(?s)^(.{486})$" : "486", "(?s)^(.{487})$" : "487", "(?s)^(.{488})$" : "488", "(?s)^(.{489})$" : "489", "(?s)^(.{490})$" : "490", "(?s)^(.{491})$" : "491", "(?s)^(.{492})$" : "492", "(?s)^(.{493})$" : "493", "(?s)^(.{494})$" : "494", "(?s)^(.{495})$" : "495", "(?s)^(.{496})$" : "496", "(?s)^(.{497})$" : "497", "(?s)^(.{498})$" : "498", "(?s)^(.{499})$" : "499", "(?s)^(.{500})$" : "500"

[ShowIt2]
Meter = String
Text = [RandomNumber]
FontSize = (100/[DoIt2])
DynamicVariables = 1
the_metal_lord
Posts: 27
Joined: April 3rd, 2018, 12:50 pm

Re: Auto font size change

Post by the_metal_lord »

Yamajac wrote: November 28th, 2019, 6:52 am This will auto adjust based on the character count. Just adjust the fontsize calculation to whatever makes more sense for your use case. To make the fontsize adjust to fill up the skin's width would be different. If your skin has a dedicated width - like a background or something that you want to fill up then you'd just use (#CONFIGWIDTH#/100) or whatever number fits better for you. You'd probably be better off centering the text instead in that case though anyway.
I'm not sure how to integrate this into this skin. I've attached the skin.
You do not have the required permissions to view the files attached to this post.