openFrameworks 로 작성하는 프로그램에서 한글 폰트 설정 및 출력하기
아래 예제는 ofTrueTypeFont
클래스를 사용하여 폰트를 로드하고 한글 문자열을 출력하는 방법을 보여준다.
ofApp.h
#pragma once
#include "ofMain.h"
#include "ofxDatGui.h"
class ofApp : public ofBaseApp
{
public:
void setup();
void update();
void draw();
private:
ofTrueTypeFont font1;
};
ofApp.cpp
#include "ofApp.h"
void ofApp::setup()
{
...
ofTrueTypeFontSettings settings(ofxDatGuiTheme::AssetPath + "ofxbraitsch/fonts/godoMaum.ttf", 64);
settings.addRanges(ofAlphabet::Korean);
settings.addRanges(ofAlphabet::Latin);
font1.load(settings);
}
void ofApp::draw()
{
...
ofSetColor(ofColor::greenYellow);
font1.drawString(string("안녕하세요.\nhttps://makersweb.net"), 100, 100);
}
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
15 | C++를 위한 Lottie 라이브러리 with SDL2 | makersweb | 2021.08.15 | 979 |
14 | NAppGUI, C언어용 크로스 플랫폼 GUI 라이브러리 | makersweb | 2022.10.10 | 900 |
13 | Protocol Buffers 를 이용한 직렬화 with Conan Package Manager | makersweb | 2021.02.24 | 881 |
12 | ZeroMQ 를 이용한 Qt 응용프로그램 간 통신 | makersweb | 2021.08.28 | 874 |
11 | VSCode 와 Qbs 플러그인으로 C/C++ 개발환경 구성 | makersweb | 2021.09.12 | 874 |
10 | 윈도우에서 안드로이드 flutter 프로그래밍 개발환경 구축(with Visual Studio Code) | makersweb | 2020.09.16 | 808 |
9 | Chromium과 Ozone 층 | makersweb | 2022.03.03 | 754 |
8 | Windows에서 Qt Creator + CMake + vcpkg 로 C++ 개발환경 구성 (POCO 라이브러리 DirectoryWatcher 예제) | makersweb | 2023.01.14 | 724 |
7 | 라즈베리파이에서 Redis의 Pub/Sub 패턴을 사용하는 Electron 응용프로그램 | makersweb | 2021.01.31 | 691 |
6 | 라즈베리파이4에서 openFrameworks 예제 실행 | makersweb | 2020.12.13 | 564 |
5 | CopperSpice 에 대해서 (C++ Gui 라이브러리) | makersweb | 2022.01.02 | 552 |
4 | OTA 오픈소스 프로젝트 | makersweb | 2022.08.03 | 501 |
3 | 도커(docker)설치 및 기본 명령어 | makersweb | 2019.12.02 | 487 |
2 | Flutter 위젯의 상태관리에 대해서 | makersweb | 2023.04.06 | 468 |
» | openFrameworks 한글 폰트 설정 및 출력하기 | makersweb | 2023.02.19 | 226 |