Timothy Flynn
f3146d3320
LibGfx: Implement a UTF-16 Color stringifier
2025-07-28 12:25:11 +02:00
Arran Ireland
9a8599f265
LibGfx+LibMedia+LibWeb: Use new Matrix subscript operator
2025-07-28 09:15:23 +02:00
Arran Ireland
423e944a92
LibGfx+LibWeb: Upgrade to multi-arg subscript operator in Matrix
...
See the following for more details:
https://en.cppreference.com/w/cpp/language/operators.html#Array_subscript_operator
2025-07-28 09:15:23 +02:00
Rocco Corsi
d322c3a21f
LibGfx: VulkanContext coverity reports integer_overflow on index
...
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Coverity static analysis reports that the code that scans the queue
families for one that has the graphics bit, can be -1 if none are
found, which could cause a problem when the -1 (signed) value is
used later as an index in a uint32_t (unsigned) variable.
Its not immediately clear how often this could occur, not finding
a queue family with the graphics bit, but adding some protecting
just in case.
2025-07-27 23:38:49 -04:00
Timothy Flynn
0e9b694058
LibGfx: Support UTF-16 text shaping
...
We can achieve this with templating the string view type, and then just
piping the view into the correct `hb_buffer_add_utf*` API.
2025-07-25 18:16:22 +02:00
Jelle Raaijmakers
a9862d60bf
LibGfx: Add Color::from_utf16_string()
2025-07-24 07:18:25 -04:00
Kenneth Myhra
09f336bf8f
LibGfx: Use static_cast instead of C-style cast
2025-07-20 12:30:43 +12:00
Jelle Raaijmakers
0f642ecb5c
LibGfx: Replace Bitmap::visually_equals() with ::diff()
...
This produces more granural information on the actual pixel errors
present between two bitmaps. It now also asserts that both bitmaps are
the same size, since we should never compare two differently sized
bitmaps anyway.
2025-07-17 12:59:11 +01:00
Jelle Raaijmakers
144eac44fb
LibGfx: Remove Font::pixel_size_rounded_up()
...
The remaining callsites were removed in the previous commit.
2025-07-15 19:05:36 +01:00
Andreas Kling
a4fb21308d
LibWeb: Don't add range data for FontCascadeList with no Unicode ranges
...
This fixes a bunch of WPT crashes in /html/canvas/offscreen/text/
2025-07-15 10:06:10 +02:00
Andreas Kling
0fece0650e
LibGfx: Let FontCascadeList quickly reject out-of-range code points
...
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
By keeping track of the enclosing range around all Unicode ranges of a
FontCascadeList entry, we can quickly reject any code point that's
outside all ranges.
This knocks font_for_code_point() from 7% to 3% in the profile when
scrolling on https://screenshotone.com/
2025-07-14 19:05:25 +02:00
Lucien Fiorini
635adc8aa7
LibWeb/SVG: Implement resolution for a subset of SVG filters
2025-07-09 18:07:12 +01:00
Aliaksandr Kalenik
c18314b942
LibWeb+LibGfx: Replace BackingStore with PaintingSurface
...
Now, when Skia backend context is available by the time backing stores
are allocated, there is no need to have a separate BackingStore class.
This allows us to get rid of BackingStore -> PaintingSurface cache.
2025-07-04 16:12:47 +02:00
ayeteadoe
d897bfae91
CMake: Rename all_generated target to better convey intent
2025-07-03 23:19:41 +02:00
ayeteadoe
25f5936dee
CMake: Rename serenity_* helper functions/macros to ladybird_*
2025-07-03 23:19:41 +02:00
Timothy Flynn
62d9a84b8d
AK+Everywhere: Replace custom number parsers with fast_float
...
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Build Dev Container Image / build (push) Has been cancelled
Our floating point number parser was based on the fast_float library:
https://github.com/fastfloat/fast_float
However, our implementation only supports 8-bit characters. To support
UTF-16, we will need to be able to convert char16_t-based strings to
numbers as well. This works out-of-the-box with fast_float.
We can also use fast_float for integer parsing.
2025-07-03 09:51:56 -04:00
Jelle Raaijmakers
180bb0fc5d
Everywhere: Remove LibRIFF
2025-07-02 12:01:12 +01:00
ayeteadoe
2119ea982e
LibGfx: Enable in Windows CI
2025-06-26 19:35:14 -06:00
Jelle Raaijmakers
2687246808
LibGfx: Use NonnullRefPtr<Bitmap> for frame descriptors
...
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This makes it a bit easier to reason about where bitmaps should be
available.
2025-06-25 22:54:48 +12:00
Tim Ledbetter
e69d9fb331
LibGfx: Destroy FontConfig string iterator after use
...
This avoids a memory leak in `FontDatabase::font_directories()`.
2025-06-25 08:59:49 +02:00
Sam Atkins
423cdd447d
LibWeb+LibGfx: Apply editorial punctuation/whitespace/markup fixes
...
Corresponds to d426109ea1
and fd08f81d06
2025-06-25 03:12:19 +12:00
Tom Lynch
b3d459f4de
LibGfx: Nearest neighbor scaling for ScalingMode::SmoothPixels
2025-06-23 16:05:52 +02:00
Luke Wilde
ffae0d8b2d
LibGfx/AVIF: Always reduce decoding output to a bit depth of 8
...
Gfx::Bitmap only supports a bit depth of 8, therefore we refused to
load AVIF images which didn't have this bit depth.
However, we can tell the libavif decoder to reduce the output depth by
setting avifRGBImage.depth to 8. This allows us to support any input
depth.
Makes images load on https://www.ikea.com/ which uses Cloudflare Images
to re-encode their images to 16-bit AVIF.
2025-06-18 14:27:24 +02:00
Colin Reeder
d4a5d16d27
LibGfx: Explicitly link against fontconfig
2025-06-17 16:55:50 -06:00
Shannon Booth
766cbf4937
LibGfx: Remove dependency on LibURL
...
This was previously a dependency (from ICC, if I recall correctly),
but this no longer appears to be the case.
2025-06-17 20:54:03 +02:00
Jelle Raaijmakers
46a46a1c61
LibGfx+LibWeb: Append glyphs in LineBoxFragment run more efficiently
...
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Since we know the number of glyphs we're going to append, ensure the
LineBoxFragment run's capacity once and perform unchecked appends.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
5ac067c804
LibGfx: Inline Font::pixel_metrics()
...
Calls to this method were showing up in profiles.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
df20ac0f3c
LibGfx: Optimize Gfx::measure_text_width()
...
Instead of constructing a GlyphRun, just add the X advances of all
glyphs to determine a text's width.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
631c857301
LibGfx: Only determine glyphs info once in TextLayout
...
We were calling into `hb_buffer_get_glyph_infos()` twice and setting up
an unused `Vector<hb_glyph_info_t>`.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
e80914a399
LibGfx: Use Vector::extend()
to extend fonts in FontCascadeList
...
This only grows the capacity once, if required.
2025-06-17 17:03:33 +02:00
Jelle Raaijmakers
7d1ee3a2fa
LibGfx+LibWeb: Perform unchecked appends related to text layout
...
Use unchecked appends in places where we know for certain the vector has
enough capacity.
2025-06-17 11:55:28 +02:00
Jelle Raaijmakers
6710aa102a
LibGfx: Return NonnullRefPtr
in Gfx::shape_text()
...
We always return a glyph run here.
2025-06-17 11:55:28 +02:00
Viktor Szépe
19f88f96dc
Everywhere: Fix typos - act III
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-06-16 14:20:48 +01:00
aplefull
bfc79a403d
LibGfx: Fix ICC v2 profiles with table-based L* curves
...
Skia's SkColorSpace::Make() doesn't seem to like ICC v2 profiles
containing table-based L* transfer curves. Now we use
skcms_ApproximateCurve() to convert these tables to parametric curves
that Skia supports in case Skia's SkColorSpace::Make() fails.
2025-06-16 11:31:42 +02:00
Jelle Raaijmakers
dd4d7d0939
LibGfx: Ensure capacity for glyph runs in TextLayout
...
We can reserve the capacity for new glyph runs since we already know the
glyph count.
2025-06-13 17:31:18 +02:00
Jelle Raaijmakers
4b6489917b
LibGfx: Disable tech(variations)
font support for now
...
We apparently don't support it in the right way, since it causes the
wrong font to display on https://ladybird.org .
2025-06-12 11:04:37 +01:00
Andrew Kaster
a267743095
LibGfx: Avoid importing FilterImpl into swift
...
This header uses skia directly, and is not needed in swift.
2025-06-11 11:54:52 -06:00
Timothy Flynn
18718e0876
Meta: Sort all python imports
2025-06-09 11:25:14 -04:00
Timothy Flynn
34e178d0e7
LibGfx: Convert single quote string to double quotes
...
Caught via ruff. Not sure why black didn't catch this one previously.
2025-06-09 11:25:14 -04:00
Sam Atkins
5a1c73d7e2
LibGfx+LibWeb: Update definitions of supported font formats and features
...
Based very scientifically on what's listed here:
https://harfbuzz.github.io/what-does-harfbuzz-do.html
I've moved the code into LibGfx because including a HarfBuzz header
directly from LibWeb is a little unpleasant. But the Gfx::FontTech enum
follows the CSS definitions for font features for simplicity.
TrueType collections are supported. SVG and Embedded OpenType are not,
but they're not widely supported by other browsers so that's fine.
Most of the features are completely supported by HarfBuzz, so we can
just return true. Graphite support is optional (and it appears we use a
build of HarfBuzz without it) but there's a define we can check.
Incremental Font Transfer is a whole separate thing that we definitely
don't support yet.
2025-06-05 12:10:29 +01:00
Lucien Fiorini
0fcb574041
LibGfx+LibWeb: Turn Gfx::Filter into a SkImageFilter wrapper
2025-06-01 23:22:10 +02:00
Andrew Kaster
6f9e56870e
CMake: Exclude GlobalFontConfig.h from autogenerated clang module
...
CI / Lagom (arm64, Sanitizer_CI, false, macOS, macos-15, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, Linux, blacksmith-16vcpu-ubuntu-2404, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, Linux, blacksmith-16vcpu-ubuntu-2404, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, Linux, blacksmith-16vcpu-ubuntu-2404, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macOS, macOS-arm64, macos-15) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, Linux, Linux-x86_64, blacksmith-8vcpu-ubuntu-2404) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This header file is never included by any other headers, and including
it would require adding the fontconfig include paths to the swift
interop header generation, which is not desirable.
2025-05-30 15:21:17 -06:00
Andrew Kaster
17b7f192c4
LibGfx: Add a strict CMake check for the libpng apng patch
2025-05-30 15:21:07 -06:00
blukai
3ab50be36a
LibGfx: Improve logical separation of font_directories' ifdefs
...
in addition to what was proposed in
https://github.com/LadybirdBrowser/ladybird/pull/4830#discussion_r2101301978
2025-05-26 12:14:29 -06:00
blukai
e356a4bd01
LibGfx: Rely on fontconfig(if enabled) for font directory resolution
...
this commit also introduces GlobalFontConfig class that is now
responsible for fontconfig initialization. it seems sane, even thought
FcInit's docs state that if the default configuration has already been
loaded, this routine does nothing.
2025-05-26 12:14:29 -06:00
blukai
4b3691ff39
LibCore+LibGfx: Move font_directories from LibCore to LibGfx
...
the goal is to rely on fontconfig for font directory resolution. it
doesn't seem like it would be appropritate to call to fontconfig funcs
from within the LibCore.
i'm not 100% confident that FontDatabase is the correct place.. seems
okay?
2025-05-26 12:14:29 -06:00
blukai
6e00a38099
LibGfx: Enable otf fonts
2025-05-26 12:14:29 -06:00
Timothy Flynn
2f9957c618
Everywhere: Format all python files with black
2025-05-22 16:21:42 +02:00
Timothy Flynn
7280ed6312
Meta: Enforce newlines around namespaces
...
This has come up several times during code review, so let's just enforce
it using a new clang-format 20 option.
2025-05-14 02:01:59 -06:00
aplefull
7da2339c89
LibGfx: Properly skip IDAT chunks without fcTL in APNG files
...
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
In the previous fix, we were still drawing IDAT data to the reference
frame even when no fcTL was present. This would cause rendering issues
when subsequent frames use APNG_BLEND_OP_OVER blending mode, as they
would composite over the incorrect reference frame. This commit adds a
simple check to properly skip any frame without an fcTL chunk.
2025-05-09 21:45:29 +02:00