10/19/2021

Glyph

My own personal text editor built with Rust + OpenGL


Inspired by Jamie Brandon's own text editor, focus, I decided to do the same.

This has been a particularly fun project for me, because I usually spend a lot of time building things designed with others in mind. Be it that the end user is someone else, or I want others to contribute to the project.

This project is different, I intend to be the only end user, and so every design decision is influenced by my preferences and my desires.

I also intend to be the only developer, and there's a certain sense of engineering romanticism in that. I can move fast and spend less time concerned with how readable my code is, the experience is very pure — I can just let my ideas and computation flow into the code unbridled.

Currently Glyph supports Vim keybinds, syntax highlighting, and runs at a consistent and smooth ~100 FPS. My ultimate goal is to support the features I need to "bootstrap" Glyph.

Bootstrapping is a term used in programming language development, where you build a compiler that can compile itself. For example the Rust compiler can compile Rust. It's a very cool feat of engineering, and a rite of passage and a major milestone in a programming language's development.

So I'm doing the same for code editors. I'm making a code editor that can be used to write itself!

The last piece of the puzzle is implementing the LSP protocol for intelligent language support.

Graphics

I'm choosing to render text to the screen using OpenGL. I wanted to go with a graphics API because it honestly felt quite boring to simply write to the terminal, and I've been meaning to get my hands dirty with low-level graphics. I at first considered a combination of Apple's native Cocoa API + CoreGraphics, using Cocoa for the run-of-the-mill UI needs like windows, dropdowns, and CoreGraphics for rendering text.

However, this of course means learning both APIs, which are more esoteric compared to OpenGL. There's a lot of literature and resources to be found on OpenGL, and it seems to be easier to learn over Vulkan. And of course WebGL knowledge is easily transferred to OpenGL since they share the same API.


Got any questions? Did I say something completely bogus and wrong? Hit me up on Twitter.