// What a face prints on its stock, on every kind of card: the heavy title// struck twice on the typewriter, a run of the hand given room for its last// glyph, a quick stroke of the pen, the faint printed hairline, and Card// design's pictures multiplied into the stock.importCottonPaperimportSwiftUI/// The hand's last glyph reaches past the run's box (a script "i" leans out/// of it) and a Text draws only inside its box: a thin space after the words/// gives that glyph its room.publicenumHandRun {publicstaticfunc tail(_ words: String) -> String { words + "\u{2009}" }}/// A quick pen stroke rising left to right, thinning at its end.publicstructPenSwash: Shape {publicinit() {}publicfunc path(in rect: CGRect) -> Path {var path = Path() path.move(to: CGPoint(x: rect.minX, y: rect.maxY)) path.addQuadCurve(to: CGPoint(x: rect.maxX, y: rect.minY), control: CGPoint(x: rect.midX, y: rect.maxY * 0.7))return path }}/// Typing struck twice, a hair apart: the heavy title of the references.publicstructHeavyType: View {let words: Stringlet size: CGFloatpublicinit(words: String, size: CGFloat) {self.words = wordsself.size = size }publicvar body: someView {Text(words) .font(CottonFonts.type(size)) .faceInk(.ink) .overlay(alignment: .topLeading) {Text(words) .font(CottonFonts.type(size)) .faceInk(.ink) .offset(x: size * 0.025) .accessibilityHidden(true) } .fixedSize(horizontal: false, vertical: true) .accessibilityAddTraits(.isHeader) }}/// One of Card design's pictures printed on a face, at the width it is/// given, multiplied into the stock.publicstructFaceArt: View {let name: String @Environment(\.theme) privatevar themepublicinit(name: String) {self.name = name }publicvar body: someView {iflet image = CottonMedia.image(name) { image .resizable() .interpolation(.high) .scaledToFit() .blendMode(theme.printBlend) .accessibilityHidden(true) } }}/// The faint printed hairline across a card.publicstructFaceHairline: View { @Environment(\.theme) privatevar themepublicinit() {}publicvar body: someView {Rectangle() .fill(theme.print(.pencil).opacity(0.35)) .frame(height: 0.75) .blendMode(theme.printBlend) .accessibilityHidden(true) }}