# we — Development Plan A from-scratch web browser engine in pure Rust. macOS ARM only. Zero external crate dependencies. --- ## Phase 1: Platform Layer **Goal:** Open a window on macOS, draw pixels, handle input events. - Objective-C runtime FFI (`objc_msgSend`, `objc_getClass`, `sel_registerName`, `class_addMethod`, `objc_allocateClassPair/registerClassPair`) - Rust wrappers: `msg_send!` macro, `Class`, `Sel`, `Id` types - CoreFoundation minimal bindings (`CFString`, `CFRetain`/`CFRelease`) - AppKit FFI: `NSApplication`, `NSWindow`, `NSView`, `NSAutoreleasePool` - CoreGraphics rendering surface: `CGContext`, `CGBitmapContext`, `CGColorSpace` - Custom `NSView` subclass overriding `drawRect:` - Basic event handling: window close, resize, key/mouse events - `cargo run -p browser` opens a blank window with a colored rectangle ## Phase 2: Pure Rust Font Engine **Goal:** Parse system fonts and rasterize glyphs without CoreText. - OTF/TTF parser: read `cmap`, `glyf`, `loca`, `head`, `hhea`, `hmtx`, `maxp`, `OS/2`, `name` tables - Glyph outline extraction (TrueType quadratic beziers) - Rasterizer: scanline fill of glyph outlines to grayscale bitmaps - Basic shaping: horizontal advance, kern table lookups - Glyph cache (HashMap of rasterized bitmaps) - Load fonts from `/System/Library/Fonts/` or `/Library/Fonts/` ## Phase 3: HTML Parsing + Basic DOM + Block Layout + Software Rendering **Goal:** Parse HTML, build a DOM, do basic block layout, render text to the window. - HTML5 tokenizer (per spec state machine) - Tree builder (subset: ``, `
`, ``, ``, `