1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

LibPDF: Add name -> char code conversion in Encoding

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.
This commit is contained in:
Rodrigo Tobar 2023-01-18 23:57:11 +08:00 committed by Andreas Kling
parent c592b889bf
commit 1ec4ad5eb6
3 changed files with 11 additions and 2 deletions

View file

@ -171,6 +171,14 @@ CharDescriptor const& Encoding::get_char_code_descriptor(u16 char_code) const
return const_cast<Encoding*>(this)->m_descriptors.ensure(char_code);
}
u16 Encoding::get_char_code(DeprecatedString const& name) const
{
auto code_iterator = m_name_mapping.find(name);
if (code_iterator != m_name_mapping.end())
return code_iterator->value;
return 0;
}
bool Encoding::should_map_to_bullet(u16 char_code) const
{
// PDF Annex D table D.2, note 3: