Typeface create

Put your problem here if it does not fit any of the other categories.

Typeface create

Postby res » Fri Feb 08, 2008 4:56 pm

Where should we put custom fonts so we can create our own typeface, I would like to do the following

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Typeface typeArial;
  3.  
  4. typeArial = Typeface.create("arial", Typeface.BOLD);
  5.  
  6. paint.setTypeface(typeArial);
  7.  
  8.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


But the font doesn't change. I've tried pushing the font to the emulator as well as placing it it in the drawable and raw folders under res.
res
Senior Developer
Senior Developer
 
Posts: 146
Joined: Tue Nov 20, 2007 8:14 pm
Location: United States

Top

Postby michang05 » Wed Nov 12, 2008 4:22 am

we got the same problem wanted to make my own font for my app
Everybody Lies!
michang05
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Sep 29, 2008 11:15 am
Location: Philippines

Postby rellimcire » Tue Dec 02, 2008 7:59 am

I needed a custom font and looked far and wide how to do it. I finally found the answer.

Put your font in assets/fonts. I use Eclipse and had to create both directories under my project root.

I access from my main activity like this.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/myFont.ttf");
  2.  
  3.         TextView myTextView = (TextView)findViewById(R.id.myTextView);
  4.  
  5.         myTextView.setTypeface(mTypeface);
  6.  
  7.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

There is slightly different sample code here:
C:\android-sdk-windows-1.0_r1\samples\ApiDemos\src\com\example\android\apis\graphics\Typefaces.java
rellimcire
Freshman
Freshman
 
Posts: 2
Joined: Tue Dec 02, 2008 7:49 am
Location: Lancaster, CA

how to load the font to a widget ?

Postby Rotor » Fri Jun 05, 2009 6:49 pm

i cant find a way to load a typeface from a remotevView

is there any other option to load it from the assets
maybe from xml declaration

please help
Rotor
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Jun 05, 2009 6:36 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 19 guests