فهرست منبع

fix font scale on non-macOS

Johann ELSASS 4 سال پیش
والد
کامیت
d534575384
2فایلهای تغییر یافته به همراه7 افزوده شده و 6 حذف شده
  1. 1 1
      lazpaint/umenu.pas
  2. 6 5
      lazpaintcontrols/lcscaledpi.pas

+ 1 - 1
lazpaint/umenu.pas

@@ -409,7 +409,7 @@ begin
         if (Controls[j].Name = 'Label_Coordinates') or
            (Controls[j].Name = 'Label_CurrentZoom') or
            (Controls[j].Name = 'Label_CurrentDiff') then
-          Controls[j].Font.Height := -DoScaleY(12, OriginalDPI);
+          Controls[j].Font.Height := -DoScaleY(12, OriginalDPI, FTargetDPI);
       end;
     end;
   end;

+ 6 - 5
lazpaintcontrols/lcscaledpi.pas

@@ -123,12 +123,13 @@ begin
     Top:=DoScaleY(Top,FromDPI,ToDPI_Y);
     Width:=DoScaleX(Width,FromDPI,ToDPI_X);
     Height:=DoScaleY(Height,FromDPI,ToDPI_Y);
-    if Font.Size = 0 then
+    if not IsParentFont then
     begin
-      if ToDPI_Y <> Screen.PixelsPerInch then
-        Font.Height := DoScaleY(Font.GetTextHeight('Hg'),FromDPI,ToDPI_Y);
-    end else
-      Font.Size:= round(Font.Size * ToDPI_Y / Screen.PixelsPerInch);
+      if Font.Size = 0 then
+        Font.Height := -DoScaleY(12,FromDPI,ToDPI_Y)
+      else
+        Font.Size:= round(Font.Size * ToDPI_Y / FromDPI);
+    end;
   end;
 
   if Control is TToolBar then begin