Age | Commit message (Collapse) | Author |
|
Some fonts (like the Bootstrap Icons webfont) have bogus glyph offsets
in the `loca` table that point past the end of the `glyf` table.
AFAICT other rasterizers simply ignore these glyphs and treat them as if
they were missing. So let's do the same.
This makes https://changelog.serenityos.org/ actually work! :^)
|
|
The spec tells us that for glyph offsets in the "loca" table, if an
offset appears twice in a row, the index of the first one refers to a
glyph without an outline (such as the space character). We didn't check
for this, which would cause us to render a glyph outline where there
should have been nothing.
|
|
Introduced in 2c98eff, support for non-interleaved scans was not working
for frames with a number of MCU per line or column that is odd. Indeed,
the decoder assumed that they have scans that include a fabricated MCU
like scans with multiple components.
This patch makes the decoder handle images with a number of MCU per line
or column that is odd. To do so, as in the current decoder state we do
not know if components are interleaved at allocation time, we skip over
falsely-created macroblocks when filling them. As stated in 2c98eff,
this is probably not a good solution and a whole refactor will be
welcome.
It also comes with a test that open a square image with a side of 600px,
meaning 75 MCUs.
|
|
|
|
|
|
Small change to treat pixels outside the signed distance field bitmap
as outside the shape.
|
|
|
|
|
|
|
|
|
|
|
|
Each one of `[PBM, PGM, PPM]Loader` used yet another stream-like relic.
This patch ports all of them to `AK::Stream`.
|
|
The `read_image_data` function of each one of[PBM, PGM, PPM]Loader use
the same structure to read an image. This patch harmonizes the three
functions and use finite loops instead of reading until EOF. It allows
to quit early on bloated file, but it's mainly done for refactoring
purpose.
|
|
Reading the two magic bytes are always done in `decode()` by calling
`read_magic_number()`. So no need to read it twice.
|
|
|
|
These functions are:
- read_width
- read_height
- read_max_val
|
|
|
|
|
|
|
|
The function signature goes from:
`bool read_number(Streamer& streamer, TValue* value)`
to
`ErrorOr<u16> read_number(Streamer& streamer)`
It allows us to, on one hand use `ErrorOr` for error propagation,
removing an out parameter in the meantime, and on the other hand remove
the useless template.
|
|
|
|
This is mostly a simple grayscale bilinear scale, with an extra step
of computing the distance and alpha with a little smoothing. This
can be used to paint more scalable UI elements/icons from rather
small distance fields. A tiny 16x16 SDF seems to do a decent job
for simple icons.
|
|
This is very similar to the existing CharacterBitmap class but instead
intended for small static grayscale bitmaps (such as signed distance
fields).
|
|
Calling the `ycbcr_to_rgb` function still looks unsuitable for this
usage, but it does the job correctly.
|
|
|
|
|
|
The kerning value for a particular glyph may not be in
the first table. Continue until we either run out of tables or
we find an applicable value.
|
|
The stored ValueRecord in the font file only contains the fields
specified in the valueFormat field of the PairPosFormat1 table.
This means we need to construct the ValueRecord dynamically at runtime
and cannot bit_cast it to a struct.
|
|
read_value_record(u16 value_format, FixedMemoryStream& stream) takes
a bitmask value_format that describes the available fields of
the ValueRecord and a FixedMemoryStream at the location of the
next ValueRecord. It then advances the stream and returns a complete
ValueRecord.
|
|
At the moment, we only understand lookup type 2 (pair adjustment)
so let's ignore lookup tables with other types.
This fixes an issue where we'd choke on Noto Sans versions that come
with a chained context positioning lookup table (type 8).
Fixes #17924
|
|
Thanks to Timon for spotting this :^)
|
|
This patch extends the kerning support using the GPOS table to fonts
which use PairPosFormat1. Previously, only PairPosFormat2 was
supported.
|
|
This commit replaces usages of `Color::interpolate()` with
`Color::mixed_with()` in image scaling functions. The latter
uses premultiplied alpha, which results in more visually
pleasing edges when images are scaled against a transparent
background.
These changes affect the SmoothPixels and BilinearBlend scaling modes
of `Painter::draw_scaled_bitmap()` as well as the `Bitmap::scaled()`
function.
Fixes #17153.
|
|
This allows us to get rid of the raw pointer and size in the JPEG
context struct.
|
|
According to the spec (and the variable name), it should be an array of
offsets, not u16s. Noticed while watching Andreas' most recent video.
|
|
|
|
This patch parses enough of GPOS tables to be able to support the
kerning information embedded in Inter.
Since that specific font only applies positioning offsets to the first
glyph in each pair, I was able to get away with not changing our API.
Once we start adding support for more sophisticated positioning, we'll
need to be able to communicate more than a simple "kerning offset" to
the clients of this code.
|
|
|
|
|
|
Rather than having a style AND a field saying whether to use the style,
just make the style Optional.
|
|
|
|
This has no effect in practice: decode_bmp_v5_dib() is the last
thing called with the streamer object (...the streamer is passed
to set_dib_bitmasks(), but that doesn't read anything off it except
for DIBType::Info bitmaps, which v5 bitmaps aren't).
But dib_size is 16 larger for v5 than for v4, so we should read
16 bytes.
This is also useful for a hypothetical person who might look at
the reading code to figure out how the writing code should look like.
|
|
|
|
|
|
|
|
|
|
It's always 4 bytes, so the data fits in a String's inline buffer.
(Else I would've used a StringView.)
|
|
|
|
This method added function using host byte order, which is never what we
want.
In practice, it was fine because it was only called from add_u8()
(which is just 1 byte large) and add_as_big_endian() (since that did
endian swapping before calling the method). But the method doesn't
really help any and is dangerous, so remove it.
No behavior change.
|
|
PNG uses big-endian data internally.
|