mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 13:01:29 +00:00
fix(print): M10 — Windows ya no cambia las letras de las fuentes TrueType incrustadas (#3132) (#4098)
* fix(print): M10 — Windows ya no cambia las letras de las fuentes TrueType incrustadas (#3132) Un subconjunto TrueType incrustado numera sus glifos de nuevo (en el subconjunto de Arial de ReportLab el espacio es el glifo 11; en la Arial instalada, el 3). Al imprimir en Windows, Windows.Data.Pdf → Direct2D → XPS conservaba esos números de glifo pero los dibujaba con la fuente instalada del mismo nombre: «Revisión» salía como «Wj{nxn» y la «z» en negrita como «Ä», tanto en las colas Brother como en la impresora Adobe PDF. La copia que va a la cola de Windows renombra ahora cada programa TrueType/OpenType incrustado como PdfCraftPrint<n>, en su tabla name y en el PDF (/BaseFont, /FontName; el subconjunto conserva su etiqueta), para que ninguna fuente instalada responda a ese nombre. Glifos, codificaciones y /ToUnicode no cambian. CUPS y Guardar como PDF reciben el PDF tal cual. Tests: extremo a extremo con impose (la página se renderiza idéntica antes y después, y el test falla sin el arreglo), fuentes que comparten programa, Type 0, reescritura por plataforma de la tabla name y programas dañados sin pánico. Falta comprobarlo en una impresora física con Windows. Fixes #3132 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(print): M10 — solo se renombran en el PDF las fuentes cuyo programa se reescribe (#3132) Si PdfCraft no puede leer o reescribir un programa incrustado (no es un sfnt, está dañado o pasa de 64 MiB), ahora conserva también su /BaseFont y su /FontName. Un visor que tampoco pueda cargarlo seguirá eligiendo el sustituto por el nombre original («Arial») en vez de por PdfCraftPrint<n>. Si no queda ningún programa reescrito, el PDF va a la cola tal cual. Lo señaló CodeRabbit en el PR #4098. Test nuevo: a_program_that_cannot_be_rewritten_keeps_its_name_in_the_pdf_too (falla con el comportamiento anterior). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(print): M10 — el renombrado de fuentes para Windows decodifica contra un presupuesto total (#3132) Cada programa ya tenía un tope de 64 MiB, pero un PDF con muchos programas distintos podía sumar mucho trabajo de descompresión al imprimir. Ahora todo el renombrado comparte un DecodeBudget de 512 MiB, el mecanismo que main acaba de introducir en print. Agotado el presupuesto, los programas que faltan conservan su nombre, igual que uno ilegible. Test nuevo: programs_past_the_shared_decode_budget_keep_their_names (falla si se decodifica sin presupuesto). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(print): M10 — también se renombran los CIDFont escritos dentro de su fuente Type 0 (#3132) Si /DescendantFonts lleva el CIDFont como diccionario en línea (en el propio Type 0 o en un objeto array aparte), el recorrido no llegaba a él. Cuando compartía programa con otra fuente, el programa se renombraba, pero el Type 0, el CIDFont y su descriptor seguían diciendo «Arial», y Windows podía volver a cruzarlos con la Arial instalada. Ahora el Type 0 se trata en el mismo recorrido, sin el segundo que hacía type0_names: un CIDFont en línea apunta su programa, y al renombrar se cambian el Type 0, el CIDFont y su descriptor en línea. Lo señaló CodeRabbit en el PR #4098. Test nuevo: a_cidfont_written_inside_its_type0_font_is_renamed_with_it (falla sin el arreglo). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(print): M10 — renamed_table ya no copia cada cadena de la tabla name (#3132) renamed_table copiaba el texto de cada registro antes de comprobar el tamaño del resultado: una tabla name de menos de 1 MB con 65.535 registros apuntando a una misma cadena de 65.535 bytes reservaba unos 4 GiB, y un fallo de reserva cierra el proceso al imprimir en Windows. Ahora la tabla se lee entera sin copiar ningún texto (cada registro guarda el offset y la longitud de origen) y después cada cadena distinta se guarda una sola vez: los registros que compartían cadena la siguen compartiendo y el almacén nunca pasa de lo que alcanzan los offsets de 16 bits. Una tabla que declara más registros de los que caben antes de sus cadenas se rechaza de entrada. Lo encontró RomanLis91 en el PR #4098. Tests nuevos: records_that_share_one_string_keep_sharing_it (falla con el código anterior) y a_name_table_claiming_more_records_than_fit_before_its_strings_is_refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
72e0bec32a
commit
6914607f17
10 files changed
+928
-3
No files matched your search
@@ -8202,7 +8202,7 @@ status = "shipped"
|
||||
commands = ["print.dialog"]
|
||||
tools = ["printers", "printer_options", "doc_print"]
|
||||
evidence = ["crates/print/src/tests.rs::spooler_arguments_and_printer_list", "crates/print/src/tests.rs::a_job_names_its_title_and_owner_to_the_spooler", "crates/print/src/tests.rs::a_job_keeps_the_title_and_owner_it_already_sets", "crates/print/src/tests.rs::a_submitted_job_reaches_lp_named", "crates/print/src/tests.rs::driverless_printers_join_the_list_without_a_queue", "crates/print/src/tests.rs::windows_printers_carry_one_default_and_keep_their_names", "crates/print/src/tests.rs::printer_options_come_from_the_ppd", "crates/print/src/tests.rs::printer_option_defaults_and_job_arguments", "crates/ui-egui/tests/it/print.rs::print_dialog_shows_the_printer_driver_options", "crates/ui-egui/tests/it/print.rs::printers_listed_in_the_background_preselect_the_default_unless_one_was_picked", "crates/ui-egui/src/workflows/web_print.rs::resolution_falls_with_the_sheet_count_and_long_jobs_are_refused", "crates/ui-egui/src/workflows/web_print.rs::large_sheets_are_drawn_within_the_pixel_cap_and_bad_sizes_are_refused", "crates/ui-egui/src/workflows/web_print.rs::a_sink_error_or_a_page_that_isnt_there_stops_the_job", "crates/print/src/tests.rs::a_command_that_never_answers_is_stopped_at_the_deadline", "crates/ui-egui/tests/it/print.rs::printer_options_are_read_off_the_gui_thread_and_a_dead_read_offers_nothing"]
|
||||
notes = "CUPS queues via lpstat -p -d and driverless destinations without a queue via lpstat -e; on Windows shared craft-print lists the queues (EnumPrinters), the default (GetDefaultPrinter) and each driver's two-sided support in this process, and draws jobs as vectors with Windows.Data.Pdf into the XPS print API with a driver-validated PrintTicket (exact paper, orientation, no scaling; portrait and landscape sheets in one job via /Rotate), starting no PowerShell, so printing works under App Control script enforcement (#1107); the printer list and submission run on workers; Save as PDF on every platform. Properties…: on CUPS the driver's own PPD job options (tray, paper type, finishing …, not installable options or what the dialog sets) for this job, sent as lp -o; on Windows the driver's Printing Preferences window (printui), saved as that printer's per-user defaults rather than per job. On the web: \"Browser's print dialog\" (the default there) reaches the system's printers through the browser; PdfCraft draws the sheets itself (300 dpi up to 100 sheets, 200 up to 300, 150 up to 1,000; at most 64 megapixels a sheet and 1 GiB a job) and prints them from a hidden iframe, one per printed page, a landscape sheet among portrait ones turned onto the paper; copies, two-sided and colour are chosen in the browser's dialog; a browser that refuses to print gets the print-ready PDF as a download. Checked in headless Chromium, not yet in Firefox or Safari; pictures, not vectors; sheets of another paper size print at their own size only where the browser honours named @page sizes (Chromium doesn't). Properties… on CUPS reads the driver options off the GUI thread and gives lpoptions ten seconds before the PPD defaults stand (#1818); on macOS lp jobs also carry the job name and owner (com.apple.print.JobInfo.PMJobName and PMJobOwner) that the system print dialog sends and some vendors' filters need (#5743). Not yet checked on a physical Kyocera printer."
|
||||
notes = "CUPS queues via lpstat -p -d and driverless destinations without a queue via lpstat -e; on Windows shared craft-print lists the queues (EnumPrinters), the default (GetDefaultPrinter) and each driver's two-sided support in this process, and draws jobs as vectors with Windows.Data.Pdf into the XPS print API with a driver-validated PrintTicket (exact paper, orientation, no scaling; portrait and landscape sheets in one job via /Rotate), starting no PowerShell, so printing works under App Control script enforcement (#1107); the printer list and submission run on workers; Save as PDF on every platform. Properties…: on CUPS the driver's own PPD job options (tray, paper type, finishing …, not installable options or what the dialog sets) for this job, sent as lp -o; on Windows the driver's Printing Preferences window (printui), saved as that printer's per-user defaults rather than per job. On the web: \"Browser's print dialog\" (the default there) reaches the system's printers through the browser; PdfCraft draws the sheets itself (300 dpi up to 100 sheets, 200 up to 300, 150 up to 1,000; at most 64 megapixels a sheet and 1 GiB a job) and prints them from a hidden iframe, one per printed page, a landscape sheet among portrait ones turned onto the paper; copies, two-sided and colour are chosen in the browser's dialog; a browser that refuses to print gets the print-ready PDF as a download. Checked in headless Chromium, not yet in Firefox or Safari; pictures, not vectors; sheets of another paper size print at their own size only where the browser honours named @page sizes (Chromium doesn't). Properties… on CUPS reads the driver options off the GUI thread and gives lpoptions ten seconds before the PPD defaults stand (#1818); on macOS lp jobs also carry the job name and owner (com.apple.print.JobInfo.PMJobName and PMJobOwner) that the system print dialog sends and some vendors' filters need (#5743). Not yet checked on a physical Kyocera printer. The copy sent to the Windows spooler renames every embedded TrueType/OpenType program (name table, /BaseFont, /FontName), because Windows drew a subset's renumbered glyphs with the installed font of the same name and printed shifted letters (#3132); not yet checked on a physical Windows printer."
|
||||
|
||||
[[feature]]
|
||||
id = "print.copies-collate"
|
||||
|
||||
Reference in new issue
Block a user