mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:12:43 +00:00 
			
		
		
		
	 5e1499d104
			
		
	
	
		5e1499d104
		
	
	
	
	
		
			
			This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).
This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
		
	
			
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, Rodrigo Tobar <rtobarc@gmail.com>.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibGfx/Point.h>
 | |
| #include <LibPDF/Fonts/PDFFont.h>
 | |
| 
 | |
| namespace PDF {
 | |
| 
 | |
| class SimpleFont : public PDFFont {
 | |
| public:
 | |
|     PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&, Renderer const&) override;
 | |
| 
 | |
| protected:
 | |
|     PDFErrorOr<void> initialize(Document* document, NonnullRefPtr<DictObject> const& dict, float font_size) override;
 | |
|     virtual Optional<float> get_glyph_width(u8 char_code) const = 0;
 | |
|     virtual PDFErrorOr<void> draw_glyph(Gfx::Painter& painter, Gfx::FloatPoint point, float width, u8 char_code, Renderer const&) = 0;
 | |
|     RefPtr<Encoding>& encoding() { return m_encoding; }
 | |
|     RefPtr<Encoding> const& encoding() const { return m_encoding; }
 | |
| 
 | |
|     Gfx::AffineTransform& font_matrix() { return m_font_matrix; }
 | |
| 
 | |
| private:
 | |
|     RefPtr<Encoding> m_encoding;
 | |
|     RefPtr<StreamObject> m_to_unicode;
 | |
|     HashMap<u8, u16> m_widths;
 | |
|     u16 m_missing_width { 0 };
 | |
| 
 | |
|     // "For all font types except Type 3, the units of glyph space are one-thousandth of a unit of text space;
 | |
|     // for a Type 3 font, the transformation from glyph space to text space is defined by a font matrix specified
 | |
|     // in an explicit FontMatrix entry in the font."
 | |
|     Gfx::AffineTransform m_font_matrix { 1.0f / 1000.0f, 0, 0, 1.0f / 1000.0f, 0, 0 };
 | |
| };
 | |
| 
 | |
| }
 |