1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172 | //! A sheet a printer can run without asking the sender a single question.
//!
//! The finished page is smaller than the paper it is drawn on: the ink runs
//! past the blade so that a cut a hair off still lands in colour, the marks
//! stand outside the ink so the blade takes them away, and every colour is said
//! in the four printing inks rather than in the light of a screen. The page
//! names the three boxes that say all of it.
//!
//! Hand a press profile on the command line and the file claims PDF/X-4.
//! Without one it claims nothing, and says on the page why.
//!
//! The sheet is written in the language `HQF_PDF_LANG` names. What the file
//! writes is not: `MediaBox`, `BleedBox`, `TrimBox`, `Title` and `Trapped` are
//! the entries a press looks up, `Custom` is the name ISO 32000-1 asks for
//! where the condition is not a registered one, and `sRGB IEC61966-2.1` is the
//! profile's own name. The page states each of them beside what it means.
//!
//! Usage: `cargo run --example write_print_ready -- tmp/print.pdf [font.ttf]
//! [press.icc]`
//! `HQF_PDF_LANG=fr cargo run --example write_print_ready`
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use hqf_pdf::color::icc;
use hqf_pdf::content::Content;
use hqf_pdf::metadata::xmp::{Metadata, PdfX, Trapped};
use hqf_pdf::{
Cmyk, Document, Error, Font, FontHandle, IccBased, OutputIntent, Page, Rect, Version,
};
#[path = "shared/out.rs"]
mod out;
#[path = "shared/licence.rs"]
mod licence;
#[path = "shared/language.rs"]
mod language;
#[path = "shared/failure.rs"]
mod failure;
use language::Language;
/// The font the example draws with when none is given on the command line.
fn default_font() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("fonts")
.join("DejaVuSans.ttf")
}
/// The date the document says it was made on, so that two runs of the example
/// produce the same bytes.
const MADE: &str = "2026-07-25T10:00:00+02:00";
/// How far past the blade the ink runs.
const BLEED_OVER: f64 = 9.0;
/// How much paper is left outside the ink for the marks.
const MARK_ROOM: f64 = 27.0;
/// How long one arm of a corner mark is.
const MARK_LENGTH: f64 = 18.0;
/// How much paper stands outside the finished page on every side.
const MARGIN: f64 = BLEED_OVER + MARK_ROOM;
/// The finished page: where the blade falls, in the sheet's own coordinates.
const TRIM: (f64, f64, f64, f64) = (MARGIN, MARGIN, 400.0, 620.0);
/// The whole sheet: the finished page, the ink that runs past it, and the room
/// the marks stand in.
const SHEET: (f64, f64) = (TRIM.2 + MARGIN + MARGIN, TRIM.3 + MARGIN + MARGIN);
/// The left edge of everything drawn inside the finished page.
const LEFT: f64 = 56.0;
/// How far right of the left edge the second column of a stated pair starts.
const COLUMN: f64 = 112.0;
/// The band across the head of the sheet, and the bar across its foot.
const BAND: Cmyk = Cmyk::new(0.85, 0.55, 0.0, 0.25);
/// The line under the title, on the band.
const ON_BAND: Cmyk = Cmyk::new(0.22, 0.1, 0.0, 0.0);
/// A panel's heading.
const HEADING: Cmyk = Cmyk::new(0.0, 0.0, 0.0, 1.0);
/// A panel's body.
const BODY: Cmyk = Cmyk::new(0.0, 0.0, 0.0, 0.72);
/// What a stated pair is called.
const LABEL: Cmyk = Cmyk::new(0.0, 0.0, 0.0, 0.5);
/// What it says.
const VALUE: Cmyk = Cmyk::new(0.0, 0.0, 0.0, 0.85);
/// All four inks at once, which prints on every plate.
const REGISTRATION: Cmyk = Cmyk::new(1.0, 1.0, 1.0, 1.0);
/// The house sending the sheet, which the footer names before saying what the
/// sheet is.
const HOUSE: &str = "HQF Development";
/// The size the sheet's heading is set at, in points.
const HEADING_SIZE: f64 = 19.0;
/// The size the line under that heading is set at, in points.
const STRAPLINE: f64 = 9.0;
/// The size the line in the margin is set at, in points.
const SLUG: f64 = 6.0;
/// The size a panel's heading is set at, in points.
const PANEL: f64 = 10.5;
/// The size a panel's body is set at, in points.
const PANEL_BODY: f64 = 8.0;
/// The size a stated pair is set at, in points.
const PAIR: f64 = 8.5;
/// The size the name under a swatch is set at, in points.
const SWATCH_NAME: f64 = 7.5;
/// Where the first line of the closing note sits, and how far below one line
/// the next one does, in points.
const CLOSING_TOP: f64 = 104.0;
/// See [`CLOSING_TOP`].
const CLOSING_STEP: f64 = 12.0;
/// The head of the sheet: the flood, its title and the line under it.
const BAND_BOTTOM: f64 = 545.0;
/// The foot of the sheet: the bar the footer is written on.
const BAR_TOP: f64 = 52.0;
/// The width of one ink swatch, the gap to the next, their bottom edge and
/// their height.
const SWATCH: f64 = 64.0;
/// See [`SWATCH`].
const SWATCH_GAP: f64 = 10.0;
/// See [`SWATCH`].
const SWATCH_Y: f64 = 292.0;
/// See [`SWATCH`].
const SWATCH_HEIGHT: f64 = 42.0;
/// What each ink swatch is made of, in the order `Words::inks` names them.
const MIXES: [&str; 5] = [
"100 0 0 0",
"0 100 0 0",
"0 0 100 0",
"0 0 0 100",
"100 100 100 100",
];
/// The colour each swatch is laid in, in the same order.
const INKS: [Cmyk; 5] = [
Cmyk::new(1.0, 0.0, 0.0, 0.0),
Cmyk::new(0.0, 1.0, 0.0, 0.0),
Cmyk::new(0.0, 0.0, 1.0, 0.0),
Cmyk::new(0.0, 0.0, 0.0, 1.0),
REGISTRATION,
];
/// What the caller says the condition is called when a profile is handed over
/// on the command line.
///
/// ISO 32000-1 table 365 asks for `Custom` where the condition is not one of
/// the registered characterizations, which a profile read off a disk is not.
const CUSTOM: &str = "Custom";
/// What the condition is called when the library's own profile is used, and the
/// profile's own name, which is not a description of it.
const BUILT_IN: (&str, &str) = ("sRGB", "sRGB IEC61966-2.1");
/// What the file writes for each of the three boxes and each of the two entries
/// the page states, in the order they are set. These are the names a press
/// looks up, and they are the same in every language.
const BOXES: [&str; 3] = ["MediaBox", "BleedBox", "TrimBox"];
/// See [`BOXES`].
const ENTRIES: [&str; 2] = ["Title", "Trapped"];
/// What the file writes for the trapping entry, which the page states beside
/// what it means.
const TRAPPED: &str = "No";
/// The words the sheet is written in, one set per language.
///
/// What is not language stays out of it: the entries a press looks up, the
/// numbers the boxes measure, the four ink mixes, and the profile's own name.
#[derive(Debug)]
struct Words {
/// What the job is called, on the page and in what the file says of itself.
title: &'static str,
/// What the sheet is headed by.
heading: &'static str,
/// The line under that heading.
strapline: &'static str,
/// What the footer says the sheet is, after the name of the house sending
/// it.
footer: &'static str,
/// What the line in the margin calls the whole sheet, the finished page,
/// the ink that runs past it, and the inks it is separated for.
slug: [&'static str; 4],
/// What each of the five panels is headed by.
panels: [&'static str; 5],
/// The line under the first panel.
boxes_note: &'static str,
/// What each of the three boxes is for, after the size it measures.
boxes: [&'static str; BOXES.len()],
/// The lines under the second panel.
ink_stops: [&'static str; 3],
/// The lines under the third panel.
four_inks: [&'static str; 2],
/// What each printing ink is called, in the order `INKS` lays them.
inks: [&'static str; INKS.len()],
/// The lines under the fourth panel.
marks: [&'static str; 3],
/// What the last two pairs the page states are called.
stated_for: &'static str,
/// See [`Words::stated_for`].
claim: &'static str,
/// What the trapping entry means, after the word the file writes.
trapped: &'static str,
/// What stands before and after the size of the profile the file is stated
/// for.
profile_of: &'static str,
/// See [`Words::profile_of`].
bytes: &'static str,
/// What the claim says when the file makes none.
no_claim: &'static str,
/// What the condition a profile off the command line describes is called.
custom_info: &'static str,
/// The closing note of a file that claims the print standard.
claimed: [&'static str; 5],
/// The closing note of a file that claims nothing.
unclaimed: [&'static str; 5],
}
impl Words {
/// The words the sheet is written in, in `language`.
fn of(language: Language) -> &'static Self {
language::pick(&WORDS, language)
}
}
/// The sheet in English.
const ENGLISH: Words = Words {
title: "Spring catalogue, cover",
heading: "Ready for the press",
strapline: "One sheet, handed over with nothing left for the printer to ask about.",
footer: "one sheet, ready to run",
slug: ["sheet", "trim", "bleed", "CMYK"],
panels: [
"The three boxes this sheet states",
"Where the ink stops",
"Four inks, not three",
"The marks stand outside the ink",
"What the file says about itself",
],
boxes_note: "The paper is larger than the finished page; the ink runs to a box in between.",
boxes: [
"the whole sheet, marks and all",
"how far the ink runs",
"where the blade falls",
],
ink_stops: [
"The band at the head of this page runs 9 points past the blade on three",
"sides, and the bar at its foot does the same. A blade that falls a point",
"wide still lands in ink, so the finished page carries no white edge.",
],
four_inks: [
"Every colour on this page is said in the four printing inks. A screen colour",
"would have to be separated by somebody — and that somebody is the printer.",
],
inks: ["Cyan", "Magenta", "Yellow", "Black", "Registration"],
marks: [
"The corner marks are drawn past the bleed, so the blade takes them away",
"with the rest of the paper. They are laid in all four inks at once: a",
"mark that prints on every plate is a mark the press lines its plates by.",
],
stated_for: "Stated for",
claim: "Claim",
trapped: "said in the file, not left unknown",
profile_of: "a profile of",
bytes: "bytes",
no_claim: "none — the note below says why",
custom_info: "A press profile handed over on the command line",
claimed: [
"This file claims PDF/X-4, through the profile handed on the command line.",
"The claim is written twice over: the output intent answers for it as",
"GTS_PDFX, and the metadata names the part claimed. The library refuses the",
"claim unless the file carries the press profile, a title, a word on",
"trapping and a trim box on every page. All four are here.",
],
unclaimed: [
"This file makes no PDF/X-4 claim. That claim promises a press it can run",
"the file without asking back, and the promise rests on the profile of the",
"press the job was separated for. The library builds one profile, sRGB, and",
"sRGB describes a screen: it is not allowed to stand in for a press. Hand a",
"press profile on the command line and the same sheet claims PDF/X-4.",
],
};
/// The sheet in French.
const FRENCH: Words = Words {
title: "Catalogue de printemps, couverture",
heading: "Prête pour l’impression",
strapline: "Une feuille remise sans laisser la moindre question à l’imprimeur.",
footer: "une feuille, prête pour le tirage",
slug: ["feuille", "coupe", "fond perdu", "CMJN"],
panels: [
"Les trois boîtes que cette feuille déclare",
"Où l’encre s’arrête",
"Quatre encres, pas trois",
"Les repères restent hors de l’encre",
"Ce que le fichier dit de lui-même",
],
boxes_note: "Le papier est plus grand que la page finie ; l’encre va jusqu’à une boîte \
intermédiaire.",
boxes: [
"la feuille entière, repères compris",
"jusqu’où va l’encre",
"où tombe la lame",
],
ink_stops: [
"Le bandeau en tête de page dépasse la lame de 9 points sur trois côtés,",
"et la barre du pied fait de même. Une lame qui tombe un point à côté",
"tombe encore dans l’encre : la page finie n’a aucun bord blanc.",
],
four_inks: [
"Chaque couleur de cette page est exprimée dans les quatre encres d’imprimerie. Une",
"couleur d’écran devrait être séparée par quelqu’un, et ce quelqu’un serait l’imprimeur.",
],
inks: ["Cyan", "Magenta", "Jaune", "Noir", "Repérage"],
marks: [
"Les repères d’angle sont tracés au-delà du fond perdu, donc la lame les",
"emporte avec le reste du papier. Ils sont posés dans les quatre encres à la",
"fois : un repère présent sur chaque plaque est celui sur lequel la presse cale \
ses plaques.",
],
stated_for: "Déclarée pour",
claim: "Revendication",
trapped: "indiqué dans le fichier, pas laissé inconnu",
profile_of: "un profil de",
bytes: "octets",
no_claim: "aucune — la note ci-dessous dit pourquoi",
custom_info: "Un profil de presse passé en ligne de commande",
claimed: [
"Ce fichier revendique PDF/X-4, grâce au profil passé en ligne de commande.",
"La revendication est écrite deux fois : l’intention de sortie en répond sous",
"le nom GTS_PDFX, et les métadonnées nomment la partie revendiquée. La",
"bibliothèque la refuse si le fichier ne contient pas le profil de presse, un titre,",
"une mention du grossi-maigri et une boîte de coupe par page. Les quatre y sont.",
],
unclaimed: [
"Ce fichier ne revendique pas PDF/X-4. Cette revendication promet à l’imprimeur",
"qu’il peut tirer le fichier sans question, et la promesse repose sur le profil de la",
"presse pour laquelle le travail a été séparé. La bibliothèque ne fournit qu’un profil,",
"sRGB, qui décrit un écran : il ne peut pas tenir lieu de presse. Passez un profil de",
"presse en ligne de commande et la même feuille revendique PDF/X-4.",
],
};
/// The sheet in Dutch.
const DUTCH: Words = Words {
title: "Voorjaarscatalogus, omslag",
heading: "Klaar voor de pers",
strapline: "Eén blad, aangeleverd zonder dat de drukker iets hoeft te vragen.",
footer: "één blad, klaar om te drukken",
slug: ["blad", "snijlijn", "afloop", "CMYK"],
panels: [
"De drie kaders die dit blad noemt",
"Waar de inkt ophoudt",
"Vier inkten, geen drie",
"De tekens staan buiten de inkt",
"Wat het bestand over zichzelf zegt",
],
boxes_note: "Het papier is groter dan de afgewerkte pagina; de inkt loopt tot een kader ertussen.",
boxes: [
"het hele blad, met tekens en al",
"hoe ver de inkt loopt",
"waar het mes valt",
],
ink_stops: [
"De band bovenaan deze pagina loopt aan drie kanten 9 punten voorbij het mes,",
"en de balk onderaan doet hetzelfde. Een mes dat een punt verkeerd",
"valt, valt nog in de inkt, dus de afgewerkte pagina heeft geen witte rand.",
],
four_inks: [
"Elke kleur op deze pagina is uitgedrukt in de vier drukinkten. Een schermkleur",
"zou door iemand gescheiden moeten worden, en die iemand is de drukker.",
],
inks: ["Cyaan", "Magenta", "Geel", "Zwart", "Register"],
marks: [
"De hoektekens staan voorbij de afloop, dus neemt het mes ze mee",
"met de rest van het papier. Ze liggen in alle vier inkten tegelijk: een",
"teken dat op elke plaat drukt, is een teken waarop de pers haar platen uitlijnt.",
],
stated_for: "Vermeld voor",
claim: "Claim",
trapped: "in het bestand vermeld, niet onbekend gelaten",
profile_of: "een profiel van",
bytes: "bytes",
no_claim: "geen: de notitie hieronder zegt waarom",
custom_info: "Een persprofiel meegegeven op de opdrachtregel",
claimed: [
"Dit bestand claimt PDF/X-4, via het profiel dat op de opdrachtregel is meegegeven.",
"De claim staat er twee keer: de uitvoerintentie staat ervoor in als",
"GTS_PDFX, en de metadata noemt het geclaimde deel. De bibliotheek weigert de",
"claim tenzij het bestand het persprofiel, een titel, een woord over trapping",
"en een snijkader op elke pagina bevat. Alle vier zijn aanwezig.",
],
unclaimed: [
"Dit bestand claimt geen PDF/X-4. Die claim belooft een drukkerij dat ze het bestand",
"kan drukken zonder terug te vragen, en die belofte rust op het profiel van de",
"pers waarvoor het werk gescheiden is. De bibliotheek bouwt één profiel, sRGB, en",
"sRGB beschrijft een scherm: het mag niet voor een pers invallen. Geef een persprofiel",
"mee op de opdrachtregel en hetzelfde blad claimt PDF/X-4.",
],
};
/// The sheet in Portuguese.
const PORTUGUESE: Words = Words {
title: "Catálogo de primavera, capa",
heading: "Pronto para a gráfica",
strapline: "Uma folha, entregue sem nada que o impressor tenha de perguntar.",
footer: "uma folha, pronta a imprimir",
slug: ["folha", "corte", "sangria", "CMYK"],
panels: [
"As três caixas que esta folha indica",
"Onde a tinta para",
"Quatro tintas, não três",
"As marcas ficam fora da tinta",
"O que o ficheiro diz de si mesmo",
],
boxes_note: "O papel é maior do que a página acabada; a tinta vai até uma caixa intermédia.",
boxes: [
"a folha toda, marcas incluídas",
"até onde vai a tinta",
"onde cai a lâmina",
],
ink_stops: [
"A faixa no topo desta página passa 9 pontos da lâmina em três",
"lados, e a barra no pé faz o mesmo. Uma lâmina que caia um ponto",
"ao lado continua a cair na tinta, por isso a página acabada não tem margem branca.",
],
four_inks: [
"Cada cor desta página é dita nas quatro tintas de impressão. Uma cor de ecrã",
"teria de ser separada por alguém, e esse alguém é o impressor.",
],
inks: ["Ciano", "Magenta", "Amarelo", "Preto", "Registo"],
marks: [
"As marcas de canto são desenhadas para lá da sangria, por isso a lâmina leva-as",
"com o resto do papel. São postas nas quatro tintas ao mesmo tempo: uma",
"marca que imprime em cada chapa é a marca pela qual a máquina alinha as chapas.",
],
stated_for: "Indicado para",
claim: "Declaração",
trapped: "dito no ficheiro, não deixado por saber",
profile_of: "um perfil de",
bytes: "bytes",
no_claim: "nenhum: a nota abaixo diz porquê",
custom_info: "Um perfil de impressão passado na linha de comandos",
claimed: [
"Este ficheiro declara PDF/X-4, através do perfil passado na linha de comandos.",
"A declaração é escrita duas vezes: a intenção de saída responde por ela como",
"GTS_PDFX, e os metadados nomeiam a parte declarada. A biblioteca recusa a",
"declaração se o ficheiro não levar o perfil de impressão, um título, uma indicação sobre",
"trapping e uma caixa de corte em cada página. Estão cá as quatro.",
],
unclaimed: [
"Este ficheiro não declara PDF/X-4. Declará-lo promete a uma gráfica que pode imprimir",
"o ficheiro sem perguntar nada, e a promessa assenta no perfil da",
"máquina para a qual o trabalho foi separado. A biblioteca só cria um perfil, o sRGB, e o",
"sRGB descreve um ecrã, não uma máquina de impressão. Passe um perfil",
"de impressão na linha de comandos e a mesma folha declara PDF/X-4.",
],
};
/// The sheet in Italian.
const ITALIAN: Words = Words {
title: "Catalogo di primavera, copertina",
heading: "Pronto per la stampa",
strapline: "Un foglio consegnato senza che il tipografo debba chiedere nulla.",
footer: "un foglio, pronto per la tiratura",
slug: ["foglio", "rifilo", "abbondanza", "CMYK"],
panels: [
"I tre riquadri che indica questo foglio",
"Dove si ferma l’inchiostro",
"Quattro inchiostri, non tre",
"I segni stanno fuori dall’inchiostro",
"Cosa dice di sé il file",
],
boxes_note: "La carta è più grande della pagina finita; l’inchiostro arriva a un riquadro intermedio.",
boxes: [
"tutto il foglio, segni compresi",
"fin dove arriva l’inchiostro",
"dove cade la lama",
],
ink_stops: [
"La fascia in testa a questa pagina supera la lama di 9 punti su tre",
"lati, e la barra al piede fa lo stesso. Una lama che cade un punto",
"più in là cade ancora nell’inchiostro, così la pagina finita non ha bordo bianco.",
],
four_inks: [
"Ogni colore di questa pagina è espresso nei quattro inchiostri da stampa. Un colore da",
"schermo andrebbe separato da qualcuno, e quel qualcuno è il tipografo.",
],
inks: ["Ciano", "Magenta", "Giallo", "Nero", "Registro"],
marks: [
"I segni d’angolo sono disegnati oltre l’abbondanza, così la lama li porta via",
"con il resto della carta. Sono posati nei quattro inchiostri insieme: un",
"segno che si stampa su ogni lastra è quello su cui la macchina allinea le lastre.",
],
stated_for: "Indicato per",
claim: "Dichiarazione",
trapped: "detto nel file, non lasciato ignoto",
profile_of: "un profilo di",
bytes: "byte",
no_claim: "nessuno: la nota qui sotto dice perché",
custom_info: "Un profilo da stampa passato sulla riga di comando",
claimed: [
"Questo file dichiara PDF/X-4, tramite il profilo passato sulla riga di comando.",
"La dichiarazione è scritta due volte: l’intento di uscita ne risponde come",
"GTS_PDFX, e i metadati nominano la parte dichiarata. La libreria rifiuta la",
"dichiarazione se il file non porta il profilo da stampa, un titolo, un’indicazione",
"sul trapping e un riquadro di rifilo su ogni pagina. Qui ci sono tutti e quattro.",
],
unclaimed: [
"Questo file non dichiara PDF/X-4. Dichiararlo promette a una tipografia che può stampare",
"il file senza chiedere nulla, e la promessa poggia sul profilo della",
"macchina per cui il lavoro è stato separato. La libreria costruisce un profilo, sRGB, e",
"sRGB descrive uno schermo: non può fare le veci di una macchina da stampa. Passate un",
"profilo da stampa sulla riga di comando e lo stesso foglio dichiara PDF/X-4.",
],
};
/// The sheet in Spanish.
const SPANISH: Words = Words {
title: "Catálogo de primavera, cubierta",
heading: "Listo para la imprenta",
strapline: "Una hoja, entregada sin nada que el impresor tenga que preguntar.",
footer: "una hoja, lista para tirar",
slug: ["hoja", "corte", "sangrado", "CMYK"],
panels: [
"Las tres cajas que indica esta hoja",
"Dónde acaba la tinta",
"Cuatro tintas, no tres",
"Las marcas quedan fuera de la tinta",
"Lo que el archivo dice de sí mismo",
],
boxes_note: "El papel es mayor que la página acabada; la tinta llega a una caja intermedia.",
boxes: [
"la hoja entera, marcas incluidas",
"hasta dónde llega la tinta",
"dónde cae la cuchilla",
],
ink_stops: [
"La banda de cabeza de esta página pasa 9 puntos de la cuchilla por tres",
"lados, y la barra del pie hace lo mismo. Una cuchilla que cae un punto",
"desviada sigue cayendo en tinta, así que la página acabada no tiene borde blanco.",
],
four_inks: [
"Cada color de esta página se expresa en las cuatro tintas de imprenta. Un color de",
"pantalla tendría que separarlo alguien, y ese alguien es el impresor.",
],
inks: ["Cian", "Magenta", "Amarillo", "Negro", "Registro"],
marks: [
"Las marcas de esquina se dibujan más allá del sangrado, así que la cuchilla",
"se las lleva con el resto del papel. Van en las cuatro tintas a la vez: una",
"marca que se imprime en cada plancha es la que usa la prensa para alinearlas.",
],
stated_for: "Indicado para",
claim: "Declaración",
trapped: "indicado en el archivo, no dejado sin definir",
profile_of: "un perfil de",
bytes: "bytes",
no_claim: "ninguno: la nota de abajo dice por qué",
custom_info: "Un perfil de imprenta pasado en la línea de órdenes",
claimed: [
"Este archivo declara PDF/X-4, mediante el perfil pasado en la línea de órdenes.",
"La declaración se escribe dos veces: la intención de salida responde de ella",
"como GTS_PDFX, y los metadatos nombran la parte declarada. La biblioteca rechaza",
"la declaración salvo que el archivo lleve el perfil de imprenta, un título, una indicación",
"de reventado y una caja de corte en cada página. Aquí están las cuatro.",
],
unclaimed: [
"Este archivo no declara PDF/X-4. Declararlo promete a una imprenta que puede tirar",
"el archivo sin preguntar nada, y la promesa descansa en el perfil de la",
"prensa para la que se separó el trabajo. La biblioteca construye un perfil, sRGB, y",
"sRGB describe una pantalla: no puede ocupar el lugar de una prensa. Pase un perfil",
"de imprenta en la línea de órdenes y la misma hoja declara PDF/X-4.",
],
};
/// The sheet in German.
const GERMAN: Words = Words {
title: "Frühjahrskatalog, Umschlag",
heading: "Bereit für die Druckmaschine",
strapline: "Ein Bogen, übergeben ohne eine offene Frage für die Druckerei.",
footer: "ein Bogen, bereit zum Druck",
slug: ["Bogen", "Endformat", "Anschnitt", "CMYK"],
panels: [
"Die drei Rahmen, die dieser Bogen nennt",
"Wo die Farbe endet",
"Vier Farben, nicht drei",
"Die Marken stehen außerhalb der Farbe",
"Was die Datei über sich sagt",
],
boxes_note: "Das Papier ist größer als die Seite; die Farbe läuft bis zu einem Rahmen dazwischen.",
boxes: [
"der ganze Bogen samt Marken",
"wie weit die Farbe läuft",
"wo das Messer fällt",
],
ink_stops: [
"Das Band oben läuft an drei Seiten 9 Punkt über das",
"Messer hinaus, die Leiste am Fuß ebenso. Ein Messer, das",
"einen Punkt danebenfällt, trifft noch Farbe: kein weißer Rand.",
],
four_inks: [
"Jede Farbe hier ist in den vier Druckfarben angegeben. Eine",
"Bildschirmfarbe müsste jemand separieren — die Druckerei.",
],
inks: ["Cyan", "Magenta", "Gelb", "Schwarz", "Passer"],
marks: [
"Die Eckmarken stehen jenseits des Anschnitts; das Messer nimmt sie",
"mit dem Papier weg. Sie liegen in allen vier Farben zugleich: Eine",
"Marke auf jeder Platte ist die, nach der die Maschine ausrichtet.",
],
stated_for: "Angegeben für",
claim: "Anspruch",
trapped: "in der Datei angegeben, nicht offengelassen",
profile_of: "ein Profil von",
bytes: "Bytes",
no_claim: "keins — der Hinweis unten sagt, warum",
custom_info: "Ein auf der Befehlszeile übergebenes Druckprofil",
claimed: [
"Diese Datei beansprucht PDF/X-4, über das Profil der Befehlszeile.",
"Der Anspruch steht doppelt: Die Ausgabebedingung verbürgt ihn als",
"GTS_PDFX, die Metadaten nennen den Teil. Die Bibliothek lehnt",
"ihn ab ohne Druckprofil, Titel, Angabe zur Überfüllung und einen",
"Endformatrahmen auf jeder Seite. Alle vier sind da.",
],
unclaimed: [
"Diese Datei beansprucht nicht PDF/X-4. Das verspräche einer Druckerei,",
"die Datei ohne Rückfrage zu drucken, gestützt auf das Profil der",
"Maschine, für die separiert wurde. Die Bibliothek baut nur sRGB,",
"und sRGB beschreibt einen Bildschirm, keine Druckmaschine. Mit einem",
"Druckprofil auf der Befehlszeile beansprucht derselbe Bogen PDF/X-4.",
],
};
/// Every language the example is written in. A language is added by writing its
/// own set of words and naming it here.
static WORDS: [(Language, &Words); 7] = [
(Language::English, &ENGLISH),
(Language::French, &FRENCH),
(Language::German, &GERMAN),
(Language::Spanish, &SPANISH),
(Language::Italian, &ITALIAN),
(Language::Portuguese, &PORTUGUESE),
(Language::Dutch, &DUTCH),
];
/// A profile, what the condition it describes is called, whether that name is
/// the profile's own, and whether the file claims the print standard on it.
struct Stated {
profile: Vec<u8>,
identifier: &'static str,
info: Option<&'static str>,
claims: bool,
}
impl Stated {
/// What the page and the output intent say the condition is.
fn info(&self, words: &Words) -> &'static str {
self.info.unwrap_or(words.custom_info)
}
}
/// Where the blade falls.
const fn trim() -> Rect {
Rect::new(TRIM.0, TRIM.1, TRIM.2, TRIM.3)
}
/// What the ink runs to.
const fn bleed() -> Rect {
Rect::new(
TRIM.0 - BLEED_OVER,
TRIM.1 - BLEED_OVER,
TRIM.2 + BLEED_OVER + BLEED_OVER,
TRIM.3 + BLEED_OVER + BLEED_OVER,
)
}
/// Draws one line of text with its baseline at `(x, y)`.
fn text(
content: &mut Content,
font: &FontHandle,
size: f64,
x: f64,
y: f64,
line: &str,
) -> Result<(), Error> {
content.begin_text();
content.set_font(font, size)?;
content.text_origin(x, y)?;
content.show_glyphs(&font.glyphs(line));
content.end_text();
Ok(())
}
/// Draws the flood at the head of the sheet and the bar at its foot, both
/// running to the ink's own box and off the blade on three sides.
fn flood(content: &mut Content, font: &FontHandle, words: &Words) -> Result<(), Error> {
let ink = bleed();
let top = ink.y() + ink.height();
content.save_state();
content.set_fill(BAND)?;
content
.rect(ink.x(), BAND_BOTTOM, ink.width(), top - BAND_BOTTOM)?
.fill();
content
.rect(ink.x(), ink.y(), ink.width(), BAR_TOP - ink.y())?
.fill();
content.restore_state();
content.save_state();
content.set_fill(Cmyk::WHITE)?;
text(content, font, HEADING_SIZE, LEFT, 620.0, words.heading)?;
text(
content,
font,
7.0,
LEFT,
38.0,
&format!("{HOUSE} — {}", words.footer),
)?;
content.set_fill(ON_BAND)?;
text(content, font, STRAPLINE, LEFT, 600.0, words.strapline)?;
content.restore_state();
Ok(())
}
/// Draws the four corner marks, each pair of arms standing outside the ink and
/// pointing at a corner of the finished page.
///
/// They are laid in all four inks at once, so that each plate carries them.
fn corner_marks(content: &mut Content) -> Result<(), Error> {
let (left, bottom, width, height) = TRIM;
let right = left + width;
let top = bottom + height;
let near = BLEED_OVER;
let far = BLEED_OVER + MARK_LENGTH;
content.save_state();
content.set_stroke(REGISTRATION)?;
content.set_line_width(0.4)?;
for (x, from_x, to_x) in [
(left, left - near, left - far),
(right, right + near, right + far),
] {
for (y, from_y, to_y) in [
(bottom, bottom - near, bottom - far),
(top, top + near, top + far),
] {
content.move_to(from_x, y)?;
content.line_to(to_x, y)?;
content.move_to(x, from_y)?;
content.line_to(x, to_y)?;
}
}
content.stroke();
content.restore_state();
Ok(())
}
/// What the line in the margin says: the job, then each box in the order the
/// paper takes them, read off the sizes the page is drawn to.
fn slug_line(words: &Words) -> String {
let [sheet, trim, bleed, inks] = words.slug;
format!(
"{} — {} × {} {sheet} — {} × {} {trim} — {BLEED_OVER} pt {bleed} — {inks}",
words.title, SHEET.0, SHEET.1, TRIM.2, TRIM.3
)
}
/// Draws the line in the margin naming the job, which the blade takes away with
/// the rest of the paper outside the finished page.
fn slug(content: &mut Content, font: &FontHandle, words: &Words) -> Result<(), Error> {
content.save_state();
content.set_fill(REGISTRATION)?;
text(content, font, SLUG, LEFT, 14.0, &slug_line(words))?;
content.restore_state();
Ok(())
}
/// Draws one panel: its heading, and the lines of body under it.
fn panel(
content: &mut Content,
font: &FontHandle,
y: f64,
title: &str,
lines: &[&str],
) -> Result<(), Error> {
content.save_state();
content.set_fill(HEADING)?;
text(content, font, PANEL, LEFT, y, title)?;
content.set_fill(BODY)?;
let mut line_y = y - 15.0;
for line in lines {
text(content, font, PANEL_BODY, LEFT, line_y, line)?;
line_y -= 12.0;
}
content.restore_state();
Ok(())
}
/// Draws a run of stated pairs, one to a line, what each is called on the left
/// and what it says beside it.
fn stated(
content: &mut Content,
font: &FontHandle,
top: f64,
pairs: &[(&str, String)],
) -> Result<(), Error> {
let mut y = top;
for (label, value) in pairs {
content.save_state();
content.set_fill(LABEL)?;
text(content, font, PAIR, LEFT, y, label)?;
content.set_fill(VALUE)?;
text(content, font, PAIR, LEFT + COLUMN, y, value)?;
content.restore_state();
y -= 14.0;
}
Ok(())
}
/// Draws one swatch per printing ink, each at full strength, under the name of
/// the ink and the four numbers that say it.
fn swatches(content: &mut Content, font: &FontHandle, words: &Words) -> Result<(), Error> {
let mut x = LEFT;
for ((name, mix), ink) in words.inks.iter().zip(MIXES).zip(INKS) {
content.save_state();
content.set_fill(ink)?;
content.rect(x, SWATCH_Y, SWATCH, SWATCH_HEIGHT)?.fill();
content.restore_state();
content.save_state();
content.set_fill(VALUE)?;
text(content, font, SWATCH_NAME, x, SWATCH_Y - 10.0, name)?;
content.set_fill(LABEL)?;
text(content, font, 7.0, x, SWATCH_Y - 20.0, mix)?;
content.restore_state();
x += SWATCH + SWATCH_GAP;
}
Ok(())
}
/// Draws the closing note: what the file claims, or why it claims nothing.
fn closing(
content: &mut Content,
font: &FontHandle,
words: &Words,
claims: bool,
) -> Result<(), Error> {
content.save_state();
content.set_fill(BODY)?;
let mut y = CLOSING_TOP;
for line in if claims {
words.claimed
} else {
words.unclaimed
} {
text(content, font, PANEL_BODY, LEFT, y, line)?;
y -= CLOSING_STEP;
}
content.restore_state();
Ok(())
}
/// The profile the document is stated for, what its condition is called, and
/// whether the print standard is claimed on it: the file named on the command
/// line, or the one the library builds.
fn stated_for(path: Option<String>) -> Result<Stated, Box<dyn std::error::Error>> {
match path {
Some(path) => Ok(Stated {
profile: fs::read(path)?,
identifier: CUSTOM,
info: None,
claims: true,
}),
None => Ok(Stated {
profile: icc::srgb(),
identifier: BUILT_IN.0,
info: Some(BUILT_IN.1),
claims: false,
}),
}
}
/// The size each of the three boxes measures, in points, in the order the page
/// states them.
const fn box_sizes() -> [(f64, f64); BOXES.len()] {
let ink = bleed();
[
(SHEET.0, SHEET.1),
(ink.width(), ink.height()),
(TRIM.2, TRIM.3),
]
}
/// The whole sheet, drawn once.
fn sheet(font: &FontHandle, words: &Words, stated_as: &Stated) -> Result<Vec<u8>, Error> {
let mut content = Content::new();
flood(&mut content, font, words)?;
corner_marks(&mut content)?;
slug(&mut content, font, words)?;
panel(
&mut content,
font,
518.0,
words.panels[0],
&[words.boxes_note],
)?;
let boxes: Vec<(&str, String)> = BOXES
.iter()
.zip(box_sizes())
.zip(words.boxes)
.map(|((name, (width, height)), says)| (*name, format!("{width} × {height} pt — {says}")))
.collect();
stated(&mut content, font, 487.0, &boxes)?;
panel(&mut content, font, 434.0, words.panels[1], &words.ink_stops)?;
panel(&mut content, font, 371.0, words.panels[2], &words.four_inks)?;
swatches(&mut content, font, words)?;
panel(&mut content, font, 248.0, words.panels[3], &words.marks)?;
panel(&mut content, font, 185.0, words.panels[4], &[])?;
stated(
&mut content,
font,
169.0,
&[
(ENTRIES[0], words.title.to_owned()),
(ENTRIES[1], format!("{TRAPPED} — {}", words.trapped)),
(
words.stated_for,
format!(
"{} — {} {} {}",
stated_as.identifier,
words.profile_of,
stated_as.profile.len(),
words.bytes
),
),
(
words.claim,
if stated_as.claims {
"PDF/X-4".to_owned()
} else {
words.no_claim.to_owned()
},
),
],
)?;
closing(&mut content, font, words, stated_as.claims)?;
Ok(content.into_bytes())
}
fn main() -> std::process::ExitCode {
failure::reported(run())
}
fn run() -> Result<(), Box<dyn std::error::Error>> {
let language = Language::from_environment()?;
let words = Words::of(language);
let mut args = env::args().skip(1);
// A named file is written as named; the default one carries the language,
// so the two languages do not overwrite each other in `tmp/`.
let out = args
.next()
.unwrap_or_else(|| language.file_name(&out::default_path("print_ready")));
let font_path = args.next().map_or_else(default_font, PathBuf::from);
let stated_as = stated_for(args.next())?;
let described = icc::space(&stated_as.profile)
.ok_or("the profile must describe a grey, RGB or CMYK space")?;
let intent = OutputIntent::new(
IccBased::new(&stated_as.profile, described)?,
stated_as.identifier,
stated_as.info(words),
)?;
let mut doc = Document::new();
doc.set_license(licence::licensed());
let mut facts = Metadata::default();
facts.title = Some(words.title.to_owned());
facts.producer = Some("hqf-pdf".to_owned());
facts.created = Some(MADE.to_owned());
facts.trapped = Some(Trapped::No);
doc.set_metadata(facts);
doc.set_output_intent(intent);
if stated_as.claims {
doc.set_print_conformance(PdfX::X4);
doc.set_version(Version::V1_6);
}
let font = doc.add_font(Font::parse(fs::read(&font_path)?)?);
let mut page = Page::new(SHEET.0, SHEET.1);
page.content = sheet(&font, words, &stated_as)?;
page.bleed = Some(bleed());
page.trim = Some(trim());
doc.add_page(page)?;
let written = doc.to_bytes()?;
if let Some(parent) = Path::new(&out).parent() {
fs::create_dir_all(parent)?;
}
fs::write(&out, &written)?;
println!(
"wrote {out}: {} bytes, a press sheet stated for {}, {}",
written.len(),
stated_as.identifier,
if stated_as.claims {
"claiming PDF/X-4"
} else {
"claiming nothing"
}
);
Ok(())
}
#[cfg(test)]
mod tests {
use hqf_pdf::{Document, Font};
use super::{
BAR_TOP, CLOSING_STEP, CLOSING_TOP, COLUMN, ENTRIES, HEADING_SIZE, LEFT, PAIR, PANEL,
PANEL_BODY, SHEET, SLUG, STRAPLINE, SWATCH, SWATCH_GAP, SWATCH_NAME, TRAPPED, WORDS,
default_font, language, slug_line,
};
/// The room a line set from the left edge of the finished page has before
/// it reaches the same margin on the other side of the sheet.
const ROOM: f64 = SHEET.0 - 2.0 * LEFT;
/// The room the name under a swatch has before it reaches the next swatch.
const UNDER_SWATCH: f64 = SWATCH + SWATCH_GAP;
/// The lines two languages are allowed to write the same way. Two printing
/// inks are called the same in English and in French; every other word on
/// the sheet is one or the other, and the entries a press looks up are held
/// outside the words altogether.
const SPARED: [&str; 9] = [
"\"Cyan\"",
"\"Magenta\"",
// Written the same way in German.
r#""CMYK""#,
// Written the same way in Spanish.
r#"bytes: "bytes""#,
// Written the same way in Italian.
r#""Registro""#,
// Written the same way in Portuguese.
r#""Ciano""#,
r#""corte""#,
r#"stated_for: "Indicado para""#,
// Written the same way in Dutch.
r#"claim: "Claim""#,
];
#[test]
fn every_language_writes_the_sheet_in_its_own_words() {
let untranslated = language::untranslated_lines(&WORDS, &SPARED);
assert!(
untranslated.is_empty(),
"the sheet says these in more than one language: {untranslated:?}"
);
}
/// Nothing on the sheet is broken to a width. A line longer than the paper
/// runs off the edge of it, a name longer than its swatch runs into the
/// next one, and a stated pair whose two halves are both too long runs one
/// over the other.
#[test]
fn every_language_writes_lines_that_fit_the_room_they_have() {
let mut doc = Document::new();
let font = doc.add_font(
Font::parse(std::fs::read(default_font()).expect("the committed font is there"))
.expect("the committed font parses"),
);
for (named, words) in WORDS {
let margin_line = slug_line(words);
let across = [
(HEADING_SIZE, words.heading),
(STRAPLINE, words.strapline),
(PANEL_BODY, words.boxes_note),
]
.into_iter()
.chain(std::iter::once((SLUG, margin_line.as_str())))
.chain(words.panels.map(|line| (PANEL, line)))
.chain(words.ink_stops.map(|line| (PANEL_BODY, line)))
.chain(words.four_inks.map(|line| (PANEL_BODY, line)))
.chain(words.marks.map(|line| (PANEL_BODY, line)))
.chain(words.claimed.map(|line| (PANEL_BODY, line)))
.chain(words.unclaimed.map(|line| (PANEL_BODY, line)));
for (size, line) in across {
let measured = font.measure(line, size);
assert!(
measured <= ROOM,
"the {} sheet draws {line:?} over {measured:.1} points, \
and it has {ROOM:.1}",
named.code()
);
}
for name in words.inks {
let measured = font.measure(name, SWATCH_NAME);
assert!(
measured <= UNDER_SWATCH,
"the {} sheet calls a swatch {name:?}, {measured:.1} points \
under a swatch {UNDER_SWATCH:.1} wide",
named.code()
);
}
let labels = [ENTRIES[0], ENTRIES[1], words.stated_for, words.claim];
for label in labels {
let measured = font.measure(label, PAIR);
assert!(
measured <= COLUMN,
"the {} sheet states {label:?} over {measured:.1} points, \
and the column is {COLUMN:.1}",
named.code()
);
}
let values = [
format!("{TRAPPED} — {}", words.trapped),
words.no_claim.to_owned(),
];
for value in values {
let measured = font.measure(&value, PAIR);
assert!(
measured <= ROOM - COLUMN,
"the {} sheet states {value:?} over {measured:.1} points, \
and it has {:.1}",
named.code(),
ROOM - COLUMN
);
}
}
}
/// The closing note is set from a fixed baseline down, and the bar across
/// the foot of the sheet is drawn under it: a line too many would be
/// written on the bar, where it cannot be read.
#[test]
fn the_closing_note_stands_clear_of_the_bar_at_the_foot() {
for (named, words) in WORDS {
for note in [words.claimed, words.unclaimed] {
let count = u32::try_from(note.len()).expect("a note has few lines");
let last = CLOSING_STEP.mul_add(-f64::from(count - 1), CLOSING_TOP);
assert!(
last >= BAR_TOP,
"the {} note ends on a line at {last:.1} points, and the bar \
reaches {BAR_TOP:.1}",
named.code()
);
}
}
}
}
|