xcode - Custom fonts on xcode do not appear on xib - xcode

I am trying to add new fonts on xcode5 to use them directly on xib file.
My fonts are 3 files. Kelson Sans Bold.otf Kelson Sans Light.otf and Kelson Sans Regular.otf).
I have:
-added files to my project
-edited my .plist adding a "Fonts provided by application" dictionary with 3 items with the complete name (with extention) of fonts files.
- added the files into /Library/fonts local directory
But in the interface new fonts do not appear.
I have missed something?
Tx in advance.

Fonts added to XCode5 does not work in Interface Builder. You have to set the font by code.
Something like:
textField.font =[UIFont fontWithName:#"Signika-Regular" size:size];
or using NSAttributedString

Related

Bundle custom fonts into macOS standalone application using Xcode

I am new to macOS standalone application development and I am working on fixing the issues in it. I am running with an issue where the custom fonts not getting applied to controls present in the application. I am using Xcode 11.3 in macOS Mojave 10.14
There is already a fonts folder added to the project which contains all the font files (.ttf) extension. I have referred the "fonts" folder using the key "Application fonts resource path" in the Info.plist file. Even after applying all these changes the controls are getting referred to system font instead of the embedded font.
Also, the custom fonts which are added to the project is not being shown in the Font dropdown list of Attribute inspector.
Can you please suggest on what needs to be done in order to embed the custom fonts into the project and also show these custom fonts in fonts dropdown list?
Install the font
On your macOS, double click on all the fonts you'd like to use. Following window will appear for each:
Click on the Install Font button.
Attributes inspector
You can now choose your font. Remember, only installed fonts are listed. Fonts bundled with your application are not. Select your custom font.
Bundle fonts
Add a new Copy Files phase
Set subpaths to Fonts
Drop all the font files there
Info.plist
Add a new row Application fonts resource path (ATSApplicationFontsPath)
Set value to Fonts (must match copy files phase subpath)
Test
How to test that fonts are bundled correctly:
Close the storyboard (Xcode)
Launch Font Book
Right click on your custom font and disable it
Launch your application and test that all the custom fonts are bundled properly and work as expected
Launch Font Book
Right click on your custom font and enable it again
WARNING
Do NOT open the storyboard file if you disable/remove your custom font.
You'll get the following warning if you do ...
... and all your custom font settings are gone. You can open the storyboard file again, but you have to enable/install your custom font.

How to use Font Awesome in Xamarin.iOS?

I am trying to use Font Awesome Icons in my Xamarin.iOS project.
In my Xamarin.Android project it was pretty simple:
I downloaded the Font Awesome WebKit from here
I copied the .ttf-Files of the fonts I want to use in my Assets folder
I create a new Typeface for my TextView with the font and use the unicode of the icon
Code:
var myIcon = new TextView(Context);
var regularFont = Typeface.CreateFromAsset(Context.Assets, "fonts/fa-regular-400.ttf");
myIcon.SetTypeface(regularFont, TypefaceStyle.Normal);
myIcon.Text = "\uf007";
I can change TextColor, BackgroundColor, etc. like a normal text.
My problem is, I can't figure out, how to use Font Awesome in my Xamarin.iOS project. Most tutorials and How-Tos are directed to Xamarin.Forms. I tried to merge many of these approaches, but it failed.
The only approach I found is to draw the .svg-Files with SkiaSharp, but that is no option for my use case.
Add .ttf files in your Xamarin iOS project (I have added it in resources)
Now inside info.plist Add a new key “Fonts provided by application”
Expand the array, and in string value add your fontname (eg: fa-solid-900.ttf) which you have added in your project
Setup Done:
Now Just wherever you want to add fontawesome icon just select font awesome as font family in storyboard but make sure to add text programmatically
SushiHangovers comment leads me to the solution for my problem.
FontAwesome Pro and xamarin.ios only one font can be active
It was not possible to use 3 Font Awesome fonts at the same time in the Designer, but it works when they are used during runtime via code.

How do I change icons for builtin actions in ckeditor?

How do I change the icons for builtin actions such as subscript, superscript bold and italic?
The documentation say that I have to place the icons in the images folder in my skin, but how do I know what the image should be called?
Also, ckeditor compiles the default images into one huge file, so do I need to rebuild that icon file(how?) after placing an icon.
I am using Ckeditor 4.
All skin icons must be included inside the icons folder in the skin folder. The icons file name must match the name of the icon files available in the icons folder of the plugins.
If you want the source version of your skin to overload icons properly, you must inform CKEditor about the presence of your custom icons. This is optional, but if not done your icons will be visible in the release version of your skin only. Check the skin.js file in the Moono skin for an example.
Try clearing the cache as well.
I've just downloaded CKEditor v4.5.7 basic edition and there is a "plugins" folder by default.
Are you sure about the version used ?
After edit :
Icons are defined in the file skins/moono/editor.css and for example for Bold look after class .cke_button__bold_icon - erverything can be changed there.
In order not to edit standard files, I suggest you to create a new skin : duplicate moono folder and rename as you like and in your config.js add
config.skin = 'skin-name';

How to use custom fonts in a mac application?

I try to use custom fonts in my swift app, but they don't load.
I copy the fonts.ttf in my resources folder, and I added the names in Info.plist under "Fonts provided by application " key.
I've try with "Application fonts resource path" key from .plist , but no results.
Here is the code I used to apply my font. I've try with : "MyFont.ttf" , and "MyFont"
#IBOutlet weak var label:NSTextField!
override func awakeFromNib() {
label.font = NSFont(name: "MyFont.ttf", size: 15)
}
As "Application fonts resource path" is now a string type in XCode 7.3.1 and I couldn't seem to find a way to use an Array for multiple fonts, I used "." in the Info.plist:
Application fonts resource path String .
and this seemed to work to pick up all my custom fonts in a Resources folder dynamically e.g. using Swift
labelText.font = NSFont(name: "DS-Digital", size: 48)
However, to see it in XCode design mode (to choose a font from drop-down menu), I needed to first add the font to Font Book.
However, Font Book was not required for the dynamic method to work :)
ATSApplicationFontsPath is for macOS:
ATSApplicationFontsPath (String - macOS) identifies the location of a
font file or directory of fonts in the bundle’s Resources directory.
If present, macOS activates the fonts at the specified path for use by
the bundled app. The fonts are activated only for the bundled app and
not for the system as a whole. The path itself should be specified as
a relative directory of the bundle’s Resources directory. For example,
if a directory of fonts was at the path
/Applications/MyApp.app/Contents/Resources/Stuff/MyFonts/, you should
specify the string Stuff/MyFonts/ for the value of this key.
macOS app Instructions:
Select your Xcode project in the project navigator
Select your
app target
Click the + button and to add a New Copy Files Phase
Select Resources for the destination
Under subpath specify the directory (e.g. Fonts) where your embedded fonts will be copied to within your application bundle's Resources directory.
Drag and drop the font files into the file list of the Copy Files build phase.
UIAppFonts is for iOS:
UIAppFonts (Array - iOS) Specifies any app-provided fonts that should
be made available through the normal mechanisms. Each item in the
array is a string containing the name of a font file (including
filename extension) that is located in the app’s bundle. The system
loads the specified fonts and makes them available for use by the app
when that app is run.
This key is supported in iOS 3.2 and later.
By directly setting the Application fonts resource path as my font file's name, I solved this problem by sheer luck.
For those whose font family is called something like My-Custom-Font-Family:
be aware that in code you should instantiate your custom font like this: NSFont(name: "MyCustomFontFamily-Bold", size: 20)
Spaces and "-" are ignored and font type is written after "-". I did not see this in any docs and spend a few hours trying to figure out wtf was wrong.
Also if you want to get list of all available fonts you can use this code
for font in NSFontManager.shared.availableFonts {
print(font)
}
First add the desired font you want to embed to your OSX app to your project:
Then click project > Info, then click the plus sign and add a new key "Application fonts resource path" and type the name of your fonts there creating an array of strings:
Now you can select custom font and the name of the font will show there, you still need to use the Font Book to make it available inside Xcode.
Try doing this from the interface builder, in the attributes inspector .

Inconsolata font on Android Studio

I want to use Inconsolata font on a intelliJ editor (Android Studio) on Windows but it looks messy.
I managed to load inconsolata by adding some antialiasing options on studio.exe.vmoptions. I just added these options
-Dawt.useSystemAAFontSettings=on
-Dswing.aatext=true
-Dsun.java2d.xrender=true
and now the font loads but it looks too much crappy to use. Actually any font on this ide looks crappy. Here's a screenshot of the same font on SublimeText right and on Android Studio left
Anyone knows if you can use this font on intelliJ based editors or if there are some issues associated with this font?
We can simply use google fonts It's very easy to implements. only you have to follow these steps.
step 1) Open layout.xml of your project and the select font family of text view in attributes (for reference screen shot is attached)
step 2) The in font family select More fonts.. option if your font is not there. then you will see a new window will open, there you can type your required font & select the desired font from that list i.e) Regular, Bold, Italic etc.. as shown in below image.
step 3) Then you will observe a font folder will be auto generated in /res folder having your selected fonts xml file
Then you can directly use this font family in xml as
android:fontFamily="#font/inconsolata"

Resources