mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-13 14:22:25 +00:00
M10: the symbolic glyph-name patch is hayro-interpret patch 53 (#3962)
main added hayro-interpret patches 51 and 52 (bounded saved graphics states, /W2 runs past the largest CID), so this branch's patch is now 53 in vendor/README.md; the code comments that cite it follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175FWj4xFhMhSH3UpMU8DSC
This commit is contained in:
1 parent
8c3812499c
commit
53d0e36533
2 files changed
+6
-6
No files matched your search
@@ -1630,7 +1630,7 @@ fn rounded_pixel_budget_invalid_requests_never_reach_allocator() {
|
||||
/// order, 29 below ASCII; the font's own `cmap` maps them to the right glyphs. Read as WinAnsi
|
||||
/// the text came out shifted (`Solid` as `6ROLG`), in the editor and in Word export alike. The
|
||||
/// `post` table names the glyph each code selects, which gives the text (vendored
|
||||
/// hayro-interpret patch 51). A font with an `/Encoding` still reads its codes through it.
|
||||
/// hayro-interpret patch 53). A font with an `/Encoding` still reads its codes through it.
|
||||
#[test]
|
||||
fn a_symbolic_truetype_font_without_an_encoding_reads_its_glyph_names() {
|
||||
use skrifa::MetadataProvider;
|
||||
|
||||
+5
-5
@@ -191,7 +191,7 @@ impl TrueTypeFont {
|
||||
|
||||
match &self.kind {
|
||||
Kind::Embedded(e) => {
|
||||
// PdfCraft patch (51): see `EmbeddedKind::symbolic_text`.
|
||||
// PdfCraft patch (53): see `EmbeddedKind::symbolic_text`.
|
||||
if let Some(text) = e.symbolic_text(code as u8) {
|
||||
let mut chars = text.chars();
|
||||
return Some(match (chars.next(), chars.next()) {
|
||||
@@ -230,7 +230,7 @@ struct EmbeddedKind {
|
||||
cached_mappings: RefCell<HashMap<u8, GlyphId>>,
|
||||
/// PostScript name from the PDF.
|
||||
postscript_name: Option<String>,
|
||||
/// PdfCraft patch: (see vendor/README.md hayro-interpret (51)) the text each glyph's `post`
|
||||
/// PdfCraft patch: (see vendor/README.md hayro-interpret (53)) the text each glyph's `post`
|
||||
/// table name stands for, for the names that stand for any (`glyph_name_text`).
|
||||
text_names: HashMap<GlyphId, String>,
|
||||
}
|
||||
@@ -315,7 +315,7 @@ impl EmbeddedKind {
|
||||
.or_else(|| win_ansi::get(code))
|
||||
}
|
||||
|
||||
/// PdfCraft patch (51): a symbolic font without an encoding selects its glyphs through its
|
||||
/// PdfCraft patch (53): a symbolic font without an encoding selects its glyphs through its
|
||||
/// own `cmap`, so its codes need not mean anything in WinAnsi. FrameMaker files distilled
|
||||
/// with Distiller 3 number them in the Macintosh glyph order, 29 below ASCII, and read as
|
||||
/// WinAnsi `Solid` came out as `6ROLG` (#3962). The name the `post` table gives the glyph the
|
||||
@@ -461,7 +461,7 @@ pub(crate) enum Width {
|
||||
Missing,
|
||||
}
|
||||
|
||||
/// PdfCraft patch (51): the text a glyph name stands for, by the rules of the Adobe Glyph List
|
||||
/// PdfCraft patch (53): the text a glyph name stands for, by the rules of the Adobe Glyph List
|
||||
/// specification, as pdfcraft-fonts' `glyph_text` reads them for the editor: drop any suffix
|
||||
/// from the first `.` (`a.ss01` is `a`), then each `_`-separated component is a list name,
|
||||
/// `uni` and groups of four hex digits, or `u` and four to six. `None` when any component is
|
||||
@@ -587,7 +587,7 @@ pub(crate) fn read_encoding(dict: &Dict<'_>) -> (Encoding, HashMap<u8, String>)
|
||||
mod tests {
|
||||
use super::glyph_name_text;
|
||||
|
||||
/// PdfCraft patch (51): glyph names read as pdfcraft-fonts' `glyph_text` reads them.
|
||||
/// PdfCraft patch (53): glyph names read as pdfcraft-fonts' `glyph_text` reads them.
|
||||
#[test]
|
||||
fn glyph_names_read_by_the_adobe_glyph_list_rules() {
|
||||
for (name, expected) in [
|
||||
|
||||
Reference in new issue
Block a user