Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Typeface
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Keishin Yokomaku
September 24, 2014
Technology
1.3k
0
Share
Typeface
Android library for easy use of typeface.
Keishin Yokomaku
September 24, 2014
More Decks by Keishin Yokomaku
See All by Keishin Yokomaku
Base64 in Android
keithyokoma
0
51
One screen, many BottomSheets
keithyokoma
0
450
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
740
Build apps for Cars
keithyokoma
0
580
Save the state
keithyokoma
0
620
Either in Kotlin
keithyokoma
0
640
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
5.6k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
5.3k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
580
Other Decks in Technology
See All in Technology
freee-mcpを Local→Remote で出してわかった MCP認可実装のリアル
terara
1
130
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.6k
なぜ、IAMロールのプリンシパルに*による部分マッチングが使えないのか? / 20260518-ssmjp-iam-role-principal
opelab
2
140
生成AI時代に信頼性をどう保ち続けるか - Policy as Code の実践
akitok_
1
530
パーソルキャリア IT/テクノロジー職向け 会社紹介資料|Company Introduction Deck
techtekt
PRO
0
250
LookerとADKで作る社内AIエージェント
chanyou0311
0
280
DI コンテナ自動生成ツールを実装してみた / intro-autodi
uhzz
0
720
Claude Code で使える DuckDB Skills を試してみた / DuckDB Skills and Claude Code
masahirokawahara
1
1.9k
TSKaigi 2026 - 型プラグインシステムの実装に使われるテクニック
teamlab
PRO
1
120
AI時代に求められる思考のパラダイムシフト
nrinetcom
PRO
0
110
マンション備え付けのネットワークとLTE回線を組み合わせた ネットワークの安定化の考案
harutiro
1
140
TypeScript の型で副作用の実行順序を制御する
yanaemon
1
120
Featured
See All Featured
Joys of Absence: A Defence of Solitary Play
codingconduct
1
360
Designing for Timeless Needs
cassininazir
1
220
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.5k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
140
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
150
Are puppies a ranking factor?
jonoalderson
1
3.4k
AI: The stuff that nobody shows you
jnunemaker
PRO
7
640
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
180
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
250
Transcript
Typeface @KeithYokoma - Drivemode, Inc. potatotips #9
About myself • KeithYokoma • Keishin Yokomaku • Drivemode, Inc.
• GitHub: https://github.com/KeithYokoma • e-Book: http://amzn.to/1mZNydv
Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface
Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface Typeface
http://bit.ly/1rjOdtN
Typeface • Cool • Nice • Beautiful • Android provides
Roboto by default
Typeface • If you would like to change the typeface…
TextView#setTypeface(Typeface) Paint#setTypeface(Typeface) Button#setTypeface(Typeface) EditText#setTypeface(Typeface)
Typeface • Read Typeface from your assets Typeface.createFromAsset(AssetManager, String)
Typeface • Read Typeface from your assets ! • Caution!
Typeface.createFromAsset(AssetManager, String) Typeface.createFromAsset leaks asset stream! http://bit.ly/1rVOkir
Typeface • Workaround: cache private final Hashtable<String, Typeface> mCache =
new Hashtable<String, Typeface>();! private final Application mApplication;! ! public synchronized Typeface get(String name) {! ! Typeface typeface = mCache.get(name);! ! if(typeface == null) {! ! ! try {! ! ! ! typeface = Typeface.createFromAsset(mApplication.getAssets(), name);! ! ! } catch (Exception exp) {! ! ! ! return null;! ! ! }! ! ! mCache.put(name, typeface);! ! }! ! return typeface;! }
Typeface • If you would like to change the typeface
for ActionBar title Dialog button texts Dialog message text ActionBar tab text All text views in the view group blah blah blah…
Typeface • Got it, we introduce you our library! TypefaceHelper
- http://bit.ly/1AxfqLz
Typeface • First, initialize the object in your Application. public
class SampleApp extends Application {! ! @Override! ! public void onCreate() {! ! ! super.onCreate();! ! ! TypefaceHelper.initialize(this);! ! }! ! ! @Override! ! public void onTerminate() {! ! ! TypefaceHelper.destroy();! ! ! super.onTerminate();! ! }! }
Typeface • Set your Typeface. public class SampleActivity extends Activity
{! ! ! TextView mTextView;! ! ! @Override! ! public void onCreate(Bundle icicle) {! ! ! // …! ! ! TypefaceHelper helper = TypefaceHelper.getInstance();! ! ! helper.setTypeface(this, “MyFont.ttf”);! ! ! helper.setTypeface(mTextView, “Another.ttf”);! ! }! }
Typeface • That's it. Just do it!
Typeface • You can set your Typeface to… • All
views that is a child of TextView. • All TextViews that is belong to ViewGroup. • Activity, Fragment, Dialog. • Canvas(thanks to Nohana team!)
Typeface • Works in progress 1. OptionsMenu 2. Preferences 3.
Set typeface by annotation
Typeface @KeithYokoma - Drivemode, Inc. potatotips #9