7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

swiftでにゃしぃフォント改二を表示する

Last updated at Posted at 2016-11-16

とあるまとめサイトでにゃしぃフォントの存在を知ったので、それをiOS上に表示する方法を書いて見ました

フォントをダウンロードする

作者様のサイトの手書きフォントから
TrueType(ttf)とOpenType(otf)の二つの拡張子がありますが、XCodeではどちらも対応しているのでどちらでもいいのでダウンロードする

XCodeにインポートする

ダウンロードした zipファイルを解凍し、その中にある otfまたはttfのファイルを作成したプロジェクトにドラックアンドドロップします

image

するとこのような選択肢が出ると思うので、
Copy items if needed と Add to targetにチェックします
これで導入は終わりです

使用方法

storyboard上

textViewなどのテキストを表示するビューの中の Attributes inspectorの中にあるFontの欄の右側にあるTみたいなをクリックすると別ウィンドウが開くので
FontをCustomにするとFamilyが明るくなるので
image

そのFamilyからNyashiを選ぶとできます
適応されます

image

コードで指定

let textView = UITextView()
textView.font = UIFont(name: "Nyashi", size: UIFont.systemFontSize)

とすると指定できます

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?