// // CloudZGlyph.swift // Zyquo Cloud // // Author: Simon-Pierre Boucher // Mail: contact@spboucher.ai // // The brand glyph as native SwiftUI drawing — the app icon's Z-command mark // (shared with the Zyquo family): a bold rounded Z whose lower stroke // resolves into a block caret. Used for the sidebar wordmark and the empty // state so the brand mark stays pixel-consistent without raster assets. // // Icon-grid geometry (matches assets/icon/zyquo-cloud.svg): // Z stroke (320,310)→(704,310)→(320,700)→(556,700), width 106, round caps; // caret rounded rect 653…757 × 585…753 (r24). // Bounds incl. caps: x 267…770 (503), y 257…766 (509). // import SwiftUI private enum GlyphGrid { static let originX: CGFloat = 267 static let originY: CGFloat = 257 static let width: CGFloat = 503 static let height: CGFloat = 509 /// height / width of the glyph's bounding box. static let aspect = height / width static func point(_ x: CGFloat, _ y: CGFloat, in rect: CGRect) -> CGPoint { let s = rect.width / width return CGPoint(x: (x - originX) * s, y: (y - originY) * s) } } /// The rounded Z stroke, lower bar shortened toward the caret. struct ZStrokeShape: Shape { func path(in rect: CGRect) -> Path { var path = Path() path.move(to: GlyphGrid.point(320, 310, in: rect)) path.addLine(to: GlyphGrid.point(704, 310, in: rect)) path.addLine(to: GlyphGrid.point(320, 700, in: rect)) path.addLine(to: GlyphGrid.point(556, 700, in: rect)) return path } } /// The terminal block caret finishing the lower stroke. struct CaretShape: Shape { func path(in rect: CGRect) -> Path { let s = rect.width / GlyphGrid.width var path = Path() path.addRoundedRect( in: CGRect( x: (653 - GlyphGrid.originX) * s, y: (585 - GlyphGrid.originY) * s, width: 104 * s, height: 168 * s ), cornerSize: CGSize(width: 24 * s, height: 24 * s) ) return path } } /// Composite brand glyph: rounded Z + block caret, single tint. struct CloudZGlyph: View { /// Rendered width; height follows the glyph's natural aspect. var size: CGFloat var tint: Color = ZyquoColor.accent var body: some View { ZStack { ZStrokeShape() .stroke(style: StrokeStyle( lineWidth: size * 106 / GlyphGrid.width, lineCap: .round, lineJoin: .round )) .foregroundStyle(tint) CaretShape() .fill(tint) } .frame(width: size, height: size * GlyphGrid.aspect) .accessibilityHidden(true) } }