수업때.. 폰트 적용이 안되서.. 막 구글링 해서 찾았다.

영어 극켬! 하는 나지만.. 프로그래밍 하면서 영어로 how to use ... 류의 검색을 많이했더니.. 이젠 좀 익숙해졌다..

구글링 최고ㅡ!

 

 

How can i add custom fonts in cocos2d-x

To add custom fonts in cocos2d-x i followed the following steps. Download a font. paste it in resource file of my project without any subfolder. Add my font in info.plist in Fonts provided by

stackoverflow.com

 

1) 폰트 파일을 경로에 잘 집어넣는다.

2) 폰트 파일명과 폰트명을 일치시킨다.

 

그러니까 됐다.. .크흡..

 

//컴퓨터에 등록된 폰트 사용할 때 -  폰트 이름 만
    auto label1 = CCLabelTTF::create("SLEEPY PINAEONG", "Courier", 24);
   
//컴퓨터에 등록되지 않은 폰트 파일을 사용할 때
//폰트 이름과 파일명을 일치시키고 경로-확장자 사용
	auto label2 = CCLabelTTF::create("Hello World", "fonts/A Damn Mess.ttf", 24);
	auto label3 = CCLabelTTF::create("abdabcd1234", "fonts/Felt Regular.ttf", 50);

	label1->setPosition(WINSIZEX / 2, 350);
	label2->setPosition(WINSIZEX / 2, 250);
	label3->setPosition(WINSIZEX / 2, 150);

	label2->setColor(ccc3(255, 30, 30));

	this->addChild(label1);
	this->addChild(label2);
	this->addChild(label3);

< 폰트 파일 경로 >

프로젝트 폴더 \Resources\fonts

 

 

< 폰트 이름 확인 >

폰트파일 선택 - 마우스 우클릭 - 속성 - 자세히

 

Posted by 파인애옹
,