summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2023-01-02 20:10:00 +0100
committerAndreas Kling <kling@serenityos.org>2023-01-05 12:09:35 +0100
commitada48a1daf24203b90730f178f4466d2393702c5 (patch)
treed56810dbb7c2697985e63e13491014e3e165d672 /Userland/Libraries/LibGfx/Font/PathRasterizer.cpp
parenta1726b1ba5aa6d19949f682936b3ee95b368a370 (diff)
downloadserenity-ada48a1daf24203b90730f178f4466d2393702c5.zip
LibGfx: Add ability to request glyphs at subpixel offsets to fonts
This adds the option to pass a subpixel offset when fetching a glyph from a font, this offset is currently snapped to thirds of a pixel (i.e. 0, 0.33, 0.66). This is then used when rasterizing the glyph, which is then cached like usual. Note that when using subpixel offsets you're trading a bit of space for accuracy. With the current third of a pixel offsets you can end up with up to 9 bitmaps per glyph.
Diffstat (limited to 'Userland/Libraries/LibGfx/Font/PathRasterizer.cpp')
-rw-r--r--Userland/Libraries/LibGfx/Font/PathRasterizer.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp b/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp
index dbf0d4b0e0..094adff4a8 100644
--- a/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp
+++ b/Userland/Libraries/LibGfx/Font/PathRasterizer.cpp
@@ -19,9 +19,8 @@ PathRasterizer::PathRasterizer(Gfx::IntSize size)
void PathRasterizer::draw_path(Gfx::Path& path)
{
- for (auto& line : path.split_lines()) {
- draw_line(line.from, line.to);
- }
+ for (auto& line : path.split_lines())
+ draw_line(line.from.translated(translation()), line.to.translated(translation()));
}
RefPtr<Gfx::Bitmap> PathRasterizer::accumulate()