Home » Source Code » cocos2dx+socket » Cocos2dxTypefaces.java

Cocos2dxTypefaces.java ( File view )

  • By 云飞 2013-10-30
  • View(s):166
  • Download(s):5
  • Point(s): 2
			/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org

http://www.cocos2d-x.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
package org.cocos2dx.lib;

import java.util.Hashtable;

import android.content.Context;
import android.graphics.Typeface;

public class Cocos2dxTypefaces {

	private static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>();
	
	public static Typeface get(Context context, String name){

		synchronized(cache){

			if (! cache.containsKey(name)){

				Typeface t = Typeface.createFromAsset(context.getAssets(), name);
				cache.put(name, t);
			
}
			
			return cache.get(name);
		
}
	
}

}
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 2

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
ChatClient.cpp513.00 B14-01-12 18:00
ChatClient.vcproj4.58 kB12-01-12 15:43
ChatClient.vcproj.PCoS-20111206OT.Administrator.user1.39 kB14-01-12 18:40
ODSocket.cpp3.69 kB12-01-12 16:37
ODSocket.h1.61 kB12-01-12 13:43
ReadMe.txt1.29 kB10-01-12 16:26
stdafx.cpp297.00 B10-01-12 16:26
stdafx.h320.00 B10-01-12 16:26
targetver.h765.00 B10-01-12 16:26
ChatClient.sln896.00 B10-01-12 16:26
ChatClient.suo14.00 kB14-01-12 18:40
Android.mk880.00 B12-01-12 17:39
readme.doc170.00 kB14-01-12 18:40
HelloWorld.mkb291.00 B01-12-11 18:36
Main.cpp250.00 B01-12-11 18:36
Main.h42.00 B01-12-11 18:36
AndroidManifest.xml1.13 kB01-12-11 18:36
build_native.sh605.00 B01-12-11 18:36
default.properties364.00 B01-12-11 18:36
R.java867.00 B01-12-11 18:36
Android.mk303.00 B01-12-11 18:36
Application.mk148.00 B01-12-11 18:36
Android.mk534.00 B01-12-11 18:36
main.cpp993.00 B01-12-11 18:36
list.sh362.00 B01-12-11 18:36
icon.png7.17 kB01-12-11 18:36
icon.png2.24 kB01-12-11 18:36
icon.png4.00 kB01-12-11 18:36
game_demo.xml578.00 B01-12-11 18:36
helloworld_demo.xml595.00 B01-12-11 18:36
strings.xml112.00 B01-12-11 18:36
ApplicationDemo.java2.37 kB01-12-11 18:36
Cocos2dxAccelerometer.java3.17 kB01-12-11 18:36
Cocos2dxActivity.java7.47 kB01-12-11 18:36
Cocos2dxBitmap.java11.16 kB01-12-11 18:36
Cocos2dxGLSurfaceView.java13.50 kB01-12-11 18:36
Cocos2dxMusic.java6.06 kB01-12-11 18:36
Cocos2dxRenderer.java4.70 kB01-12-11 18:36
Cocos2dxSound.java7.63 kB01-12-11 18:36
Cocos2dxTypefaces.java1.71 kB01-12-11 18:36
.badaprj171.00 B01-12-11 18:36
.cproject77.53 kB01-12-11 18:36
.project2.91 kB01-12-11 18:36
application.xml622.00 B01-12-11 18:36
MainMenu.png15.87 kB01-12-11 18:36
Splash.png84.47 kB01-12-11 18:36
manifest.xml871.00 B01-12-11 18:36
.badaprj260.00 B01-12-11 18:36
.cproject75.58 kB01-12-11 18:36
.project3.06 kB01-12-11 18:36
application.xml866.00 B01-12-11 18:36
Splash_type2.png29.58 kB01-12-11 18:36
Splash_type3.png34.29 kB01-12-11 18:36
Splash_type4.png84.47 kB01-12-11 18:36
test_type2.png8.00 kB01-12-11 18:36
test_type3.png8.00 kB01-12-11 18:36
test_type4.png12.04 kB01-12-11 18:36
manifest.xml779.00 B01-12-11 18:36
HelloWorldEntry.cpp1.23 kB01-12-11 18:36
Android.mk760.00 B01-12-11 18:36
AppDelegate.cpp4.05 kB23-12-11 11:12
AppDelegate.h1.09 kB01-12-11 18:36
HelloWorldScene.cpp4.26 kB14-01-12 18:18
HelloWorldScene.h899.00 B07-01-12 18:56
ODSocket.cpp3.69 kB12-01-12 17:11
ODSocket.h1.63 kB12-01-12 18:58
sdBall.cpp2.14 kB10-01-12 18:09
sdBall.h571.00 B22-12-11 19:54
sdDangBan.cpp2.51 kB14-01-12 18:05
sdDangBan.h725.00 B22-12-11 19:54
AppController.h1.45 kB01-12-11 18:36
AppController.mm4.93 kB01-12-11 18:36
HelloWorld-Info.plist963.00 B01-12-11 18:36
project.pbxproj132.52 kB01-12-11 18:36
HelloWorld_Prefix.pch189.00 B01-12-11 18:36
main.m368.00 B01-12-11 18:36
RootViewController.h1.36 kB01-12-11 18:36
RootViewController.mm2.61 kB01-12-11 18:36
project.pbxproj137.45 kB01-12-11 18:36
.cproject141.13 kB01-12-11 18:36
.project2.77 kB01-12-11 18:36
main.cpp213.00 B01-12-11 18:36
main.h114.00 B01-12-11 18:36
Makefile977.00 B01-12-11 18:36
postCompiled.sh804.00 B01-12-11 18:36
app.config.txt90.00 B01-12-11 18:36
app.icf139.00 B01-12-11 18:36
background.png477.73 kB22-12-11 19:30
Ball.png3.35 kB21-12-11 14:14
CloseNormal.png5.12 kB01-12-11 18:36
CloseSelected.png6.02 kB01-12-11 18:36
DangBan.png9.23 kB21-12-11 15:15
HelloWorld.png27.88 kB21-12-11 16:38
Icon.png9.11 kB01-12-11 18:36
HelloWorld.win32.vcproj5.21 kB12-01-12 17:16
HelloWorld.win32.vcproj.PCoS-20111206OT.Administrator.user1.44 kB14-01-12 18:17
HelloWorld.win32.vcproj.user487.00 B01-12-11 18:36
HelloWorld.win32.vcxproj7.01 kB01-12-11 18:36
HelloWorld.win32.vcxproj.filters1.18 kB01-12-11 18:36
HelloWorld.win32.vcxproj.user764.00 B01-12-11 18:36
main.cpp408.00 B01-12-11 18:36
main.h277.00 B01-12-11 18:36
HelloWorld.TMK33.03 kB01-12-11 18:36
HelloWorld.wophone.vcproj6.34 kB01-12-11 18:36
HelloWorld.wophone.vcproj.user1.40 kB01-12-11 18:36
HelloWorldUnicodeScript.h250.00 B01-12-11 18:36
HelloWorldUnicodeScript_str.h604.00 B01-12-11 18:36
main.cpp389.00 B01-12-11 18:36
Makefile.ARM2.07 kB01-12-11 18:36
NewDeleteOp.cpp2.05 kB01-12-11 18:36
HelloWorld.upiproj40.80 kB01-12-11 18:36
install.xml380.00 B01-12-11 18:36
TG3AppDllEntry.cpp5.27 kB01-12-11 18:36
TG3AppDllEntry.h1.39 kB01-12-11 18:36
ODSocket.cpp3.69 kB12-01-12 16:37
ODSocket.h1.61 kB12-01-12 13:43
ReadMe.txt1.27 kB10-01-12 16:34
Server.cpp701.00 B14-01-12 18:00
Server.vcproj4.53 kB12-01-12 16:24
Server.vcproj.PCoS-20111206OT.Administrator.user1.39 kB14-01-12 18:40
stdafx.cpp293.00 B10-01-12 16:34
stdafx.h320.00 B10-01-12 16:34
targetver.h765.00 B10-01-12 16:34
Server.sln884.00 B10-01-12 16:35
Server.suo18.00 kB14-01-12 18:40
<application>0.00 B14-01-12 18:39
<application>0.00 B14-01-12 18:39
<lib>0.00 B14-01-12 18:39
<cocos2dx>0.00 B14-01-12 18:39
<cocos2dx>0.00 B14-01-12 18:39
<org>0.00 B14-01-12 18:39
<helloworld>0.00 B14-01-12 18:39
<drawable-hdpi>0.00 B14-01-12 18:39
<drawable-ldpi>0.00 B14-01-12 18:39
<drawable-mdpi>0.00 B14-01-12 18:39
<layout>0.00 B14-01-12 18:39
<values>0.00 B14-01-12 18:39
<org>0.00 B14-01-12 18:39
<Icons>0.00 B14-01-12 18:39
<Icons>0.00 B14-01-12 18:39
<gen>0.00 B14-01-12 18:39
<jni>0.00 B14-01-12 18:39
<res>0.00 B14-01-12 18:39
<src>0.00 B14-01-12 18:39
<sdk1.0>0.00 B14-01-12 18:39
<sdk2.0>0.00 B14-01-12 18:39
<src>0.00 B14-01-12 18:39
<HelloWorld.xcodeproj>0.00 B14-01-12 18:39
<HelloWorld.xcodeproj>0.00 B14-01-12 18:39
<pak>0.00 B14-01-12 18:39
<ChatClient>0.00 B14-01-12 18:41
<airplay>0.00 B14-01-12 18:39
<android>0.00 B14-01-12 18:39
<bada>0.00 B14-01-12 18:39
<Classes>0.00 B14-01-12 18:39
<ios>0.00 B14-01-12 18:39
<iphone>0.00 B14-01-12 18:39
<Linux>0.00 B14-01-12 18:39
<Resource>0.00 B14-01-12 18:39
<win32>0.00 B14-01-12 18:42
<wophone>0.00 B14-01-12 18:39
<Server>0.00 B14-01-12 18:41
<PCClient>0.00 B14-01-12 18:41
<HelloWorld>0.00 B14-01-12 18:39
<PCServer>0.00 B14-01-12 18:41
...
Sponsored links

Cocos2dxTypefaces.java (1.05 MB)

Need 2 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D