Age | Commit message (Collapse) | Author |
|
|
|
Ultimately, we should find a way to route all emoji access through
the font code, but for now, this patch adds a special case for fonts
that are known to have embedded color bitmaps so we can test them.
|
|
This patch adds support for index format 1 and image format 17.
This is enough to get Noto Color Emoji working.
|
|
This patch does three things:
- Font::has_color_bitmaps() (true if CBLC and CBDT are present)
- Glyph now knows when its bitmap comes from a color bitmap font
- Painter draws color bitmap glyphs with the appropriate scaling etc
|
|
|
|
These tables are not guaranteed to be present in all font files.
|
|
This also removes DirIterator::error_string(), since the same strerror()
string will be included when you print the Error itself. Except in `ls`
which is still using fprintf() for now.
|
|
The override on BitmapFont remains, as that is actually used within
the FontEditor program.
|
|
This returns the font's size (distance between ascender and descender)
in pixels, rounded up to the nearest integer.
This is the number we want to use in a lot of UI code, so let's have
a friendly API for it instead of ceil'ing the pixel_size() in a million
random places.
|
|
|
|
Similar to the FontDatabase, this will be needed for Ladybird to find
emoji images. We now generate just the file name of emoji image in
LibUnicode, and look for that file in the specified path (defaulting to
/res/emoji) at runtime.
|
|
All callers are now aware of multi-code point emoji (and must remain so
going forward).
|
|
|
|
Rather than formatting the paths at runtime, as vformat is quite heavy
in a profile.
|
|
Keycap emoji, for example, begin with ASCII digits. Instead, check the
first code point for the Emoji Unicode property.
On a profile of scrolling around on the welcome page in the Browser,
this raises the runtime percentage of Font::glyph_or_emoji_width from
about 0.8% to 1.3%.
|
|
On a profile of scrolling around on the welcome page in the Browser,
this drops the runtime percentage of Font::glyph_or_emoji_width from
about 70% to 0.8%.
|
|
Currently, we compute the width of text one code point at a time. This
ignores grapheme clusters (emoji in particular). One effect of this is
when highlighting a multi-code point emoji. We will errantly increase
the highlight rect to the sum of all code point widths, rather than
just the width of the resolved emoji bitmap.
|
|
This allows consideration of multi-code point glyphs.
|
|
|
|
|
|
|
|
We don't need a full String/DeprecatedString inside this function, so we
might as well not force users to create one.
|
|
|
|
|
|
As usual, this removes many unused includes and moves used includes
further down the chain.
|
|
|
|
|
|
Width need to be passed to `FontDatabase::get()` to resolve font name
unambiguously.
|
|
This patch adds a "GlyphPage" cache which stores the mapping between
code points and glyph IDs in a segmented table of "pages".
This makes Font::glyph_id_for_code_point() significantly faster by
not reparsing the font tables every time you call it.
In the future, we can add more information to GlyphPage (such as
horizontal metrics for each glyph) to further reduce time spent in
text layout and painting.
|
|
This also removes a few cases where the respective header wasn't
actually required to be included.
|
|
|
|
|
|
As the different Cmap encoding records are guaranteed to be sorted by
their platform ID, we would previously prefer the Macintosh platform
because of its lower ID value. However, this platform is split up into
a lot of encoding formats for different languages, and usually only
English is included. This meant that we could not handle most unicode
characters anymore.
The Windows platform now takes precedence again, as it can handle
arbitrary code points in its supported encodings.
This solution is still far from perfect, but it makes this regression
disappear for now.
|
|
Those don't have any non-try counterpart, so we might as well just omit
it.
|
|
Instead of recomputing the pixel metrics over and over, we can just
cache them with the font and avoid a bunch of expensive computation.
|
|
|
|
These probably won't need to stick around forever, but will be helpful
for creating some debug utilities.
|
|
These contain the font and CVT programs respectively.
|
|
This defines all the OpenType opcodes/instructions from the
specification:
https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions
Each instructions has mnemonic and a range of possible opcodes (as some
of the bits are pretty much immediate value flags).
There's a little helper Instruction struct for accessing the flags and
any associated data (in the case of PUSH instructions).
Then the InstructionStream provides a way of iterating over all the
instructions in some bytes.
|
|
DeprecatedFlyString relies heavily on DeprecatedString's StringImpl, so
let's rename it to A) match the name of DeprecatedString, B) write a new
FlyString class that is tied to String.
|
|
|
|
|
|
While this subtable ID is supposed to be deprecated, it is used heavily
in PDF files.
It supports mapping one or two-byte values, with quite a large list of
encodings to tell you which one to expect.
For our use case, we ignore this encoding ID and just pick the first
subtable with this platform ID. Unsupported encodings will get caught
by Subtable::glyph_id_for_code_point() anyway.
|
|
This is the closest thing we have to the OpenType line gap metrics.
Using it here will allow us to unify more of the text painting logic.
|
|
This was returning the point height which didn't match BitmapFont and
led to bogus line heights in GUI::TextEditor.
|
|
|
|
Return a float, and fix a bogus calculation of ascender + descender.
|
|
|
|
|
|
|