LoginSignup
3
3

More than 5 years have passed since last update.

Alloy でカスタムフォントを使う方法

Posted at

app/assets/fonts/ フォルダにカスタムフォントファイルを置き、tiapp.xml にフォントのパスを登録しておく(Info.plist の UIAppFonts キー)。

Titanium の 2.x 系から、tiapp.xml の は deprecated になっていて に直すべきらしい。

例:
/app/assets/fonts/Ricty-Regular.ttf

tiapp.xml
<ti:app xmlns:ti="http://ti.appcelerator.org">
  <...>
  <ios>
    <plist>
      <dict>
        <key>UIAppFonts</key>
        <array>
          <string>fonts/Ricty-Regular.ttf</string>
        </array>
      </dict>
    </plist>
    <orientations device="iphone">
      <orientation>Ti.UI.PORTRAIT</orientation>
    </orientations>
    <orientations device="ipad">
      <orientation>Ti.UI.PORTRAIT</orientation>
      <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
      <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
      <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
    </orientations>
  </ios>
  <android xmlns:android="http://schemas.android.com/apk/res/android"/>
  <...>
  <sdk-version>3.0.0.GA</sdk-version>
  <plugins>
    <plugin version="1.0">ti.alloy</plugin>
  </plugins>
</ti:app>
3
3
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
3
3