damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 271e3ad54a9d94d2ba38a7d9c1f8b085a5596bc7
parent dac21a1562dc00dac16c121cdeb23cf9fd7e84e4
Author: Ben Weeks <ben.weeks@outlook.com>
Date:   Tue,  6 Jun 2023 00:05:33 +0100

Add Inter font

ChangeLog-Changed: Switch to new font (Inter)

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 40++++++++++++++++++++++++++++++++++++++++
Adamus/Font/Inter-Bold.otf | 0
Adamus/Font/Inter-Italic.otf | 0
Adamus/Font/Inter-Light.otf | 0
Adamus/Font/Inter-Medium.otf | 0
Adamus/Font/Inter-Regular.otf | 0
Adamus/Font/Inter-SemiBold.otf | 0
Adamus/Font/LICENSE.txt | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdamus/Info.plist | 9+++++++++
Adamus/Util/FontManager.swift | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10 files changed, 205 insertions(+), 0 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -301,6 +301,14 @@ BAB68BED29543FA3007BA466 /* SelectWalletView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB68BEC29543FA3007BA466 /* SelectWalletView.swift */; }; DD597CBD2963D85A00C64D32 /* MarkdownTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD597CBC2963D85A00C64D32 /* MarkdownTests.swift */; }; E4FA1C032A24BB7F00482697 /* SearchSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FA1C022A24BB7F00482697 /* SearchSettingsView.swift */; }; + E4FA1C052A2E9EA300482697 /* FontManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FA1C042A2E9EA300482697 /* FontManager.swift */; }; + E4FA1C092A2E9EF900482697 /* LICENSE.txt in Resources */ = {isa = PBXBuildFile; fileRef = E4FA1C082A2E9EF900482697 /* LICENSE.txt */; }; + E4FA1C0F2A2EA03600482697 /* Inter-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = E4FA1C0D2A2E9F1D00482697 /* Inter-Light.otf */; }; + E4FA1C102A2EA03600482697 /* Inter-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = E4FA1C0C2A2E9F1300482697 /* Inter-SemiBold.otf */; }; + E4FA1C112A2EA03600482697 /* Inter-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = E4FA1C0B2A2E9F0C00482697 /* Inter-Medium.otf */; }; + E4FA1C122A2EA03600482697 /* Inter-Italic.otf in Resources */ = {isa = PBXBuildFile; fileRef = E4FA1C0A2A2E9F0300482697 /* Inter-Italic.otf */; }; + E4FA1C132A2EA03600482697 /* Inter-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = E4FA1C0E2A2E9F3000482697 /* Inter-Regular.otf */; }; + E4FA1C142A2EA03600482697 /* Inter-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = E4FA1C072A2E9EEB00482697 /* Inter-Bold.otf */; }; E990020F2955F837003BBC5A /* EditMetadataView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E990020E2955F837003BBC5A /* EditMetadataView.swift */; }; E9E4ED0B295867B900DD7078 /* ThreadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9E4ED0A295867B900DD7078 /* ThreadView.swift */; }; F757933A29D7AECD007DEAC1 /* ImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F757933929D7AECD007DEAC1 /* ImagePicker.swift */; }; @@ -745,6 +753,14 @@ BAB68BEC29543FA3007BA466 /* SelectWalletView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectWalletView.swift; sourceTree = "<group>"; }; DD597CBC2963D85A00C64D32 /* MarkdownTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkdownTests.swift; sourceTree = "<group>"; }; E4FA1C022A24BB7F00482697 /* SearchSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSettingsView.swift; sourceTree = "<group>"; }; + E4FA1C042A2E9EA300482697 /* FontManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontManager.swift; sourceTree = "<group>"; }; + E4FA1C072A2E9EEB00482697 /* Inter-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inter-Bold.otf"; sourceTree = "<group>"; }; + E4FA1C082A2E9EF900482697 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; }; + E4FA1C0A2A2E9F0300482697 /* Inter-Italic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inter-Italic.otf"; sourceTree = "<group>"; }; + E4FA1C0B2A2E9F0C00482697 /* Inter-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inter-Medium.otf"; sourceTree = "<group>"; }; + E4FA1C0C2A2E9F1300482697 /* Inter-SemiBold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inter-SemiBold.otf"; sourceTree = "<group>"; }; + E4FA1C0D2A2E9F1D00482697 /* Inter-Light.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inter-Light.otf"; sourceTree = "<group>"; }; + E4FA1C0E2A2E9F3000482697 /* Inter-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inter-Regular.otf"; sourceTree = "<group>"; }; E990020E2955F837003BBC5A /* EditMetadataView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditMetadataView.swift; sourceTree = "<group>"; }; E9E4ED0A295867B900DD7078 /* ThreadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadView.swift; sourceTree = "<group>"; }; F757933929D7AECD007DEAC1 /* ImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePicker.swift; sourceTree = "<group>"; }; @@ -1143,6 +1159,7 @@ 50B5685229F97CB400A23243 /* CredentialHandler.swift */, 4C7D09582A05BEAD00943473 /* KeyboardVisible.swift */, 3A8CC6CB2A2CFEF900940F5F /* StringUtil.swift */, + E4FA1C042A2E9EA300482697 /* FontManager.swift */, ); path = Util; sourceTree = "<group>"; @@ -1300,6 +1317,7 @@ 4CE6DEE527F7A08100C66700 /* damus */ = { isa = PBXGroup; children = ( + E4FA1C062A2E9EB300482697 /* Font */, F7F0BA23297892AE009531F3 /* Modifiers */, 4C4A3A5A288A1B2200453788 /* damus.entitlements */, 4CE4F9DF285287A000C00DD9 /* Components */, @@ -1456,6 +1474,20 @@ path = Extensions; sourceTree = "<group>"; }; + E4FA1C062A2E9EB300482697 /* Font */ = { + isa = PBXGroup; + children = ( + E4FA1C0D2A2E9F1D00482697 /* Inter-Light.otf */, + E4FA1C0C2A2E9F1300482697 /* Inter-SemiBold.otf */, + E4FA1C0B2A2E9F0C00482697 /* Inter-Medium.otf */, + E4FA1C0A2A2E9F0300482697 /* Inter-Italic.otf */, + E4FA1C0E2A2E9F3000482697 /* Inter-Regular.otf */, + E4FA1C072A2E9EEB00482697 /* Inter-Bold.otf */, + E4FA1C082A2E9EF900482697 /* LICENSE.txt */, + ); + path = Font; + sourceTree = "<group>"; + }; F7F0BA23297892AE009531F3 /* Modifiers */ = { isa = PBXGroup; children = ( @@ -1614,9 +1646,16 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + E4FA1C0F2A2EA03600482697 /* Inter-Light.otf in Resources */, + E4FA1C102A2EA03600482697 /* Inter-SemiBold.otf in Resources */, + E4FA1C112A2EA03600482697 /* Inter-Medium.otf in Resources */, + E4FA1C122A2EA03600482697 /* Inter-Italic.otf in Resources */, + E4FA1C132A2EA03600482697 /* Inter-Regular.otf in Resources */, + E4FA1C142A2EA03600482697 /* Inter-Bold.otf in Resources */, 3ACB685F297633BC00C46468 /* Localizable.strings in Resources */, 4CE6DEEE27F7A08200C66700 /* Preview Assets.xcassets in Resources */, 3ACB685C297633BC00C46468 /* InfoPlist.strings in Resources */, + E4FA1C092A2E9EF900482697 /* LICENSE.txt in Resources */, 50DA11262A16A23F00236234 /* Launch.storyboard in Resources */, 4CE6DEEB27F7A08200C66700 /* Assets.xcassets in Resources */, 4C198DF129F88C6B004C165C /* License.txt in Resources */, @@ -1777,6 +1816,7 @@ 4C06670128FC7C5900038D2A /* RelayView.swift in Sources */, 4C285C8C28398BC7008A31F1 /* Keys.swift in Sources */, 4CACA9DC280C38C000D9BBE8 /* Profiles.swift in Sources */, + E4FA1C052A2E9EA300482697 /* FontManager.swift in Sources */, 4CE879582996C45300F758CC /* ZapsView.swift in Sources */, 4C30AC7429A5680900E2BD5A /* EventGroupView.swift in Sources */, 4C633352283D419F00B1C9C3 /* SignalModel.swift in Sources */, diff --git a/damus/Font/Inter-Bold.otf b/damus/Font/Inter-Bold.otf Binary files differ. diff --git a/damus/Font/Inter-Italic.otf b/damus/Font/Inter-Italic.otf Binary files differ. diff --git a/damus/Font/Inter-Light.otf b/damus/Font/Inter-Light.otf Binary files differ. diff --git a/damus/Font/Inter-Medium.otf b/damus/Font/Inter-Medium.otf Binary files differ. diff --git a/damus/Font/Inter-Regular.otf b/damus/Font/Inter-Regular.otf Binary files differ. diff --git a/damus/Font/Inter-SemiBold.otf b/damus/Font/Inter-SemiBold.otf Binary files differ. diff --git a/damus/Font/LICENSE.txt b/damus/Font/LICENSE.txt @@ -0,0 +1,94 @@ +Copyright (c) 2016-2020 The Inter Project Authors. +"Inter" is trademark of Rasmus Andersson. +https://github.com/rsms/inter + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION AND CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/damus/Info.plist b/damus/Info.plist @@ -70,5 +70,14 @@ <string>Damus needs access to your camera if you want to upload photos from it</string> <key>NSMicrophoneUsageDescription</key> <string>Damus needs access to your microphone if you want to upload recorded videos from it</string> + <key>UIAppFonts</key> + <array> + <string>Inter-Regular.otf</string> + <string>Inter-Bold.otf</string> + <string>Inter-Light.otf</string> + <string>Inter-SemiBold.otf</string> + <string>Inter-Medium.otf</string> + <string>Inter-Italic.otf</string> + </array> </dict> </plist> diff --git a/damus/Util/FontManager.swift b/damus/Util/FontManager.swift @@ -0,0 +1,62 @@ +// +// FontManager.swift +// damus +// +// Created by Ben Weeks on 27/05/2023. +// +import Foundation +import SwiftUI + +struct FontManager { + struct dynamicSize { + public static var largeTitle: CGFloat = UIFont.preferredFont(forTextStyle: .largeTitle).pointSize // - 1 + public static var title1: CGFloat = UIFont.preferredFont(forTextStyle: .title1).pointSize //- 0 + public static var title2: CGFloat = UIFont.preferredFont(forTextStyle: .title2).pointSize //- 0 + public static var title3: CGFloat = UIFont.preferredFont(forTextStyle: .title3).pointSize //- 0 + public static var body: CGFloat = UIFont.preferredFont(forTextStyle: .body).pointSize //- 1 + public static var callout: CGFloat = UIFont.preferredFont(forTextStyle: .callout).pointSize //- 1 + public static var caption1: CGFloat = UIFont.preferredFont(forTextStyle: .caption1).pointSize //- 1 + public static var caption2: CGFloat = UIFont.preferredFont(forTextStyle: .caption2).pointSize //- 1 + public static var footnote: CGFloat = UIFont.preferredFont(forTextStyle: .footnote).pointSize //- 1 + public static var headline: CGFloat = UIFont.preferredFont(forTextStyle: .headline).pointSize //- 1 + public static var subheadline: CGFloat = UIFont.preferredFont(forTextStyle: .subheadline).pointSize //- 1 + // repeat for all the dynamic sizes + } + + struct Inter { + static let familyRoot = "Inter" + + static let bold = "\(familyRoot)-Bold" + static let regular = "\(familyRoot)-Regular" + static let light = "\(familyRoot)-Light" + static let medium = "\(familyRoot)-Medium" + static let semibold = "\(familyRoot)-SemiBold" + static let italic = "\(familyRoot)-Italic" + + static let largeTitle: Font = Font.custom(FontManager.Inter.regular, size: FontManager.dynamicSize.largeTitle) + static let title1: Font = Font.custom(FontManager.Inter.semibold, size: FontManager.dynamicSize.title1) + static let title2: Font = Font.custom(FontManager.Inter.semibold, size: FontManager.dynamicSize.title2) + static let title3: Font = Font.custom(FontManager.Inter.semibold, size: FontManager.dynamicSize.title3) + static let body: Font = Font.custom(FontManager.Inter.regular, size: FontManager.dynamicSize.body) + static let caption1: Font = Font.custom(FontManager.Inter.regular, size: FontManager.dynamicSize.caption1) + static let caption2: Font = Font.custom(FontManager.Inter.regular, size: FontManager.dynamicSize.caption2) + static let footnote: Font = Font.custom(FontManager.Inter.regular, size: FontManager.dynamicSize.footnote) + static let headline: Font = Font.custom(FontManager.Inter.regular, size: FontManager.dynamicSize.headline) + static let subheadline: Font = Font.custom(FontManager.Inter.regular, size: FontManager.dynamicSize.subheadline) + // repeat for other sizes + } +} + +extension Font { + public static var largeTitle = FontManager.Inter.largeTitle + public static var title1 = FontManager.Inter.title1 + public static var title2 = FontManager.Inter.title2 + public static var title3 = FontManager.Inter.title3 + public static var body = FontManager.Inter.body + public static var caption1 = FontManager.Inter.caption1 + public static var caption2 = FontManager.Inter.caption2 + public static var footnote = FontManager.Inter.footnote + public static var headline = FontManager.Inter.headline + public static var subheadline = FontManager.Inter.subheadline + // repeat for the rest of the dynamic sizes +}