2

We're currently developing an application for music composition in iOS. However I can't use the font called "Maestro" which I got from the internet that is in .ttf format.

I also tried using the .suit that came with macOS and it didn't work.

I followed the steps found in this question to import my custom font: custom font not working programetically in swift

Printing the fonts that are present also shows the Maestro font:

print(UIFont.familyNames)

Results: (Maestro found in the last element)

["Copperplate", "Heiti SC", "Apple SD Gothic Neo", "Thonburi", "Gill Sans", "Marker Felt", "Hiragino Maru Gothic ProN", "Courier New", "Kohinoor Telugu", "Heiti TC", "Avenir Next Condensed", "Tamil Sangam MN", "Helvetica Neue", "Gurmukhi MN", "Georgia", "Times New Roman", "Sinhala Sangam MN", "Arial Rounded MT Bold", "Kailasa", "Kohinoor Devanagari", "Kohinoor Bangla", "Chalkboard SE", "Apple Color Emoji", "PingFang TC", "Gujarati Sangam MN", "Geeza Pro", "Damascus", "Noteworthy", "Avenir", "Mishafi", "Academy Engraved LET", "Futura", "Party LET", "Kannada Sangam MN", "Arial Hebrew", "Farah", "Arial", "Chalkduster", "Kefa", "Hoefler Text", "Optima", "Palatino", "Malayalam Sangam MN", "Al Nile", "Lao Sangam MN", "Bradley Hand", "Hiragino Mincho ProN", "PingFang HK", "Helvetica", "Courier", "Cochin", "Trebuchet MS", "Devanagari Sangam MN", "Oriya Sangam MN", "Snell Roundhand", "Zapf Dingbats", "Bodoni 72", "Verdana", "Maestro Wide", "American Typewriter", "Avenir Next", "Baskerville", "Khmer Sangam MN", "Didot", "Savoye LET", "Bodoni Ornaments", "Symbol", "Menlo", "Noto Nastaliq Urdu", "Bodoni 72 Smallcaps", "Papyrus", "Hiragino Sans", "PingFang SC", "Myanmar Sangam MN", "Zapfino", "Telugu Sangam MN", "Bodoni 72 Oldstyle", "Euphemia UCAS", "Bangla Sangam MN", "Maestro"]
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Potayto
  • 37
  • 5
  • It might be a name mismatch. Try to print the name of all font names (and not just the family names) by using [this method](https://stackoverflow.com/a/48683378/3151675). – Tamás Sengel Feb 08 '18 at 10:35
  • Check out my answer on [this](https://stackoverflow.com/questions/48564490/custom-font-in-swift/48564790#48564790) SO question and run down through all the steps I listed. – E. Huckabee Feb 08 '18 at 10:35
  • @the4kman I also tried your method and the string "Maestro" is still the same. – Potayto Feb 08 '18 at 10:47
  • Hello @E.Huckabee I've also followed your answer step by step, and its still not showing the correct custom font. Im guessing that this font is somehow not compatible with iOS ? – Potayto Feb 08 '18 at 10:50
  • @Potayto can you share your font file, seems issue in your font file. – Inder Kumar Rathore Feb 08 '18 at 11:04
  • @InderKumarRathore https://drive.google.com/drive/folders/1PVKHaFhTTXX88uU_hRIZVFD5gVLnPNEO?usp=sharing I've put the font files that I tried using in this Google Drive folder – Potayto Feb 08 '18 at 11:09

1 Answers1

2

I found that Maestro.ttf font is used for music symbols and if you set your label as label.text = "hello world" then it will appear as normal but if you copy the symbols from font and paste it in the string then it will be shown on runtime.

Copy below text and paste it in your code, the ? symbols here is because this web site(as well as xcode) doesn't support the Maestro font

label.text = " "

Screen shot of simulator:

enter image description here

To show the symbols of the Maestro font you can't simply put 1234 hello text (0-9, a-z,A-Z) and expect it to be converted. You need to copy symbols from the font (screen shot below) and paste it into xcode, though it will be shown as ? in xcode but when you run it it will show the Maestro font symbols.

enter image description here

To make the xcode show the Maestro font

  1. Install the font int the font book
  2. Restart the xcode
  3. Make the setting as below

enter image description here

Community
  • 1
  • 1
Inder Kumar Rathore
  • 39,458
  • 17
  • 135
  • 184