skip CLI should have a `skip font` command
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.2k
- Forks
- 106
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
Apropos #345 and #346, it's very complicated to set up fonts correctly in a Skip app, and worst part is that when you mess it up, the build succeeds, and the app just silently shows the system-default font, with no warning or message in the build/runtime logs about missing fonts.
The skip CLI has a skip icon command that takes care of icons for you; I think it would be really helpful to have a skip font command that can take care of fonts, too.
You'd pass it the name of a file, like skip font ProtestGuerrilla-Regular.ttf, and it would:
- Read the Postscript metadata and compute a font file name to match Android standards (
protest_guerilla.ttf) - Copy the file into
Sources/MyApp/Resourceswith the right name - Add any project references / symlinks necessary to make the font work in Android
- Add the file to
UIAppFonts - Print out example code of how to use the font, ensuring that the developer uses the font's PostScript name and not the file's name.
Text("Hello, world").font(.custom("Protest Guerilla", size: 30.0))
Maybe even generate an extension to Font that would let you use the font in a typesafe way.
public enum BundledFont: String {
case ProtestGuerrilla = "Protest Guerrilla"
}
extension Font {
public static func bundled(_ font: BundledFont, size: CGFloat) -> Font {
return .custom(font.rawValue, size: size)
}
}
Then, skip font could suggest:
Text("Hello, world").font(.bundled(.ProtestGuerilla, size: 30.0))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing skip icon CLI command and the font resource handling described in the issue. Define how metadata-based naming, Android references, UIAppFonts, usage examples, and optional type-safe APIs should fit together; done means skip font handles the requested file and produces usable guidance for both platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, ios, swift
- Domain
- cli, mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100