thebaselab / codeapp

Building a full-fledged code editor for iPad
https://code.thebaselab.com
MIT License
2.75k stars 184 forks source link

Support for Nerd Fonts #922

Closed thekeith closed 3 months ago

thekeith commented 10 months ago

I’m proposing adding some Nerd Fonts to the mix like Fira Code Nerd Font, Jetbrains Mono Nerd Font and Sauce Code Pro Nerd Font.

Questions:

  1. How are fonts currently loaded in the app today?
  2. Is there any plan to add a Nerd Font already?
  3. Are there any considerations/complications to adding a new font specifically to this app?
bummoblizard commented 10 months ago
  1. Fonts currently only work in the text editor. Custom fonts are loaded by adding entries to the Copy Bundle Resources step in the Xcode project. Then they can be manually referenced in the CSS for the editor and Monaco Editor's api can be called to load the font. image

https://github.com/thebaselab/codeapp/blob/9d95220f775f79bd71c0e856cd5868f7535b32d2/Dependencies/monaco-textmate.bundle/index.html#L12-L16 https://github.com/thebaselab/codeapp/blob/9d95220f775f79bd71c0e856cd5868f7535b32d2/CodeApp/Managers/MonacoEditor.swift#L92-L93

  1. Not at the moment
  2. The licenses must be compatible to ours.
bummoblizard commented 10 months ago

I think it would great if we can find a way to dynamically load fonts in the editor / terminal without bundling it in Xcode. That way we can allow custom fonts to be installed dynamically by users. (without worrying about licenses)

bummoblizard commented 10 months ago

https://developer.mozilla.org/en-US/docs/Web/API/FontFace/FontFace

thekeith commented 10 months ago

@bummoblizard we could use something similar to blink shell, which uses a CSS font stylesheet. I’ll also try building with a nerd font loaded in via XCode.

thekeith commented 10 months ago

@bummoblizard also, thanks for being really responsive and making a great product. I’ve gone through a lot of them on iPad Pro and am glad to have found this app.

pickaxe828 commented 7 months ago

There also some other apps that can load font globally, like Fontinator

bummoblizard commented 3 months ago

There also some other apps that can load font globally, like Fontinator

That's right. Use a font installer app to install additional fonts and it should show up in Code's settings menu. Reference: https://github.com/thebaselab/codeapp/issues/1004. For custom font in terminal, I opened this: https://github.com/thebaselab/codeapp/issues/1037.