mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:37:36 +00:00
LibPDF: Use Gfx::PathRasterizer for Adobe Type 1 font rendering
This gives much better visual results than painting the path directly. It also has the nice side effect that Type 1 fonts will now look much more similar to TrueType fonts, which use the same class :^) In addition, we can now cache glyph bitmaps for repeated use.
This commit is contained in:
parent
0b6299849e
commit
7c4f5b58be
4 changed files with 69 additions and 11 deletions
|
@ -20,9 +20,11 @@ class PS1FontProgram : public RefCounted<PS1FontProgram> {
|
|||
public:
|
||||
PDFErrorOr<void> parse(ReadonlyBytes const&, size_t cleartext_length, size_t encrypted_length);
|
||||
|
||||
Gfx::Path build_char(u32 code_point, Gfx::FloatPoint const& point, float width);
|
||||
RefPtr<Gfx::Bitmap> rasterize_glyph(u32 code_point, float width);
|
||||
Gfx::Path build_char(u32 code_point, float width);
|
||||
|
||||
RefPtr<Encoding> encoding() const { return m_encoding; }
|
||||
Gfx::FloatPoint glyph_translation(u32 code_point, float width) const;
|
||||
|
||||
private:
|
||||
struct Glyph {
|
||||
|
@ -46,6 +48,8 @@ private:
|
|||
Array<float, 24> postscript_stack;
|
||||
};
|
||||
|
||||
Gfx::AffineTransform glyph_transform_to_device_space(Glyph const&, float width) const;
|
||||
|
||||
PDFErrorOr<Glyph> parse_glyph(ReadonlyBytes const&, GlyphParserState&);
|
||||
PDFErrorOr<void> parse_encrypted_portion(ByteBuffer const&);
|
||||
PDFErrorOr<Vector<ByteBuffer>> parse_subroutines(Reader&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue