From 7e1c823725c085e1efb796dfe98fca8f7d7857b7 Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Sat, 5 Mar 2022 00:36:05 -0700 Subject: [PATCH] LibPDF: Fix the zoom-related text scaling issue Previously, text spacing on a page would only look correct on very zoomed-in pages. When the page was zoomed out, the spacing between characters was very large. The cause for this was incorrect initial values for the Tc (character spacing) and Tw (word spacing) text parameters. The initial values were too large, but they were only about 3-5 pixels, which is why the error was only observable for smaller pages. The text placement still isn't perfect, but it is _much_ better! --- Userland/Libraries/LibPDF/Renderer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibPDF/Renderer.h b/Userland/Libraries/LibPDF/Renderer.h index eb8e0f2b631..cf10174df98 100644 --- a/Userland/Libraries/LibPDF/Renderer.h +++ b/Userland/Libraries/LibPDF/Renderer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Matthew Olsson + * Copyright (c) 2021-2022, Matthew Olsson * * SPDX-License-Identifier: BSD-2-Clause */ @@ -51,8 +51,8 @@ enum class TextRenderingMode : u8 { }; struct TextState { - float character_spacing { 3.0f }; - float word_spacing { 5.0f }; + float character_spacing { 0.0f }; + float word_spacing { 0.0f }; float horizontal_scaling { 1.0f }; float leading { 0.0f }; FlyString font_family { "Liberation Serif" };