Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This fixes a bug and adds a feature #111

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add additional initializer for Font
This would allow using a custom monospace font for highlighting.
This is especially useful if, say, the code is embedded into some sort of presentation 😊.
An assert could be added to make sure the font is monospace,
but I feel like that's not required.

If somebody wants to display their code in Comic Sans, all the more power to them
  • Loading branch information
terhechte committed Jun 7, 2020
commit 61a6ca5681b9f5b12ff2a30a0a7b34ef7c428c4c
6 changes: 6 additions & 0 deletions Sources/Splash/Theming/Font.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public struct Font {
resource = .system
self.size = size
}

/// Initialize an instance with an existing, custom, font.
public init(_ font: Loaded) {
resource = .preloaded(font)
self.size = Double(font.pointSize)
}
}

public extension Font {
Expand Down