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
Keishin Yokomaku
September 24, 2014
Technology
0
1.2k
Typeface
Android library for easy use of typeface.
Keishin Yokomaku
September 24, 2014
Tweet
Share
More Decks by Keishin Yokomaku
See All by Keishin Yokomaku
One screen, many BottomSheets
keithyokoma
0
350
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
600
Build apps for Cars
keithyokoma
0
480
Save the state
keithyokoma
0
530
Either in Kotlin
keithyokoma
0
540
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
5k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
5k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
510
DX Improvements
keithyokoma
3
390
Other Decks in Technology
See All in Technology
LayerXにおけるAI活用事例とその裏側(2025年2月) バクラクの目指す “業務の自動運転” の例 / layerx-ai-deim2025
yuya4
4
930
EMConf JP 2025 懇親会LT / EMConf JP 2025 social gathering
sugamasao
2
210
Log Analytics を使った実際の運用 - Sansan Data Hub での取り組み
sansantech
PRO
0
140
"TEAM"を導入したら最高のエンジニア"Team"を実現できた / Deploying "TEAM" and Building the Best Engineering "Team"
yuj1osm
1
240
アジャイルな開発チームでテスト戦略の話は誰がする? / Who Talks About Test Strategy?
ak1210
1
850
Introduction to OpenSearch Project - Search Engineering Tech Talk 2025 Winter
tkykenmt
2
230
【Forkwell】「正しく」失敗できるチームを作る──現場のリーダーのための恐怖と不安を乗り越える技術 - FL#83 / A team that can fail correctly by forkwell
i35_267
2
120
目標と時間軸 〜ベイビーステップでケイパビリティを高めよう〜
kakehashi
PRO
8
1k
サイト信頼性エンジニアリングとAmazon Web Services / SRE and AWS
ymotongpoo
7
1.9k
困難を「一般解」で解く
fujiwara3
8
2.4k
Amazon Aurora のバージョンアップ手法について
smt7174
2
190
Platform Engineeringで クラウドの「楽しくない」を解消しよう
jacopen
4
220
Featured
See All Featured
Thoughts on Productivity
jonyablonski
69
4.5k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
Six Lessons from altMBA
skipperchong
27
3.6k
A better future with KSS
kneath
238
17k
How STYLIGHT went responsive
nonsquared
99
5.4k
How to train your dragon (web standard)
notwaldorf
91
5.9k
Fireside Chat
paigeccino
35
3.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
BBQ
matthewcrist
87
9.5k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
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