It is currently April 24th, 2024, 3:24 am

D2D ClipString oddities

Report bugs with the Rainmeter application and suggest features.
User avatar
killall-q
Posts: 305
Joined: August 14th, 2009, 8:04 am

D2D ClipString oddities

Post by killall-q »

On Direct2D, when using a StringAlign other than top, strings with the same Y value do not align with each other if they are using different ClipString settings. The difference can vary based on the font used. AccurateText=0 makes no difference.

Image

Tested in 3.1 r2187. The code I used to create this example:

Code: Select all

[Rainmeter]
Update=-1
BackgroundMode=2
BackgroundMargins=0,0,0,20
SolidColor=0,0,0
MiddleMouseDownAction=!Refresh

; -----Styles-----

[sText]
FontFace=Calibri
FontSize=11
FontColor=255,255,255
X=10R
Y=r
W=30
H=19
SolidColor=255,128,0,64

[sClip]
ClipString=1
SolidColor=0,255,0,64

[sLine]
W=300
H=1
SolidColor=255,0,0

; -----Meters-----

[RT]
Meter=String
MeterStyle=sText
X=50
Y=20
StringAlign=RightTop
Text=RT

[RTc]
Meter=String
MeterStyle=sText | sClip
StringAlign=RightTop
Text=RT

[CT]
Meter=String
MeterStyle=sText
StringAlign=CenterTop
Text=CT

[CTc]
Meter=String
MeterStyle=sText | sClip
StringAlign=CenterTop
Text=CT

[LT]
Meter=String
MeterStyle=sText
StringAlign=LeftTop
Text=LT

[LTc]
Meter=String
MeterStyle=sText | sClip
StringAlign=LeftTop
Text=LT

[RC]
Meter=String
MeterStyle=sText
X=50
Y=20R
StringAlign=RightCenter
Text=RC

[RCc]
Meter=String
MeterStyle=sText | sClip
StringAlign=RightCenter
Text=RC

[CC]
Meter=String
MeterStyle=sText
StringAlign=CenterCenter
Text=CC

[CCc]
Meter=String
MeterStyle=sText | sClip
StringAlign=CenterCenter
Text=CC

[LC]
Meter=String
MeterStyle=sText
StringAlign=LeftCenter
Text=LC

[LCc]
Meter=String
MeterStyle=sText | sClip
StringAlign=LeftCenter
Text=LC

[RB]
Meter=String
MeterStyle=sText
X=50
Y=20R
StringAlign=RightBottom
Text=RB

[RBc]
Meter=String
MeterStyle=sText | sClip
StringAlign=RightBottom
Text=RB

[CB]
Meter=String
MeterStyle=sText
StringAlign=CenterBottom
Text=CB

[CBc]
Meter=String
MeterStyle=sText | sClip
StringAlign=CenterBottom
Text=CB

[LB]
Meter=String
MeterStyle=sText
StringAlign=LeftBottom
Text=LB

[LBc]
Meter=String
MeterStyle=sText | sClip
StringAlign=LeftBottom
Text=LB

[Line1]
Meter=Image
MeterStyle=sLine
Y=34

[Line2]
Meter=Image
MeterStyle=sLine
Y=65

[Line3]
Meter=Image
MeterStyle=sLine
Y=94
Edit: I noticed another oddity with how D2D ClipString chooses where to cut off text. Sometimes it is by word, and other times it doesn't mind cutting words in half, I don't really understand how it chooses. It may have something to do with the implementation of ClipString=2, but I'm using ClipString=1 here.

Image