mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 13:01:29 +00:00
Add Folio (8.5 x 13 in / 612 x 936 pt) and F4 (210 x 330 mm / 595.28 x 935.43 pt) to the PAPERS preset table and map them to standard PWG 5101.1 media names (na_foolscap_8.5x13in and om_folio_210x330mm) in cups_media. Closes #4777. Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
This commit is contained in:
1 parent
abb06c70f8
commit
dc9d120fc8
2 files changed
+21
-1
No files matched your search
@@ -199,7 +199,7 @@ impl Default for Settings {
|
||||
}
|
||||
|
||||
/// Common paper sizes (points, portrait).
|
||||
pub const PAPERS: [(&str, (f64, f64)); 21] = [
|
||||
pub const PAPERS: [(&str, (f64, f64)); 23] = [
|
||||
("US Letter", (612.0, 792.0)),
|
||||
("US Legal", (612.0, 1008.0)),
|
||||
("Tabloid", (792.0, 1224.0)),
|
||||
@@ -221,6 +221,8 @@ pub const PAPERS: [(&str, (f64, f64)); 21] = [
|
||||
("A0", (2383.94, 3370.39)),
|
||||
("4 x 6 in label (101.6 x 152.4 mm)", (288.0, 432.0)),
|
||||
("US #10 Envelope (4.125 x 9.5 in)", (297.0, 684.0)),
|
||||
("Folio (8.5 x 13 in)", (612.0, 936.0)),
|
||||
("F4 (210 x 330 mm)", (595.28, 935.43)),
|
||||
];
|
||||
|
||||
/// `PAPERS` index of the 4 × 6 in shipping label.
|
||||
@@ -255,6 +257,8 @@ pub fn cups_media(index: usize) -> Option<&'static str> {
|
||||
"A1" => "iso_a1_594x841mm",
|
||||
"A0" => "iso_a0_841x1189mm",
|
||||
"US #10 Envelope (4.125 x 9.5 in)" => "Env10",
|
||||
"Folio (8.5 x 13 in)" => "na_foolscap_8.5x13in",
|
||||
"F4 (210 x 330 mm)" => "om_folio_210x330mm",
|
||||
_ if index == LABEL_PAPER => "w288h432",
|
||||
// A size added to PAPERS without a name here: its tests fail, and meanwhile the queue's
|
||||
// paper stands, as it did for every size before #1583.
|
||||
|
||||
@@ -985,10 +985,26 @@ fn every_paper_reaches_the_spooler_by_a_name_of_its_size() {
|
||||
("A0", "iso_a0_841x1189mm"),
|
||||
("4 x 6 in label (101.6 x 152.4 mm)", "w288h432"),
|
||||
("US #10 Envelope (4.125 x 9.5 in)", "Env10"),
|
||||
("Folio (8.5 x 13 in)", "na_foolscap_8.5x13in"),
|
||||
("F4 (210 x 330 mm)", "om_folio_210x330mm"),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/// #4777: Folio (8.5 × 13 in) and F4 (210 × 330 mm) presets are offered, fed by their
|
||||
/// PWG 5101.1 media names (`na_foolscap_8.5x13in` and `om_folio_210x330mm`) and laid out at their
|
||||
/// proper dimensions.
|
||||
#[test]
|
||||
fn folio_and_f4_paper_sizes_are_available() {
|
||||
let folio = PAPERS.iter().position(|(name, _)| *name == "Folio (8.5 x 13 in)").expect("Folio present");
|
||||
assert_eq!(cups_media(folio), Some("na_foolscap_8.5x13in"));
|
||||
assert_eq!(PAPERS[folio].1, (612.0, 936.0));
|
||||
|
||||
let f4 = PAPERS.iter().position(|(name, _)| *name == "F4 (210 x 330 mm)").expect("F4 present");
|
||||
assert_eq!(cups_media(f4), Some("om_folio_210x330mm"));
|
||||
assert_eq!(PAPERS[f4].1, (595.28, 935.43));
|
||||
}
|
||||
|
||||
/// #2734: the US #10 envelope (4.125 × 9.5 in) is offered, fed by its PPD name and laid out at
|
||||
/// its own size.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user