Skip to content

Commit

Permalink
Revert "ui.fs: anchor font rendering to pixels -- better results"
Browse files Browse the repository at this point in the history
This reverts commit 8c3a633.
  • Loading branch information
Yatao Li committed Oct 23, 2020
1 parent 8c3a633 commit 080c448
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui.fs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ let RenderText (ctx: IDrawingContextImpl, region: Rect, scale: float, fg: SKPain
let total_padding = h - ((fg.FontMetrics.Bottom - fg.FontMetrics.Top))
let baseline = region.Top + ceil((total_padding / 2.0f) - fg.FontMetrics.Top)
(*printfn "scale=%A pad=%A base=%A region=%A" scale total_padding baseline region*)
let fontPos = SKPoint(ceil region.Left, floor baseline)
let fontPos = SKPoint(region.Left, baseline)

let skia = ctx :?> ISkiaDrawingContextImpl

Expand All @@ -299,7 +299,7 @@ let RenderText (ctx: IDrawingContextImpl, region: Rect, scale: float, fg: SKPain

if not <| String.IsNullOrWhiteSpace text then
if shaper.IsSome then
skia.SkCanvas.DrawShapedText(shaper.Value, text.TrimEnd(), fontPos.X, fontPos.Y, fg)
skia.SkCanvas.DrawShapedText(shaper.Value, text.TrimEnd(), single fontPos.X, single fontPos.Y, fg)
else
skia.SkCanvas.DrawText(text.TrimEnd(), fontPos, fg)

Expand Down

0 comments on commit 080c448

Please sign in to comment.