diff options
| author | Laurenz Mädje <laurmaedje@gmail.com> | 2019-07-28 21:03:33 +0200 |
|---|---|---|
| committer | Laurenz Mädje <laurmaedje@gmail.com> | 2019-07-28 21:03:33 +0200 |
| commit | 19be053cc3465229a39a65cab2460ac61e18cd8c (patch) | |
| tree | de130d294f54000f7db04becdb94fc992699aa21 /src/lib.rs | |
| parent | 6c8b5caa9fa731f16b2d9d232177c00de8f2b74b (diff) | |
Create some benchmarks 📊
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 64 |
1 files changed, 4 insertions, 60 deletions
@@ -183,21 +183,8 @@ mod test { /// Create a _PDF_ with a name from the source code. fn test(name: &str, src: &str) { let mut typesetter = Typesetter::new(); - typesetter.add_font_provider(FileSystemFontProvider::new("../fonts", vec![ - ("CMU-SansSerif-Regular.ttf", font!["Computer Modern", Regular, SansSerif]), - ("CMU-SansSerif-Italic.ttf", font!["Computer Modern", Italic, SansSerif]), - ("CMU-SansSerif-Bold.ttf", font!["Computer Modern", Bold, SansSerif]), - ("CMU-SansSerif-Bold-Italic.ttf", font!["Computer Modern", Bold, Italic, SansSerif]), - ("CMU-Serif-Regular.ttf", font!["Computer Modern", Regular, Serif]), - ("CMU-Serif-Italic.ttf", font!["Computer Modern", Italic, Serif]), - ("CMU-Serif-Bold.ttf", font!["Computer Modern", Bold, Serif]), - ("CMU-Serif-Bold-Italic.ttf", font!["Computer Modern", Bold, Italic, Serif]), - ("CMU-Typewriter-Regular.ttf", font!["Computer Modern", Regular, Serif, SansSerif, Monospace]), - ("CMU-Typewriter-Italic.ttf", font!["Computer Modern", Italic, Serif, SansSerif, Monospace]), - ("CMU-Typewriter-Bold.ttf", font!["Computer Modern", Bold, Serif, SansSerif, Monospace]), - ("CMU-Typewriter-Bold-Italic.ttf", font!["Computer Modern", Bold, Italic, Serif, SansSerif, Monospace]), - ("NotoEmoji-Regular.ttf", font!["Noto", Regular, Bold, Italic, SansSerif, Serif, Monospace]), - ])); + let provider = FileSystemFontProvider::from_listing("../fonts/fonts.toml").unwrap(); + typesetter.add_font_provider(provider); // Typeset into document. let document = typesetter.typeset(src).unwrap(); @@ -231,50 +218,7 @@ mod test { } #[test] - fn wikipedia() { - test("wikipedia", r#" - Typesetting is the composition of text by means of arranging physical types or the - digital equivalents. Stored letters and other symbols (called sorts in mechanical - systems and glyphs in digital systems) are retrieved and ordered according to a - language's orthography for visual display. Typesetting requires one or more fonts - (which are widely but erroneously confused with and substituted for typefaces). One - significant effect of typesetting was that authorship of works could be spotted more - easily, making it difficult for copiers who have not gained permission. - - During much of the letterpress era, movable type was composed by hand for each page. - Cast metal sorts were composed into words, then lines, then paragraphs, then pages of - text and tightly bound together to make up a form, with all letter faces exactly the - same "height to paper", creating an even surface of type. The form was placed in a - press, inked, and an impression made on paper. - - During typesetting, individual sorts are picked from a type case with the right hand, - and set into a composing stick held in the left hand from left to right, and as viewed - by the setter upside down. As seen in the photo of the composing stick, a lower case - 'q' looks like a 'd', a lower case 'b' looks like a 'p', a lower case 'p' looks like a - 'b' and a lower case 'd' looks like a 'q'. This is reputed to be the origin of the - expression "mind your p's and q's". It might just as easily have been "mind your b's - and d's". - - The diagram at right illustrates a cast metal sort: a face, b body or shank, c point - size, 1 shoulder, 2 nick, 3 groove, 4 foot. Wooden printing sorts were in use for - centuries in combination with metal type. Not shown, and more the concern of the - casterman, is the “set”, or width of each sort. Set width, like body size, is measured - in points. - - In order to extend the working life of type, and to account for the finite sorts in a - case of type, copies of forms were cast when anticipating subsequent printings of a - text, freeing the costly type for other work. This was particularly prevalent in book - and newspaper work where rotary presses required type forms to wrap an impression - cylinder rather than set in the bed of a press. In this process, called stereotyping, - the entire form is pressed into a fine matrix such as plaster of Paris or papier mâché - called a flong to create a positive, from which the stereotype form was electrotyped, - cast of type metal. - - Advances such as the typewriter and computer would push the state of the art even - farther ahead. Still, hand composition and letterpress printing have not fallen - completely out of use, and since the introduction of digital typesetting, it has seen a - revival as an artisanal pursuit. However, it is a very small niche within the larger - typesetting market. - "#); + fn shakespeare() { + test("shakespeare", include_str!("../test/shakespeare.tps")); } } |
