mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-02 22:41:47 -06:00
Fix Type 3 encoding entries and keep the font on an unmatched Q
WIN_ANSI[160] and MAC_ROMAN[202] map to space, and WIN_ANSI[173] maps to hyphen, matching the PDF encodings instead of the nbspace and sfthyphen names. An unmatched Q no longer resets the current font, so later glyphs stay recorded. Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -248,7 +248,11 @@ fn scan_content_stream(
|
||||
for op in parsed.ops {
|
||||
match op.op.as_slice() {
|
||||
b"q" => stack.push(current_font),
|
||||
b"Q" => current_font = stack.pop().unwrap_or(None),
|
||||
b"Q" => {
|
||||
if let Some(saved) = stack.pop() {
|
||||
current_font = saved;
|
||||
}
|
||||
}
|
||||
b"Tf" => {
|
||||
if let Some(name) = op.name(0) {
|
||||
current_font = resolve_font_in_res(ctx.doc, res, name).map(|(k, _)| k);
|
||||
|
||||
@@ -420,7 +420,7 @@ pub(crate) static WIN_ANSI: [Option<&[u8]>; 256] = [
|
||||
None,
|
||||
Some(b"zcaron"),
|
||||
Some(b"Ydieresis"),
|
||||
Some(b"nbspace"),
|
||||
Some(b"space"),
|
||||
Some(b"exclamdown"),
|
||||
Some(b"cent"),
|
||||
Some(b"sterling"),
|
||||
@@ -433,7 +433,7 @@ pub(crate) static WIN_ANSI: [Option<&[u8]>; 256] = [
|
||||
Some(b"ordfeminine"),
|
||||
Some(b"guillemotleft"),
|
||||
Some(b"logicalnot"),
|
||||
Some(b"sfthyphen"),
|
||||
Some(b"hyphen"),
|
||||
Some(b"registered"),
|
||||
Some(b"macron"),
|
||||
Some(b"degree"),
|
||||
@@ -721,7 +721,7 @@ pub(crate) static MAC_ROMAN: [Option<&[u8]>; 256] = [
|
||||
Some(b"guillemotleft"),
|
||||
Some(b"guillemotright"),
|
||||
Some(b"ellipsis"),
|
||||
Some(b"nbspace"),
|
||||
Some(b"space"),
|
||||
Some(b"Agrave"),
|
||||
Some(b"Atilde"),
|
||||
Some(b"Otilde"),
|
||||
|
||||
Reference in New Issue
Block a user