mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-26 04:35:41 +03:00
LibPDF/CFF: Treat endchar in type 2 as type 2 "seac" when requested
With this, a character can be defined that uses two existing glyphs. This is useful for umlauts and the like, which then just need to reference e.g. the glyphs named "a" and "dieresis" and provide a translation. Makes umlauts appear on some PDFs using CFF type2 data in Type 1 fonts.
This commit is contained in:
parent
b2eaed43e9
commit
12859dfde5
Notes:
sideshowbarker
2024-07-17 03:27:40 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/12859dfde5 Pull-request: https://github.com/SerenityOS/serenity/pull/23299 Reviewed-by: https://github.com/gmta ✅
@ -648,8 +648,19 @@ PDFErrorOr<Type1FontProgram::Glyph> Type1FontProgram::parse_glyph(ReadonlyBytes
|
||||
|
||||
case EndChar: {
|
||||
maybe_read_width(Odd);
|
||||
if (is_type2)
|
||||
if (is_type2) {
|
||||
// Type 2 spec:
|
||||
// "In addition to the optional width (...) endchar may have four extra arguments that correspond exactly
|
||||
// to the last four arguments of the Type 1 charstring command “seac”"
|
||||
if (state.sp == 4) {
|
||||
auto achar = pop();
|
||||
auto bchar = pop();
|
||||
auto ady = pop();
|
||||
auto adx = pop();
|
||||
state.glyph.set_accented_character(AccentedCharacter { (u8)bchar, (u8)achar, adx, ady });
|
||||
}
|
||||
path.close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user