// A CONTACT by the DESK TELEPHONE (Cotton Calling's Contacts, 13 Nov 2026):// on the calling desk's oxblood leather (`FaceGround.leatherDesk`) a// person's ivory card lies a hair askew, and the desk telephone stands in// front of it, its corner over the card's, ready to call them.//// THE CARD: ivory card stock, its shadow on the leather; on its left the// person's photograph pasted in its white border, or their initials typed// on a blank print where they have none; on its right their NAME printed// in Caslon, one line or two (`title`), a printed rule, and their first// number typed under it (`reach`, else the `phone` place), where they// have one.// THE TELEPHONE, painted three-quarter from the front right// (`telephone`, by `scripts/paint-telephone.py`): its HANDSET on the// cradle is the CALL (`FacePart.call`), and its camera key, the third of// the four line keys with a camera moulded into it, is the VIDEO CALL// (`FacePart.videoCall`). The shell routes both to the call; the face// only draws them and says them.//// Named on Cotton Calling's Contacts view, never on the person table: other// apps draw a person their own way. Stepped by a tap, it cuts. Print on an// object scales with the object, never with Dynamic Type. Every word is the// core's (`DeckCard`) but the parts' own, which say themselves in the cards// set's lines (`faces.call`, `faces.video_call`).importCottonPaperimportCottonValuesimportSwiftUIenumPersonTelephoneFaceKnobs {// THE TELEPHONE, as painted (`telephone`): its width over its height;// the handset's bounds as shares of the painting (x, y, width, height,// y down); the camera key's face as its four corners clockwise from// the upper left.staticlet aspect: CGFloat = 1.2961staticlet handset = CGRect(x: 0.3163, y: 0.1156, width: 0.5173, height: 0.3532)staticlet cameraKey = PaintedKey(corners: [ CGPoint(x: 0.4047, y: 0.6707), CGPoint(x: 0.4668, y: 0.7), CGPoint(x: 0.4514, y: 0.7355), CGPoint(x: 0.3892, y: 0.7056), ])/// The telephone's width as a share of the card's room, and how far/// right of the room's middle it stands, as a share of its own width.staticlet phoneWidth: CGFloat = 0.9staticlet phoneShift: CGFloat = 0.04/// The camera glyph, as a share of its key face's height; the least the/// key's tap reaches, in points.staticlet glyph: CGFloat = 0.66staticlet reach: CGFloat = 44// THE CARD: its width as a share of the room's, its width over its// height, how far askew it lies; as shares of its width, its margin,// the print's side and border, the name's size and lines, the number's// size and the rule's weight.staticlet cardWidth: CGFloat = 0.88staticlet cardAspect: CGFloat = 1.6staticlet cardTurn: Double = -3staticlet margin: CGFloat = 0.06staticlet print: CGFloat = 0.3staticlet border: CGFloat = 0.012staticlet nameSize: CGFloat = 0.075staticlet nameLines = 2staticlet numberSize: CGFloat = 0.052staticlet rule: CGFloat = 0.004/// How much of the card the telephone stands over, as a share of the/// card's height.staticlet overlap: CGFloat = 0.22}/// What a contact's card says.publicstructPersonTelephoneWords: Equatable, Sendable {publiclet name: String?publiclet number: String?publiclet initials: Stringpublicinit(_ card: DeckCard) { name = card.text("title").map { $0.split(whereSeparator: \.isWhitespace).joined(separator: " ") }.flatMap { $0.isEmpty ? nil : $0 }let reach = card.reach.phones.map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }.first { !$0.isEmpty } number = reach ?? card.words("phone").first initials = CallTelephoneSetting.initials(name ?? "") }}publicstructPersonTelephoneFace: View {let card: DeckCardlet photo: FacePicture?publicinit(card: DeckCard, photo: FacePicture?) {self.card = cardself.photo = photo }publicvar body: someView {let knobs = PersonTelephoneFaceKnobs.selfGeometryReader { box in// The card and the telephone stand in one column; the room's// narrower way sets their size.let cardW0 = box.size.width * knobs.cardWidthlet phoneW0 = box.size.width * knobs.phoneWidthlet tall = cardW0 / knobs.cardAspect * (1 - knobs.overlap) + phoneW0 / knobs.aspectlet s = min(1, box.size.height * 0.98 / tall)let card = CGSize(width: cardW0 * s, height: cardW0 * s / knobs.cardAspect)let phone = CGSize(width: phoneW0 * s, height: phoneW0 * s / knobs.aspect)let top = (box.size.height - (card.height * (1 - knobs.overlap) + phone.height)) / 2 ZStack(alignment: .topLeading) {ContactCard(words: PersonTelephoneWords(self.card), photo: photo, size: card) .frame(width: card.width, height: card.height) .rotationEffect(.degrees(knobs.cardTurn)) .offset(x: (box.size.width - card.width) / 2, y: top)CardTelephone(size: phone) .frame(width: phone.width, height: phone.height) .offset(x: (box.size.width - phone.width) / 2 + phone.width * knobs.phoneShift, y: top + card.height * (1 - knobs.overlap)) } .frame(width: box.size.width, height: box.size.height, alignment: .topLeading) } .accessibilityElement(children: .contain) .accessibilityIdentifier("person-telephone") }}/// The person's ivory card: the photograph, the name and the number.privatestructContactCard: View {let words: PersonTelephoneWordslet photo: FacePicture?let size: CGSizevar body: someView {let knobs = PersonTelephoneFaceKnobs.selflet w = size.widthlet side = knobs.print * wlet ink = CallingMaterial.cardInk.colour ZStack(alignment: .topLeading) {RoundedRectangle(cornerRadius: w * 0.012) .fill(CallingMaterial.card.colour) .shadow(color: .black.opacity(0.45), radius: 5, x: 1.5, y: 4) HStack(alignment: .center, spacing: knobs.margin * w) { ZStack {CallingMaterial.border.colourGroup {iflet photo { photo } else {Text(verbatim: words.initials) .font(CottonFonts.caslon(side * 0.36)) .foregroundStyle(ink.opacity(0.7)) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(CallingMaterial.card.colour) .accessibilityHidden(true) } } .frame(width: side - knobs.border * w * 2, height: side * 1.2 - knobs.border * w * 2) .clipped() } .frame(width: side, height: side * 1.2) .shadow(color: .black.opacity(0.18), radius: 1, x: 0.5, y: 1) .accessibilityIdentifier("person-telephone-picture") .facePart(.picture) VStack(alignment: .leading, spacing: w * 0.03) {iflet name = words.name {Text(verbatim: name) .font(CottonFonts.caslon(knobs.nameSize * w)) .foregroundStyle(ink) .lineLimit(knobs.nameLines) .minimumScaleFactor(0.6) .fixedSize(horizontal: false, vertical: true) .accessibilityIdentifier("person-telephone-name") .facePart(.title) }Rectangle() .fill(ink.opacity(0.55)) .frame(height: max(0.5, knobs.rule * w)) .accessibilityHidden(true)iflet number = words.number {Text(verbatim: number) .font(CottonFonts.type(knobs.numberSize * w)) .foregroundStyle(ink.opacity(0.85)) .lineLimit(1) .minimumScaleFactor(0.6) .accessibilityIdentifier("person-telephone-number") } } .blendMode(.multiply) } .padding(.horizontal, knobs.margin * w) .padding(.top, knobs.margin * w) .padding(.bottom, knobs.overlap * size.height) .frame(width: size.width, height: size.height, alignment: .topLeading) } }}/// The desk telephone in front of the card: its handset the call, its/// camera key the video call.privatestructCardTelephone: View {let size: CGSizevar body: someView {let knobs = PersonTelephoneFaceKnobs.selflet hand = knobs.handsetlet key = knobs.cameraKey.outline(in: size).boundingRectlet reach = CGSize(width: max(key.width, knobs.reach), height: max(key.height, knobs.reach)) ZStack(alignment: .topLeading) {iflet painted = CottonMedia.image("telephone", scale: 3) { painted.resizable().interpolation(.high) .frame(width: size.width, height: size.height) .accessibilityHidden(true) } else {RoundedRectangle(cornerRadius: size.width * 0.04) .fill(CallingMaterial.cream.colour) .frame(width: size.width * 0.5, height: size.height * 0.6) .offset(x: size.width * 0.25, y: size.height * 0.25) .accessibilityHidden(true) }MouldedGlyph(symbol: "video.fill", key: knobs.cameraKey, size: size, share: knobs.glyph, ink: CallingMaterial.keyInk.colour.opacity(0.75), multiply: true)Color.clear .frame(width: hand.width * size.width, height: hand.height * size.height) .contentShape(Rectangle()) .accessibilityElement() .accessibilityLabel(Text(verbatim: ShellLines.line("cards", "faces.call"))) .accessibilityIdentifier("person-telephone-call") .facePart(.call) .offset(x: hand.minX * size.width, y: hand.minY * size.height)Color.clear .frame(width: reach.width, height: reach.height) .contentShape(Rectangle()) .accessibilityElement() .accessibilityLabel(Text(verbatim: ShellLines.line("cards", "faces.video_call"))) .accessibilityIdentifier("person-telephone-video") .facePart(.videoCall) .offset(x: key.midX - reach.width / 2, y: key.midY - reach.height / 2) } .frame(width: size.width, height: size.height, alignment: .topLeading) }}/// The contact by the telephone, by its id, and the people it is reviewed/// in: invented people and impossible numbers only.publicenumPersonTelephoneFaceCatalogue {publicstaticlet stock: FaceStock = .ownpublicstaticlet ground: FaceGround = .leatherDeskpublicstaticlet face = Face(id: "person.telephone", specimens: [Specimen("friend", friend, picture: "rolodex-friend"),Specimen("colleague", colleague, picture: "rolodex-ananya"),Specimen("no-picture", noPicture),Specimen("long-name", longName, picture: "portrait"),Specimen("no-number", noNumber), ], steps: .cut) { card, picture, _ inPersonTelephoneFace(card: card, photo: picture) }staticfunc person(_ name: String, phones: [String]) -> DeckCard {var card = DeckCard(face: "person.telephone", corner: nil, pressing: false, pace: nil, plate: nil, fields: ["title": .text(name)]) card.reach = CardReach(phones: phones, call: !phones.isEmpty, message: !phones.isEmpty)return card }publicstaticlet friend = person("Kabir Menon", phones: ["+1 555 0122"])publicstaticlet colleague = person("Aditi Sen", phones: ["+1 555 0121", "+1 555 0131"])publicstaticlet noPicture = person("Devika Kapur", phones: ["+1 555 0125"])publicstaticlet longName = person("Arundhati Venkatalakshmi Krishnamurthy", phones: ["+1 555 0124"])publicstaticlet noNumber = person("Ravi Iyer", phones: [])}