It is currently May 7th, 2024, 12:36 am

Is it possible to have a string display in smallcaps?

Get help with creating, editing & fixing problems with skins
Volcano Pukebag
Posts: 4
Joined: February 10th, 2012, 5:40 pm

Is it possible to have a string display in smallcaps?

Post by Volcano Pukebag »

I know you can do NONE, UPPER, LOWER, and PROPER StringCase options, but I would like to ouput in smal lcapitals.

Is that possible?

Thanks
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Is it possible to have a string display in smallcaps?

Post by Brian »

You could adjust the FontSize option, then use the StringCase=UPPER like you mentioned above.

-Brian
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Is it possible to have a string display in smallcaps?

Post by jsmorley »

There is no functionality in Rainmeter that can do "small caps" (where capital letters are full size, and lower case letters are just smaller capital letters). Rainmeter is not CSS, and there is no "font-variant: small-caps;" It can only be done using a font that is already in that format. There are quite a few "small caps" fonts out there, but I'm not sure if any decent ones are free. You would have to do a bit of googl'ing around.
Volcano Pukebag
Posts: 4
Joined: February 10th, 2012, 5:40 pm

Re: Is it possible to have a string display in smallcaps?

Post by Volcano Pukebag »

Brian wrote:You could adjust the FontSize option, then use the StringCase=UPPER like you mentioned above.

-Brian
I'm not seeing any small caps fonts that would work outright, so I think I'll try this.

Is there a way to set a string so that the first letter outputs at one FontSize, and all subsequent letters output at a different FontSize?

Here's the simple code I'm working with:

Code: Select all

[Style]
Fontface="Helvetica"
Fontcolor=40,40,40,220
Antialias=1
Fontsize=60

[MsDay]
Measure=Time
Format=%d
Substitute="31":"Thirty-first","30":"Thirtieth","29":"Twenty-ninth","28":"Twenty-eight","27":"Twenty-seventh","26":"Twent-sixth","25":"Twenty-fifth","24":"Twenty-fourth","23":"Twenty-third","22":"Twenty-second","21":"Twenty-first","20":"Twentieth","19":"Nineteenth","18":"Eighteenth","17":"Seventeenth","16":"Sixteenth","15":"Fifteenth","14":"Fourteenth","13":"Thirteenth","12":"Twelfth","11":"Eleventh","10":"Tenth","9":"Ninth","8":"Eighth","7":"Seventh","6":"Sixth","5":"Fifth","4":"Fourth","3":"Third","2":"Second","1":"First"

[MsMonth]
Measure=Time
Format=%B

[MsWeekday]
Measure=Time
Format=%A

[Weekday]
Meter=String
MeasureName=MsWeekday
MeterStyle=Style
Stingalign=Right



[Month]
Meter=String
MeasureName=MsMonth
MeterStyle=Style
Stingalign=Right
y=90

[Day]
Meter=String
MeasureName=MsDay
MeterStyle=Style
Stringalign=Left
x=350
y=90
Last edited by smurfier on February 11th, 2012, 3:07 am, edited 1 time in total.
Reason: Edited to use code tags.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Is it possible to have a string display in smallcaps?

Post by jsmorley »

Sorry no, there is no way within a single meter. A meter has one FontSize= and that is that. I suppose you could use two measures with the same value and write some regular expression substitute that strips the first letter off of one and strips all but the first letter off of the other and then use two meters with different font sizes with relative positioning to be next to each other. I also think it could be done using a Lua script that took the value of some measure(s) and did the striping and assigning Text= values to two meters next to each other. I personally would find it more trouble than it is worth, but that's just me.
Volcano Pukebag
Posts: 4
Joined: February 10th, 2012, 5:40 pm

Re: Is it possible to have a string display in smallcaps?

Post by Volcano Pukebag »

Thanks for the guidance

I agree, it just doesn't sound worth the hassle

Maybe one day if I have a bunch of free time I'll see if I can get it going
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Is it possible to have a string display in smallcaps?

Post by Brian »

Like JSMorley said, its possible with two measures per word(probably could have used one). Seems like a lot of extra work just for the small caps effect.

Having said that, here is something I came up with:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
FL.FontSize=60
ROW.FontSize=40
ROW.Xpos=(#ROW.FontSize#/2)

;styles
[FirstLetter]
FontFace="Helvetica"
FontColor=40,40,40,220
AntiAlias=1
FontSize=#FL.FontSize#
SolidColor=0,0,0,1
X=R
Y=-24r

[RestOfWord]
StringCase=UPPER
FontFace="Helvetica"
FontColor=40,40,40,220
AntiAlias=1
FontSize=#ROW.FontSize#
SolidColor=0,0,0,1
X=(-#ROW.Xpos#)R
Y=24r

;measures
[MsDay]
Measure=Time
Format=%d

[MsDayFirstLetter]
Measure=Calc
Formula=([MsDay]>12?Floor([MsDay]/10):[MsDay])
Substitute="12":"T","11":"E","10":"T","9":"N","8":"E","7":"S","6":"S","5":"F","4":"F","3":"T","2":"S","1":"F"
DynamicVariables=1

[MsDayRestOfWord]
Measure=Calc
Formula=[MsDay]
Substitute="31":"hirty-first","30":"hirtieth","29":"wenty-ninth","28":"wenty-eighth","27":"wenty-seventh","26":"wenty-sixth","25":"wenty-fifth","24":"wenty-fourth","23":"wenty-third","22":"wenty-second","21":"wenty-first","20":"wentieth","19":"ineteenth","18":"ighteenth","17":"eventeenth","16":"ixteenth","15":"ifteenth","14":"ourteenth","13":"hirteenth","12":"welfth","11":"leventh","10":"enth","9":"inth","8":"ighth","7":"eventh","6":"ixth","5":"ifth","4":"ourth","3":"hird","2":"econd","1":"irst"
DynamicVariables=1

[MsMonth]
Measure=Time
;Format=%B
Format=%m

[MsMonthFirstLetter]
Measure=Calc
Formula=[MsMonth]
Substitute="12":"D","11":"N","10":"O","9":"S","8":"A","7":"J","6":"J","5":"M","4":"A","3":"M","2":"F","1":"J"
DynamicVariables=1

[MsMonthRestOfWord]
Measure=Calc
Formula=[MsMonth]
Substitute="12":"ecember","11":"ovember","10":"ctober","9":"eptember","8":"ugust","7":"uly","6":"une","5":"ay","4":"pril","3":"arch","2":"ebruary","1":"anuary"
DynamicVariables=1

[MsWeekday]
Measure=Time
;Format=%A
Format=%w

[MsWeekdayFirstLetter]
Measure=Calc
Formula=[MsWeekday]
Substitute="0":"S","1":"M","2":"T","3":"W","4":"T","5":"F","6":"S"
DynamicVariables=1

[MsWeekdayRestOfWord]
Measure=Calc
Formula=[MsWeekday]
Substitute="0":"un","1":"on","2":"ues","3":"ednes","4":"hurs","5":"ri","6":"atur"
DynamicVariables=1

;meters
[WeekdayFirstLetter]
Meter=String
MeasureName=MsWeekdayFirstLetter
MeterStyle=FirstLetter
X=0
Y=10

[WeekdayRestOfWord]
Meter=String
MeasureName=MsWeekdayRestOfWord
MeterStyle=RestOfWord
Text=%1day

[MonthFirstLetter]
Meter=String
MeasureName=MsMonthFirstLetter
MeterStyle=FirstLetter

[MonthRestOfWord]
Meter=String
MeasureName=MsMonthRestOfWord
MeterStyle=RestOfWord

[DayFirstLetter]
Meter=String
MeasureName=MsDayFirstLetter
MeterStyle=FirstLetter

[DayRestOfWord]
Meter=String
MeasureName=MsDayRestOfWord
MeterStyle=RestOfWord
I tried to have a few variables to adjust the X and Y positions based on the font height, but it was beginning to be too much work for just a simple time skin, so if you are going to use a different font height for your first letter (or for the rest of the word), you will have to adjust the relative positions in the meter styles.

-Brian
Volcano Pukebag
Posts: 4
Joined: February 10th, 2012, 5:40 pm

Re: Is it possible to have a string display in smallcaps?

Post by Volcano Pukebag »

I'm very impressed. That's perfect. I'm particularly impressed by complicated substitution regime you instituted.

I created another style definition to move the Month to directly below the Weekday, and this is exactly what I wanted.

Thanks a lot!