외부 TTF Fonts 사용하기



Resources > fonts 폴더에 ttf 파일 추가



ios > Icons > Info.plist

Fonts provided by application 에 fonts/폰트파일명 추가하기 


c++)

내장폰트 쓰는 방법과 똑같이 createWithSystemFont() 함수 사용

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "test79.hpp"
 
USING_NS_CC;
 
Scene* Test79::createScene()
{
    auto scene = Scene::create();
    
    auto layer = Test79::create();
    scene->addChild(layer);
    
    return scene;
}
 
 
bool Test79::init()
{
    if ( !Layer::init())
    {
        return false;
    }
    
    
    //createWithSystemFont(글자,폰트,폰트크기,라벨크기,가로정렬,세로정렬)
    //내장 폰트 쓰는 법과 같다
    auto label = Label::createWithSystemFont("Hello World, Fonts : TTF""A Damn Mess"24, Size(200150), TextHAlignment::CENTER, TextVAlignment::CENTER);
    
 
    label->setPosition(Point(100100));
    this->addChild(label);
 
 
    return true;
}
cs



결과



+ Recent posts