738 questions
3
votes
2
answers
139
views
How to change preferredFont globally in iOS app?
I've searched all over and can't seem to find a definitive (current) answer to this question.
I have a UILabel set up to use dynamic font sizing for accessibility reasons. It worked quite well with ...
0
votes
1
answer
57
views
Re-apply styling to UITabBarItems without reloading app
I have logic that lets the user change Font.Design, which works fine for SwiftUI views, and also the navigation bar (logic included below). But it does not reload or re-apply to existing TabView ...
0
votes
1
answer
61
views
Updating label text when font set with systemFont vs UIFont
When setting font in configureSpeedLabel and configureProgressLabel below, if I set font using UIFont speedLabel.font = UIFont(name: "TimesNewRomanPSMT", size: 24) then the progress track ...
-1
votes
1
answer
91
views
Using Font in UITextView in Swift
I am currently working with the UITextView and now I wanted to set the font there. As far as I can see, I can only apply the UIFont and not the Font class itself. I found several guides to convert a ...
0
votes
1
answer
70
views
How to use custom TextStyle in xib?
In code , I can define a UILabel has a dynamic font like this, and I change this body TextStyle font from default size to 30.
label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: UIFont....
0
votes
1
answer
53
views
How to use OpenType feature tags with UIFont?
How to use OpenType feature tags (eg. cv11) with UIFont in Swift?
-1
votes
1
answer
426
views
How to display non-slashed zero character in Swift for the system font SF Mono [duplicate]
The system font SF Mono has two variations for the number zero (0) and number one (1).
By default, a slashed zero character is displayed for text with system font SF Mono.
In the MacOS Font Book, both ...
0
votes
0
answers
92
views
SwiftUI How can I get the correct font size for CATextLayer
I am using SWiftUI and have a video editing application . A person selects a video and we display it along with the date the video was taken . The initial overlay is size 14 and if the person saves ...
0
votes
0
answers
55
views
Custom Font for iOS Only shows if Added in IB?
My font file name is "CONSELHEIRO.otf". It is located in a folder called 'fonts'. I have added this file to Xcode, and made sure that it was indeed added to the target. I added it in the &...
3
votes
2
answers
4k
views
How to get an array of all installed fonts on iOS
iOS 16 allows to install custom fonts. They are listed in Settings → General → Fonts.
I too want to display a list of the installed fonts in my app.
I did try using UIFont.familyNames as well as ...
0
votes
0
answers
35
views
Custom CGFonts never deallocated when scrolling TableView
I am having an issue with CGFont not being deallocated when used within a TableView, minimal example of what I'm trying to do is at follow:
extension FontPickerPageViewController: ...
1
vote
0
answers
161
views
Crash accessing static variable UIFont
Swift application. I have a Theme class declared including the following:
class Theme {
enum Font {
static let header1 = UIFont(name: "IBM Plex Sans Bold", size: 32)!...
1
vote
1
answer
143
views
Add custom weight other than Bold in iOS Font descriptor in C# xamarin iOS
I have created a custom renderer as i wanted to use "SF Pro Display" font and using UIFont.SystemFontOfSize(size , weight) i get output as .SFUI-weight .Below is the code i used for custom ...
0
votes
1
answer
1k
views
How to bold TextView with custom Font in Swift?
I want to change my text in textview to BOLD and Italic on button click; but when I do this the custom font which is I am using for my textview also changed; but I want to use custom font.
Following ...
2
votes
1
answer
1k
views
How to set a custom font for accessoryInline iOS 16 Lock Screen widgets?
I want to set a custom font for inline widget text. I put the custom font to the accessory Rectangular and it's working well however, I am not able to set the font to the accessory Inline widget.
Here ...
2
votes
1
answer
232
views
Can't subclass UIFont
I use custom fonts in my iOS application and have setup the fonts like so:
private enum MalloryProWeight: String {
case book = "MalloryMPCompact-Book"
case medium = "MalloryMPCompact-...
0
votes
1
answer
589
views
How can i add different custom font to different target in iOS
I am trying to add 3 different custom font to 3 different target how can i add that font. one storyboard have 3 labels which has bold, semi-bold, regular font weight with different size. i have added ...
1
vote
0
answers
109
views
adjustsFontSizeToFitWidth working different on iOS 14 vz 15
Context:
Im observing a bigger down size of my text when using .adjustsFontSizeToFitWidth on iOS15 vz iOS14 Xcode 13 but i haven't find any release notes explaining why.
My observations are this: ...
0
votes
1
answer
56
views
Font Character Height Change in iOS
I am trying to see if there is a proper method to change the height of the text, without changing the width - more akin to vertical compression. Photoshop lets you do it as shown below:
There are ...
-2
votes
1
answer
470
views
Why we need to list custom fonts in info.plist?
We already have project in which already added fonts is working without adding plist file but we want to add another fonts which is not working without adding in plist?
0
votes
1
answer
30
views
Dynamically assigned UIFont does not show immediately in slow simulator
I have a UIView with a UILabel for which, I'd like allow the user to dynamically change the font size. The code below almost works, but the problem is that after the new UIFont is assigned to the ...
2
votes
2
answers
908
views
Adding custom font error with Xcode 13 with ("Fonts provided by application")
I followed nearly every tutorial and stack overflow questions and still couldn't get my fonts to work.
I downloaded Montserrat font from Google fonts
I added the folder to my project with Copy items ...
1
vote
1
answer
52
views
How do I determine what font is being used (by default) in the UISegmentedControl?
There are a dozen answers to how to set the font of a UISegmentedControl, but I want to determine what font is being used, without having been manually set.
override func viewDidLoad() {
super....
0
votes
0
answers
409
views
Registered font not getting after reopen application
I am using Font from UIDocumentPickerViewController and I am successfully registered font and also get UIFont.families. But once I kill the application and then reopen application then I can not get ...
0
votes
0
answers
182
views
Japanese keyboard with English font - iOS
I have a textview in my application. User can select a preferred English font from a dropdown and then type in the textView.
I have 3 more buttons (bold, italic and underline) for text formatting ...
1
vote
2
answers
819
views
System Font with custom size for text style
Aim:
I would like to know how to use a system font in my SwiftUI app with a custom size that supports dynamic size (that changes when the user changes the text size on the device, font size changes ...
0
votes
1
answer
718
views
How do you create an italic AND black (weight) UIFont object?
I want to create a UIFont that is both black in weight (heavier than bold) and italic, without hardcoding any font names or anything.
All my attempts have came up short. You can do it via UIFont....
0
votes
2
answers
475
views
How to build a font generator in iOS Swift and allowing pasting to clipboard
I'm now building a listview to display fonts from the UIFonts framework. However, for using UIPasteboard.general.string, the fonts are not copied to the clipboard and only the plain text is ...
3
votes
0
answers
469
views
Scale font size when resizing UITextView
I have a UITextView and its attributedText can have different fonts, fonts sizes and colours as shown in the image (left).
User can resize textView by dragging from resize handles (vertically/...
0
votes
0
answers
222
views
Unable to access System Small Caps Font
I am getting the system small caps font using:
let systemFont = UIFont.systemFont(ofSize: 16.0, weight: UIFont.Weight.regular)
let smallCapsDesc = systemFont.fontDescriptor....
3
votes
0
answers
1k
views
UIFont line height
Is there any way to set the lineHeight of a UIFont? I know that NSAttributedString can be used to achieve this, but this doesn't suit my case, I would really like to just manipulate font of a UILabel ...
1
vote
1
answer
825
views
Get Font.Weight in iOS 14
In iOS 13 and low I got Font.Weight using this extension for UIFont
var weight: UIFont.Weight {
guard let traits = fontDescriptor.object(forKey: .traits) as? [UIFontDescriptor.TraitKey: Any], let ...
0
votes
0
answers
960
views
Convert UIFont to css font style string
I have some UIFonts like this:
let regularFont = UIFont.systemFont(ofSize: 18, weight: .regular)
let mediumFont = UIFont.systemFont(ofSize: 18, weight: .medium)
I use them in my UIKit components ...
3
votes
1
answer
738
views
UITextView Fonts are bluring after Zoom IN
I have created small project with UIScrollView, UIView and UITextView (hierarchy is also the same.). UIView display as red color and UITextView display as blue color. Then I have added UIFont to with ...
1
vote
0
answers
267
views
How to retrieve the current system design from a UIFont instance?
Given a UIFont instance, how can I determine what system design it is using? This is the value UIFontDescriptor.SystemDesign which can be one of: default, monospaced, rounded or serif.
I see how to ...
1
vote
1
answer
460
views
How to test UIFontMetrics UIFont.TextStyle in XCTest
How can I test the given UIFont.TextStyle for a UIFont with a dynamic font size via UIFontMetrics in XCTest unit testing?
var myDynamicFont: UIFont {
let font = UIFont(name: "Font-Name", ...
0
votes
0
answers
67
views
Are fonts used by a .net application emended in the application?
I've downloaded and installed a font in my computer and using it as a font for buttons' texts in my application. I wanted to know if the all the fonts used in an application are automatically embedded ...
8
votes
2
answers
3k
views
iOS 13: How can I tweak the leading / descend / line height of a custom font in UIKit / SwiftUI
I'm using a custom font and somehow the rendering screws up the line height, potentially because of misconfigured descent or leading (?), so that g's and j's are cut off in the last line of the ...
-1
votes
1
answer
665
views
Dynamically loading custom fonts in iOS
Can you dynamically load custom fonts in iOS similar to how you do in Javascript?
I have seen few questions about this but they are quite outdated or don't really answer the question.
I don't want to ...
0
votes
0
answers
136
views
Doesn't Swift care capitalization of font name?
I wrote code that can simply return UIFont which can used like this
myLabel.font = UIFont.AppleSDGothicNeo.medium.of(20)
And actual implementation is like this
extension UIFont {
enum ...
0
votes
1
answer
416
views
Why the size of text created by font of systemFontOfSize and SFPro-Regular aren't equal in iOS13?
After I learned the system default font in iOS13 is SF Pro according to apple's development guidance.
I wandering [UIFont systemFontOfSize:18] might can be replayced by [UIFont fontWithName:@"...
8
votes
1
answer
3k
views
How to get font style name from UIFont in Swift 5.1?
I need to write a custom font picker view in my ios project. when user click on font family name, i need to display fonts which are in particular family, i used name as particular text style in the ...
3
votes
1
answer
1k
views
SwiftUI.Font How to apply UIFontDescriptor.FeatureKey.featureIdentifier
A UIFont can easily be setup via the font descriptor, e.g.
let settings: [UIFontDescriptor.FeatureKey: Int] = [
.featureIdentifier: kStylisticAlternativesType,
.typeIdentifier: 2]
...
3
votes
1
answer
2k
views
Making UIFont Black/Heavy and Italic
How can I set a font for a label heavy AND italic?
Examples from SO does not work:
labelCurrentDate.font = UIFont(descriptor: UIFont.systemFont(ofSize: 32, weight: .black).fontDescriptor....
1
vote
0
answers
181
views
Determine fallback UIFont for special characters in iOS
I'm using Averta font series in my iOS app. I'm trying to show "₿" symbol in Averta-Bold. When there is unsupported character, iOS show it in default system font. I don't have any problem with showing ...
1
vote
1
answer
260
views
Creating an italic version from a *light* font using symbolic traits
I'd like to get an italic version of a light font, for example "HelveticaNeue-Light".
Using a fontDescriptor gives me the italic version of the 'regular' "Helvetica Neue" instead of the italic "...
1
vote
0
answers
280
views
NSAttribuedString lines top & bottom spacing changed on iOS 13.4
On the update of iOS 13.4, the top & bottom spacing of the NSAttributedString lines not the same not.
This is the same code run on iOS 13.3 & iOS 13.4.
iOS 13.3
iOS 13.4
Here is the code ...
59
votes
4
answers
30k
views
Convert from SwiftUI.Font to UIFont
I have a UIViewRepresentable with a UITextView and I want to set the font on the UITextView using the current Font from the SwiftUI environment. I just need a simple init like:
UIFont(_ swiftUIFont: ...
1
vote
0
answers
46
views
Set subviews to correct dimensions after parent view has scaled
I am creating a UIView programtically that is scaled and translated to the center of my view. I am then adding subviews (UILabel's) to that view programatically and the issue I have encountered is ...
4
votes
0
answers
658
views
How to use method swizzling to change the system font used in iOS app?
I am creating an iOS app in which different fonts must be used for different languages.
I am trying to do this by using systemFont everywhere in the app and at runtime, changing what systemFont ...