mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Gfx: Fix text Y position for D2D with vertical Center/Bottom alignments
This commit is contained in:
		@@ -316,7 +316,6 @@ void CanvasD2D::DrawTextW(const WCHAR* str, UINT strLen, const TextFormat& forma
 | 
			
		||||
			str, strLen, rect.Width, rect.Height, !m_AccurateText && m_TextAntiAliasing);
 | 
			
		||||
 | 
			
		||||
		D2D1_POINT_2F drawPosition;
 | 
			
		||||
		drawPosition.y = rect.Y - formatD2D.m_LineGap;
 | 
			
		||||
		drawPosition.x = [&]()
 | 
			
		||||
		{
 | 
			
		||||
			if (!m_AccurateText)
 | 
			
		||||
@@ -332,6 +331,19 @@ void CanvasD2D::DrawTextW(const WCHAR* str, UINT strLen, const TextFormat& forma
 | 
			
		||||
			return rect.X;
 | 
			
		||||
		} ();
 | 
			
		||||
 | 
			
		||||
		drawPosition.y = [&]()
 | 
			
		||||
		{
 | 
			
		||||
			// GDI+ compatibility.
 | 
			
		||||
			float yPos = rect.Y - formatD2D.m_LineGap;
 | 
			
		||||
			switch (formatD2D.GetVerticalAlignment())
 | 
			
		||||
			{
 | 
			
		||||
			case VerticalAlignment::Bottom: yPos -= formatD2D.m_ExtraHeight; break;
 | 
			
		||||
			case VerticalAlignment::Center: yPos -= formatD2D.m_ExtraHeight / 2; break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return yPos;
 | 
			
		||||
		} ();
 | 
			
		||||
 | 
			
		||||
		DWRITE_OVERHANG_METRICS overhangMetrics;
 | 
			
		||||
		formatD2D.m_TextLayout->GetOverhangMetrics(&overhangMetrics);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user