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.3k
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
Base64 in Android
keithyokoma
0
43
One screen, many BottomSheets
keithyokoma
0
440
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
720
Build apps for Cars
keithyokoma
0
570
Save the state
keithyokoma
0
600
Either in Kotlin
keithyokoma
0
620
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
5.5k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
5.3k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
570
Other Decks in Technology
See All in Technology
OSC仙台プレ勉強会 AlmaLinuxとは
koedoyoshida
0
170
The_Evolution_of_Bits_AI_SRE.pdf
nulabinc
PRO
0
210
Go標準パッケージのI/O処理をながめる
matumoto
0
210
AIエージェント時代に備える AWS Organizations とアカウント設計
kossykinto
3
980
[E2]CCoEはAI指揮官へ。Bedrock×MCPで構築するコスト・セキュリティ自律運用基盤
taku1418
0
160
OCI Security サービス 概要
oracle4engineer
PRO
2
13k
クラウド × シリコンの Mashup - AWS チップ開発で広がる AI 基盤の選択肢
htokoyo
2
250
Yahoo!ショッピングのレコメンデーション・システムにおけるML実践の一例
lycorptech_jp
PRO
1
210
20260311 ビジネスSWG活動報告(デジタルアイデンティティ人材育成推進WG Ph2 活動報告会)
oidfj
0
330
Postman v12 で変わる API開発ワークフロー (Postman v12 アップデート) / New API development workflow with Postman v12
yokawasa
0
120
情シスのための生成AI実践ガイド2026 / Generative AI Practical Guide for Business Technology 2026
glidenote
0
250
VLAモデル構築のための AIロボット向け模倣学習キット
kmatsuiugo
0
130
Featured
See All Featured
Designing for Performance
lara
611
70k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Thoughts on Productivity
jonyablonski
75
5.1k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
390
Paper Plane (Part 1)
katiecoart
PRO
0
5.6k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Abbi's Birthday
coloredviolet
2
5.4k
The Pragmatic Product Professional
lauravandoore
37
7.2k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
84
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
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