1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:58:12 +00:00
serenity/Userland/Libraries
Nico Weber bd74447dba LibPDF: Initial support for drawing CFF-based Type0 fonts
Together with the already-merged #23122, #23128, #23135, #23136, #23162,
and #23167, #23179, #23190, #23194 this adds initial support for
rendering some CFF-based Type0 fonts :^)

There's a long list of things that still need improving after this:

* A small number of CFF programs contain the charstring command 0,
  which is invalid. Currently, this makes us reject the whole font.

* Type1FontProgram::rasterize_glyph() is name-based. For CID-based
  fonts, we want a version that takes CIDs (character IDs) instead.
  For now, I'm printing the CID to a string and using that, yuck.
  (I looked into doing this nicely. I do want to do that, but I
  need to read up on how the `seac` type1 charstring command uses
  character names to identify parts of an accented character.
  Also, it looks like `seac`'s accented character handling moved
  over to `endchar` in type2 charstring commands (i.e. in CFF data),
  and it looks like we don't implement that at all. So I need to do
  more reading first, and I didn't want to block this on that.)

* The name for the first string in name-based CFF fonts looks wrong;
  added a FIXME for that for now.

* This supports the named Identity-H cmap only for now. Identity-H
  maps UTF16-BE values to glyph IDs with the idenity function, and
  assumes it's horizontal text. Other named cmaps in my test files are
  UniJIS-UCS2-H, UniCNS-UCS2-H, Identity-V, UniGB-UCS2-H, UniKS-UCS2-H.
  (There are also 2 files using the stream-based cmaps instead of the
  name-based ones.)

  * In particular, we can't draw vertical text (`-V`) yet

* Passing in the encoding to CFF::create() is awkward (it's nullptr
  for CID-keyed fonts), and it's also not necessary since
  `Type1Font::draw_glyph()` already does the "take encoding from PDF,
  and only from font if the PDF doesn't store one" dance.

* This doesn't cache glyphs but re-rasterizes them each time. Easy
  to add, but maybe I want to look at rotation first. And things
  don't feel glacial as-is.

* Type0Font::draw_glyph() is pretty similar to second half of
  Type1Font::draw_glyph()
2024-02-16 12:41:10 -05:00
..
LibAccelGfx LibAccelGfx+LibWeb+WebContent: Handle OpenGL Context init errors 2024-01-24 19:43:51 +01:00
LibArchive Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
LibAudio LibAudio/Wav: Always use u32 for the sample rate 2024-02-14 22:21:44 -05:00
LibC AK: Make IndexSequence use size_t 2024-02-11 18:53:00 +01:00
LibCards Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibChess Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
LibCMake LibSyntax+Userland: Make LibSyntax not depend on LibGUI 2023-08-29 07:57:39 -04:00
LibCodeComprehension Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibCompress LibCompress/Deflate: Remove three useless FIXMEs 2024-01-14 21:22:35 +01:00
LibConfig Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibCore Everywhere: Prefer _string when constructing strings from literals 2024-02-08 11:01:10 -05:00
LibCoredump Everywhere: Remove references to UserspaceEmulator 2024-01-29 20:20:55 +00:00
LibCpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibCrypt Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibCrypto LibCrypto: Add support for the POSIX cksum algorithm 2024-01-18 18:01:26 +03:30
LibDebug Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibDesktop LibDesktop: Add menu_name() to AppFile 2024-01-14 15:16:45 -07:00
LibDeviceTree Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
LibDiff AK: Remove ByteString from GenericLexer 2024-01-12 17:03:53 -07:00
LibDNS Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
LibDSP Everywhere: Prefer VERIFY over assert() 2024-02-05 07:03:53 -05:00
LibEDID Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibELF LibC+LibELF: Pass information from linker via magic lookup 2024-01-24 22:17:49 -07:00
LibFileSystem LibFileSystem+Everywhere: Return ByteString from read_link() 2024-01-16 08:42:34 +00:00
LibFileSystemAccessClient LibFileSystemAccessClient+Userland: Return file paths as ByteStrings 2024-01-29 23:14:39 +00:00
LibGemini Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
LibGfx LibGfx/OpenType: Replace a magic number with a calculation 2024-02-15 22:53:24 -05:00
LibGL LibGL: Add API stubs 2024-02-14 15:09:53 +01:00
LibGLSL LibGLSL: Add tests for GLSL parser 2023-08-18 15:29:48 +02:00
LibGPU Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
LibGUI Base: Create user default Music and Pictures directories 2024-02-05 16:30:52 +01:00
LibHTTP LibHTTP: Ensure the ending \r\n is present before trying to read a line 2024-01-21 21:13:58 +01:00
LibIDL LibIDL: Emit an error when two decls of the same function are present 2024-02-16 15:26:43 +01:00
LibImageDecoderClient ImageDecoder: Add plumbing to allow a client to request an ideal size 2024-01-07 20:10:22 +01:00
LibIMAP Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
LibIPC LibIPC: Avoid redundant copy of every tranferred IPC message 2024-01-03 10:17:00 +01:00
LibJIT Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
LibJS LibJS: Verify valid Duraton is made in DifferenceTemporalPlainDate 2024-02-16 12:27:23 -05:00
LibKeyboard Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibLine LibLine: Add internal functions to search character forwards & backwards 2024-02-11 08:50:51 +01:00
LibLocale Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
LibMain
LibManual Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
LibMarkdown Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
LibPartition Everywhere: Remove needless trailing semi-colons after functions 2023-07-08 10:32:56 +01:00
LibPCIDB Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibPDF LibPDF: Initial support for drawing CFF-based Type0 fonts 2024-02-16 12:41:10 -05:00
LibProtocol LibProtocol: Don't assume request creation will succeed across IPC 2024-01-10 23:37:57 +01:00
LibRegex Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
LibRIFF Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
LibSanitizer LibSanitizer: Add _abort variants of UBSan handlers 2023-08-13 05:14:07 +02:00
LibSemVer Libraries: Implement SemVer for version parsing and comparisons 2024-02-15 18:23:05 +01:00
LibSoftGPU LibSoftGPU: Optimize GPU::Vertex lists 2023-10-15 12:14:07 +02:00
LibSQL LibSQL: Allow constructing SQL values from a String 2024-01-26 20:22:39 +01:00
LibSymbolication AK+Everywhere: Remove JsonValue APIs with implicit default values 2024-01-21 15:47:53 -07:00
LibSyntax Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibSystem Everywhere: Resolve conflicts with LibC and libc++ 2023-06-27 12:40:38 +02:00
LibTest LibFileSystem+Userland: Return ByteString from real_path() 2024-01-16 08:42:34 +00:00
LibTextCodec LibTextCodec+AK: Don't validate UTF-8 strings twice 2023-12-30 13:49:50 +01:00
LibThreading Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibTimeZone Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibTLS RequestServer+LibTLS: Allow applications to specify multiple root certs 2024-02-08 08:49:32 -07:00
LibUnicode Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
LibUSBDB Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibVideo LibVideo: Replace DeprecatedFlyString with FlyString 2024-01-14 15:00:13 -07:00
LibVirtGPU LibGL+Lib*GPU: Set model view and projection matrices separately 2023-10-15 12:14:07 +02:00
LibVT LibVT: Ability to generate each of the 32 ASCII control characters 2024-02-11 08:50:51 +01:00
LibWasm Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
LibWeb LibWeb: Implement document.scrollingElement 2024-02-15 22:51:15 -05:00
LibWebSocket Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibWebView Ladybird+WebContent: Update IPC calls to handle multiple traversables 2024-02-03 20:51:37 -05:00
LibX86 Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
LibXML AK+LibXML+JSSpecCompiler: Move LineTrackingLexer to AK 2024-02-16 15:26:43 +01:00
CMakeLists.txt Libraries: Implement SemVer for version parsing and comparisons 2024-02-15 18:23:05 +01:00