summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2023-01-26LibGfx: Add small convenience functions for Lines and AA PainterTorstennator
This patch adds the following some convenience functions: - Lines do now support rotated(), scaled() and translated() - AntiAliasingPainter has now a draw_line function that takes a FloatLine as argument
2023-01-25LibGfx: Fix typo in name of DeviceClass::InputDeviceNico Weber
2023-01-25LibGfx: Add checking for required tags to ICCProfileNico Weber
2023-01-25LibPDF: Load Type1C fonts when foundRodrigo Tobar
Now that our CFF parser is working we can load Type1C fonts in PDF, which are backed by a CFF stream.
2023-01-25LibPDF: Add initial CFF parsingRodrigo Tobar
The Compat Font Format specification (Adobe's Technical Note #5176) is used by PDF's Type1C fonts to store their data. While being similar in spirit to PS1 Type 1 Font Programs, it was designed for a more compact representation and thus space reduction (but an increment on complexity). It also shares most of the charstring encoding logic, which is why the CFF class also inherits from Type1FontProgram. This initial implementation is still lacking many details, e.g.: * It doesn't include all the built-in CFF SIDs * It doesn't support CFF-provided SIDs (defaults those glyphs to the space character) * More checks in general
2023-01-25LibPDF: Add name -> char code conversion in EncodingRodrigo Tobar
This is an operation that was already being done (sub-optimally) in PS1FontProgram, so we are replacing that. We will use this during CFF parsing too.
2023-01-25LibPDF: Add Reader::try_read for easier error propagationRodrigo Tobar
This will allow us to use TRY(reader.try_read) instead of having to verify the result of reader.remaining() before calling read.read().
2023-01-25LibPDF: Augment Type11FontProgram with Type2 capabilitiesRodrigo Tobar
The Type1FontProgram logic was based on the Adobe Type 1 Font Format; in particular, it implemented the CharStrings Dictionary section (charstring decoding, and most commands). In the case of Type1, these charstrings are read from a PS1 diciontary, with one entry per character in the font's charset. This has served us well for Type1 font rendering. When implementing Type1C font rendering, this wasn't enough. Type1C PDF fonts are specified in embedded CFF (Compact Font File) streams, which also contain a charstring dictionary with an entry for each character in the font's charset. These entries can be slightly different from those in a PS1 Font Program though: depending on a flag in the CFF, the entries will be encoded either in the original charstring format from the Adobe Type 1 Font Format, or in the "Type 2 Charstring Format" (Adobe's Technical Note #1577). This new format is for the most part a super-set of the original, with small differences, all in the name of making the representation as compact as possible: * The glyph's width is not specified via a separate command; instead it's an optional additional argument to the first command of the charstring stream (and even then, it's only the *difference* to a nominal character width specified in the CFF). * The interpretation of a 4-byte number is different from Type 1: in Type 1 this is a 4-byte unsigned integer, whereas in Type 1 it's a fixed decimal with 16 bits of fractional part. * Many commands accept a variable set of arguments, so they can draw more than one line/curve on a single go. These are all retro-compatible with Type 1's commands. All these changes are implemented in this patch in a backwards-compatible way. To ensure Type 1/2 behavior is accessed, a new parameter indicates which behavior is desired when decoding the charstring stream. I also took the chance to centralise some logic that was previously duplicated across the parse_glyph function. Common lambdas capture the logic for moving to, or drawing a line/curve to a given point and updating the glyph state. Similarly, some command logic, including reading parameters, are shared by several commands. Finally, I've re-organised the cases in the main switch to group together related commands.
2023-01-25LibPDF: Remove unused memberRodrigo Tobar
2023-01-25LibPDF: Add new Type1FontProgram base classRodrigo Tobar
We are planning to add support for CFF fonts to read Type1 fonts, and therefore much of the logic already found in PS1FontProgram will be useful for representing the Type1 fonts read from CFF. This commit moves the PS1-independent bits of PS1FontProgram into a new Type1FontProgram base class that can be used as the base for CFF-based Type1 fonts in the future. The Type1Font class uses this new type now instead of storing a PS1FontProgram pointer. While doing this refactoring I also took care of making some minor adjustments to the PS1FontProgram API, namely: * Its create() method is static and returns a NonnullRefPtr<Type1FontProgram>. * Many (all?) of the parse_* methods are now static. * Added const where possible. Notably, the Type1FontProgram also contains at the moment the code that parses the CharString data from the PS1 program. This logic is very similar in CFF files, so after some minor adjustments later on it should be possible to reuse most of it.
2023-01-25LibPDF: Avoid reading fields from moved-from Data objectRodrigo Tobar
This might not be an issue at the moment, but moved-from objects are usually in a unspecifed but valid state, meaning that we shouldn't read from them.
2023-01-25LibPDF: Record base font name read from documentRodrigo Tobar
This will be useful for debugging, or if we later on want to show all the fonts found in the document in an organised manner.
2023-01-25LibWasm: Use `Core::Stream` to read values in the bytecode interpreterTim Schumacher
2023-01-25LibWasm: Port the parser to `Core::Stream`Tim Schumacher
2023-01-25LibWasm: Port `Wasm::Printer` to `Core::Stream`Tim Schumacher
2023-01-25PixelPaint: Use background color when cropping layer to contentTim Ledbetter
This commit expands the functionality of the "Crop Image to Content" and "Crop Layer to Content" features by allowing them to detect and crop the background color of an image instead of just cropping transparent pixels. The background color is determined by looking at the corner pixels of the image. If no background color is found, the old behavior of cropping transparent pixels is retained.
2023-01-25LibGfx: Port GIFLoader to Core::StreamKarol Kosek
2023-01-25UserspaceEmulator: Use Core::Process::set_name()Sam Atkins
2023-01-25FileManager: Use Core::Process::set_name()Sam Atkins
2023-01-25LibCore: Add nice get/set_process_name() wrappers in Core::ProcessSam Atkins
`Process::get_name()` and `Process::set_name()` are basically the same as `get_process_name()` and `set_process_name()`, except making use of convenient Serenity standard types and returning ErrorOr, instead of char* and errno shenanigans. `Process::set_name()` has an optional `SetThreadName` parameter, for when you also want to set the thread's name to the same thing. That's true for the two places that use `set_process_name()`.
2023-01-25icc: Print each tag signature's spec nameNico Weber
The spec names are still a bit cryptic ("deviceMfgDescTag" for "device manufacturer description"), but less cryptic than just the fourcc. There's a private tag area, so this will only print the spec name of tags in the current spec. Private tags are in active use, e.g.: $ icc /Library/ColorSync/Profiles/WebSafeColors.icc ... Unknown tag ('dscm'): type 'mluc', offset 312, size 1490 (That's a v2 file. In v2, 'desc' has that strange textDescriptionType. In v4, 'desc' has type 'mluc' -- but in v2, it didn't yet, so Apple invented the private 'dscm' tag which has the description as an 'mluc'.)
2023-01-25LibGfx: Add names for all tag signatures in the v4 specNico Weber
Also add a function to map each tag signature to its name, that is a function that maps e.g. measurementTag to "measurementTag"sv. To implement this without too much repetition, use an x-macro. I used pdftotext on the icc v4 spec to extract the list of tags, and then manually cleaned it up a bit: https://github.com/nico/hack/blob/main/icc-tags.txt I then converted that to an x-macro using vim macros.
2023-01-25LibWeb: Use rect of containing block instead of parent to clip overflowAliaksandr Kalenik
Move overflow clipping from `before_children_paint` into separate method and call this method on containing block instead of parent. Example that got fixed: ```html <!DOCTYPE html><html><head><style> * { border: 2px solid black; } body { overflow: hidden; } .inner { position: absolute; width: 100px; height: 100px; background: lime; } </style></head><body><div class=inner></div> ```
2023-01-25LibWeb: Fix clip of hidden overflow when translated boxes are involvedAliaksandr Kalenik
There is a problem with current approach where overflow clip rectange is calculated by aggregating intersection of absolute padding boxes of boxes in containing block chain that resulting rectangle doesn't respect transform properties. To solve this problem `PaintableBox` is changed to store clip rectangle saved from painter because it does respect transform properties of all previously applied clip rectangles.
2023-01-24LibWeb: Propagate more StringBuilder errors in from StyleValuesMacDue
2023-01-24LibWeb: Remove some unchecked .value() calls in StyleValueMacDue
Here .to_string() was being called, which gives an ErrorOr<String>, then .value() was called on that without any checks. Cases like this should at least be .release_value_but_fixme_should_propagate_errors() which makes it clear the error is ignored, but here it's easy to propagate.
2023-01-24LibJS+LibLocale: Port Intl.NumberFormat to StringTimothy Flynn
2023-01-24LibJS: Use correct type for NumberFormat's UseGrouping internal slotTimothy Flynn
This was converted to an enumeration for Intl.NumberFormat V3 in commit 33698b961542618e64c6aede5213c3b0624399d0, but the default value was not updated (and it's a bit surprising it compiled at all, given that this is an 'enum class').
2023-01-24LibJS: Propagate OOM errors from all Intl.Locale *OfLocale AOsTimothy Flynn
2023-01-24LibJS: Add a fallible variant of Array::create_fromTimothy Flynn
2023-01-24LibJS: Propagate OOM errors from ApplyUnicodeExtensionToTagTimothy Flynn
These were missed in bff0e25ebed03db133c708a05c4f08bb5244d0ba.
2023-01-24LibJS: Remove DeprecatedString usage from Intl.PluralRulesTimothy Flynn
This can make due with a StringView.
2023-01-24FileManager+HackStudio+SpaceAnalyzer: Use File::can_delete_or_moveKarol Kosek
2023-01-24LibCore: Implement File::can_delete_or_move()Karol Kosek
Besides from a general check if a file's directory has write permissions, this also checks if the directory has set a sticky bit, meaning that only file owners and the directory owner can remove or move files in such directory. It's being used in /tmp for example.
2023-01-24FileManager: Calculate file action permissions for subsequent columnsKarol Kosek
Previously, the permission for the action was always calculated according to the first column.
2023-01-24LibWeb: Improve column width distributionAliaksandr Kalenik
2023-01-24LibWeb: Avoid division by zero in `distribute_width_to_columns`Aliaksandr Kalenik
2023-01-24LibWeb: Use table wrapper box width to resolve cells widthAliaksandr Kalenik
2023-01-24LibWeb: Use percentage column widths in `compute_table_measures`Aliaksandr Kalenik
This reverts commit 9b6fcd85913a7049041de6206aaa4cfcd535591c because not resolving percentage column widths breaks table width calculation.
2023-01-24LibJS: Add missing MUST in DisposableStack.prototype.usedavidot
Although the spec has a TRY here I believe this is a spec issue together with the missing TRY just above this change.
2023-01-24LibVideo/VP9: Move TreeSelection class to TreeParser.cppZaggy1024
The class no longer needs to be defined in the header, as it is only used in static functions.
2023-01-24icc: Print every TagData object only onceNico Weber
When several tags refer to the same TagData object, we now only print it the first time, and print "(see 'foob' above)" the following times, where `foob` is the tag identifier where we printed it the first time.
2023-01-24LibGfx: Dedupe ICC TagData objectsNico Weber
Several tags can refer to the same TagData. In particular, the rTRC, gTRC, bTRC tags usually all three refer to the same curve. Curve objects can be large, so allocate only a single TagData object in that case and make all tags point to it. (If we end up storing some cache in the curve object later on, this will also increase the effectiveness of that cache.)
2023-01-24LibGfx: Move TagTableEntry into read_tag_tableNico Weber
It's now used only there.
2023-01-24LibGfx: Pass offset and size instead of full TagTableEntry to read_tagNico Weber
read_tag() has no business knowing the tag signature.
2023-01-24WindowServer: Reuse existing `WindowManager::desktop_rect()` methodSam Atkins
2023-01-24LibGfx: Use `Core::Stream` to decode QOI imagesTim Schumacher
2023-01-24LibGfx: Pass the first QOI chunk byte to the operation implementationTim Schumacher
This reduces reliance on the peek operation, which the generic stream implementation does not support. This also corrects the naming, since "tag" wasn't entirely correct for some of the operations, where the tag takes up only part of a byte, with the rest being reserved for data.
2023-01-24LibGfx: Use x-mac-roman TextCodec for decoding MacRoman textNico Weber
2023-01-24LibTextCodec: Add a MacRoman decoderNico Weber
Allows displaying `<meta charset="x-mac-roman">` html files. (`:set fenc=macroman`, `:w` in vim to save in that encoding.)