Fix scaling of custom emoji (#1020)
This commit is contained in:
parent
76556f4e83
commit
a0e37273a4
|
@ -134,6 +134,7 @@ struct AccountDetailHeaderView: View {
|
|||
VStack(alignment: .leading, spacing: 0) {
|
||||
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
|
||||
.font(.scaledHeadline)
|
||||
.emojiSize(Font.scaledHeadlinePointSize)
|
||||
Text("@\(account.acct)")
|
||||
.font(.scaledCallout)
|
||||
.foregroundColor(.gray)
|
||||
|
@ -160,6 +161,7 @@ struct AccountDetailHeaderView: View {
|
|||
|
||||
EmojiTextApp(account.note, emojis: account.emojis)
|
||||
.font(.scaledBody)
|
||||
.emojiSize(Font.scaledBodyPointSize)
|
||||
.padding(.top, 8)
|
||||
.environment(\.openURL, OpenURLAction { url in
|
||||
routerPath.handle(url: url)
|
||||
|
@ -242,6 +244,7 @@ struct AccountDetailHeaderView: View {
|
|||
.foregroundColor(Color.green.opacity(0.80))
|
||||
}
|
||||
EmojiTextApp(field.value, emojis: viewModel.account?.emojis ?? [])
|
||||
.emojiSize(Font.scaledBodyPointSize)
|
||||
.foregroundColor(theme.tintColor)
|
||||
.environment(\.openURL, OpenURLAction { url in
|
||||
routerPath.handle(url: url)
|
||||
|
|
|
@ -39,12 +39,14 @@ public struct AccountsListRow: View {
|
|||
VStack(alignment: .leading, spacing: 2) {
|
||||
EmojiTextApp(.init(stringValue: viewModel.account.safeDisplayName), emojis: viewModel.account.emojis)
|
||||
.font(.scaledSubheadline)
|
||||
.emojiSize(Font.scaledSubheadlinePointSize)
|
||||
.fontWeight(.semibold)
|
||||
Text("@\(viewModel.account.acct)")
|
||||
.font(.scaledFootnote)
|
||||
.foregroundColor(.gray)
|
||||
EmojiTextApp(viewModel.account.note, emojis: viewModel.account.emojis)
|
||||
.font(.scaledFootnote)
|
||||
.emojiSize(Font.scaledFootnotePointSize)
|
||||
.lineLimit(3)
|
||||
.environment(\.openURL, OpenURLAction { url in
|
||||
routerPath.handle(url: url)
|
||||
|
|
|
@ -61,6 +61,7 @@ public struct AppAccountView: View {
|
|||
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
|
||||
Text("\(account.username)@\(viewModel.appAccount.server)")
|
||||
.font(.scaledSubheadline)
|
||||
.emojiSize(Font.scaledSubheadlinePointSize)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ public struct ConversationDetailView: View {
|
|||
{
|
||||
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
|
||||
.font(.scaledHeadline)
|
||||
.emojiSize(Font.scaledHeadlinePointSize)
|
||||
} else {
|
||||
Text("Direct message with \(viewModel.conversation.accounts.count) people")
|
||||
.font(.scaledHeadline)
|
||||
|
|
|
@ -32,6 +32,7 @@ struct ConversationMessageView: View {
|
|||
VStack(alignment: .leading) {
|
||||
EmojiTextApp(message.content, emojis: message.emojis)
|
||||
.font(.scaledBody)
|
||||
.emojiSize(Font.scaledBodyPointSize)
|
||||
.padding(6)
|
||||
.environment(\.openURL, OpenURLAction { url in
|
||||
routerPath.handleStatus(status: message, url: url)
|
||||
|
|
|
@ -22,6 +22,7 @@ struct ConversationsListRow: View {
|
|||
EmojiTextApp(.init(stringValue: conversation.accounts.map { $0.safeDisplayName }.joined(separator: ", ")),
|
||||
emojis: conversation.accounts.flatMap { $0.emojis })
|
||||
.font(.scaledSubheadline)
|
||||
.emojiSize(Font.scaledSubheadlinePointSize)
|
||||
.fontWeight(.semibold)
|
||||
.foregroundColor(theme.labelColor)
|
||||
.multilineTextAlignment(.leading)
|
||||
|
@ -39,6 +40,7 @@ struct ConversationsListRow: View {
|
|||
EmojiTextApp(conversation.lastStatus?.content ?? HTMLString(stringValue: ""), emojis: conversation.lastStatus?.emojis ?? [])
|
||||
.multilineTextAlignment(.leading)
|
||||
.font(.scaledBody)
|
||||
.emojiSize(Font.scaledBodyPointSize)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
@ -44,10 +44,18 @@ public extension Font {
|
|||
static var scaledHeadline: Font {
|
||||
customFont(size: userScaledFontSize(baseSize: headline), relativeTo: .headline).weight(.semibold)
|
||||
}
|
||||
|
||||
static var scaledHeadlinePointSize: CGFloat {
|
||||
customUIFont(size: userScaledFontSize(baseSize: headline)).pointSize
|
||||
}
|
||||
|
||||
static var scaledBody: Font {
|
||||
customFont(size: userScaledFontSize(baseSize: body), relativeTo: .body)
|
||||
}
|
||||
|
||||
static var scaledBodyPointSize: CGFloat {
|
||||
customUIFont(size: userScaledFontSize(baseSize: body)).pointSize
|
||||
}
|
||||
|
||||
static var scaledBodyUIFont: UIFont {
|
||||
customUIFont(size: userScaledFontSize(baseSize: body))
|
||||
|
@ -56,18 +64,34 @@ public extension Font {
|
|||
static var scaledCallout: Font {
|
||||
customFont(size: userScaledFontSize(baseSize: callout), relativeTo: .callout)
|
||||
}
|
||||
|
||||
static var scaledCalloutPointSize: CGFloat {
|
||||
customUIFont(size: userScaledFontSize(baseSize: body)).pointSize
|
||||
}
|
||||
|
||||
static var scaledSubheadline: Font {
|
||||
customFont(size: userScaledFontSize(baseSize: subheadline), relativeTo: .subheadline)
|
||||
}
|
||||
|
||||
|
||||
static var scaledSubheadlinePointSize: CGFloat {
|
||||
customUIFont(size: userScaledFontSize(baseSize: subheadline)).pointSize
|
||||
}
|
||||
|
||||
static var scaledFootnote: Font {
|
||||
customFont(size: userScaledFontSize(baseSize: footnote), relativeTo: .footnote)
|
||||
}
|
||||
|
||||
static var scaledFootnotePointSize: CGFloat {
|
||||
customUIFont(size: userScaledFontSize(baseSize: footnote)).pointSize
|
||||
}
|
||||
|
||||
static var scaledCaption: Font {
|
||||
customFont(size: userScaledFontSize(baseSize: caption), relativeTo: .caption)
|
||||
}
|
||||
|
||||
static var scaledCaptionPointSize: CGFloat {
|
||||
customUIFont(size: userScaledFontSize(baseSize: caption)).pointSize
|
||||
}
|
||||
}
|
||||
|
||||
public extension UIFont {
|
||||
|
|
|
@ -33,6 +33,7 @@ public struct ListEditView: View {
|
|||
VStack(alignment: .leading) {
|
||||
EmojiTextApp(.init(stringValue: account.safeDisplayName),
|
||||
emojis: account.emojis)
|
||||
.emojiSize(Font.scaledBodyPointSize)
|
||||
Text("@\(account.acct)")
|
||||
.foregroundColor(.gray)
|
||||
.font(.scaledFootnote)
|
||||
|
|
|
@ -104,6 +104,7 @@ struct NotificationRowView: View {
|
|||
.foregroundColor(.gray)
|
||||
})
|
||||
.font(.scaledSubheadline)
|
||||
.emojiSize(Font.scaledSubheadlinePointSize)
|
||||
.fontWeight(.semibold)
|
||||
.lineLimit(3)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
@ -160,6 +161,7 @@ struct NotificationRowView: View {
|
|||
emojis: notification.accounts[0].emojis)
|
||||
.lineLimit(3)
|
||||
.font(.scaledCallout)
|
||||
.emojiSize(Font.scaledCalloutPointSize)
|
||||
.foregroundColor(.gray)
|
||||
.environment(\.openURL, OpenURLAction { url in
|
||||
routerPath.handle(url: url)
|
||||
|
|
|
@ -34,6 +34,7 @@ struct StatusEditorAutoCompleteView: View {
|
|||
VStack(alignment: .leading) {
|
||||
EmojiTextApp(.init(stringValue: account.safeDisplayName),
|
||||
emojis: account.emojis)
|
||||
.emojiSize(Font.scaledFootnotePointSize)
|
||||
.font(.scaledFootnote)
|
||||
.foregroundColor(theme.labelColor)
|
||||
Text("@\(account.acct)")
|
||||
|
|
|
@ -47,6 +47,7 @@ public struct StatusEmbeddedView: View {
|
|||
VStack(alignment: .leading, spacing: 0) {
|
||||
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
|
||||
.font(.scaledFootnote)
|
||||
.emojiSize(Font.scaledFootnotePointSize)
|
||||
.fontWeight(.semibold)
|
||||
Group {
|
||||
Text("@\(account.acct)") +
|
||||
|
|
|
@ -26,6 +26,7 @@ public struct StatusEditHistoryView: View {
|
|||
VStack(alignment: .leading, spacing: 8) {
|
||||
EmojiTextApp(edit.content, emojis: edit.emojis)
|
||||
.font(.scaledBody)
|
||||
.emojiSize(Font.scaledBodyPointSize)
|
||||
Group {
|
||||
Text(edit.createdAt.asDate, style: .date) +
|
||||
Text("status.summary.at-time") +
|
||||
|
|
|
@ -38,6 +38,7 @@ struct StatusRowHeaderView: View {
|
|||
HStack(alignment: .center, spacing: 4) {
|
||||
EmojiTextApp(.init(stringValue: status.account.safeDisplayName), emojis: status.account.emojis)
|
||||
.font(.scaledSubheadline)
|
||||
.emojiSize(Font.scaledSubheadlinePointSize)
|
||||
.fontWeight(.semibold)
|
||||
.lineLimit(1)
|
||||
.layoutPriority(1)
|
||||
|
|
|
@ -19,6 +19,7 @@ struct StatusRowReblogView: View {
|
|||
+ Text("status.row.was-boosted")
|
||||
)
|
||||
.font(.scaledFootnote)
|
||||
.emojiSize(Font.scaledFootnotePointSize)
|
||||
.foregroundColor(.gray)
|
||||
.fontWeight(.semibold)
|
||||
.onTapGesture {
|
||||
|
|
|
@ -13,6 +13,7 @@ struct StatusRowSpoilerView: View {
|
|||
.foregroundColor(.secondary)
|
||||
EmojiTextApp(status.spoilerText, emojis: status.emojis, language: status.language)
|
||||
.font(.system(.subheadline, weight: .bold))
|
||||
.emojiSize(Font.scaledSubheadlinePointSize)
|
||||
.foregroundColor(.secondary)
|
||||
.multilineTextAlignment(.leading)
|
||||
Spacer()
|
||||
|
|
|
@ -12,6 +12,7 @@ struct StatusRowTextView: View {
|
|||
HStack {
|
||||
EmojiTextApp(status.content, emojis: status.emojis, language: status.language)
|
||||
.font(.scaledBody)
|
||||
.emojiSize(Font.scaledBodyPointSize)
|
||||
.environment(\.openURL, OpenURLAction { url in
|
||||
viewModel.routerPath.handleStatus(status: status, url: url)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue