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
300
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
530
Build apps for Cars
keithyokoma
0
450
Save the state
keithyokoma
0
500
Either in Kotlin
keithyokoma
0
510
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
4.9k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
4.8k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
490
DX Improvements
keithyokoma
3
380
Other Decks in Technology
See All in Technology
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
430
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
170
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
170
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
370
隣接領域をBeyondするFinatextのエンジニア組織設計 / beyond-engineering-areas
stajima
1
270
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
470
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.2k
強いチームと開発生産性
onk
PRO
34
11k
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
180
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Typedesign – Prime Four
hannesfritz
40
2.4k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
A better future with KSS
kneath
238
17k
What's in a price? How to price your products and services
michaelherold
243
12k
Become a Pro
speakerdeck
PRO
25
5k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
BBQ
matthewcrist
85
9.3k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
GraphQLとの向き合い方2022年版
quramy
43
13k
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