Skip to content

Commit 1acd41a

Browse files
committed
Add noto font to render mandarin characters
Signed-off-by: Ben Chamberland <becha9260@gmail.com>
1 parent a9c735d commit 1acd41a

File tree

5 files changed

+660057
-4
lines changed

5 files changed

+660057
-4
lines changed

src/lib/ui/TwkGLText/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SET(_target
1111
)
1212

1313
SET(_sources
14-
GLT.cpp TwkGLText.cpp defaultFont.cpp
14+
GLT.cpp TwkGLText.cpp defaultFont.cpp noto.cpp
1515
)
1616

1717
FIND_PACKAGE(OpenGL REQUIRED)

src/lib/ui/TwkGLText/GLT.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//******************************************************************************
77
#include <TwkGLText/TwkGLText.h>
88
#include <TwkGLText/defaultFont.h>
9+
#include <TwkGLText/noto.h>
910
#include <TwkGLText/GLT.h>
1011
#include <FTGL/ftgl.h>
1112
#include <TwkExc/TwkExcException.h>
@@ -41,7 +42,7 @@ void gltFace(const std::string& fontName, size_t fontSize)
4142

4243
if (!face)
4344
{
44-
face = new GLTFace(default_font, 67548);
45+
face = new GLTFace(notoFont, notoFontSize);
4546
face->FaceSize(fontSize);
4647
cache[d] = face;
4748
}

src/lib/ui/TwkGLText/TwkGLText.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <iostream>
3333
#include <stl_ext/string_algo.h>
3434
#include <TwkGLText/defaultFont.h>
35+
#include <TwkGLText/noto.h>
3536
#include <iterator>
3637
#include <pthread.h>
3738

@@ -147,7 +148,7 @@ Context GLtext::newContext()
147148
}
148149

149150
if ((*ctx->fonts[ctx->fontName]).size() <= ctx->size) (*ctx->fonts[ctx->fontName]).resize(ctx->size+1);
150-
if (!(*ctx->fonts[ctx->fontName])[ctx->size]) (*ctx->fonts[ctx->fontName])[ctx->size] = newFont(default_font, 67548);
151+
if (!(*ctx->fonts[ctx->fontName])[ctx->size]) (*ctx->fonts[ctx->fontName])[ctx->size] = newFont(notoFont, notoFontSize);
151152
(*ctx->fonts[ctx->fontName])[ctx->size]->FaceSize(ctx->size);
152153
ctx->initialized = true;
153154

@@ -194,7 +195,7 @@ void GLtext::init()
194195
(*ctx->fonts[ctx->fontName]).resize(ctx->size+1);
195196
}
196197
if (!(*ctx->fonts[ctx->fontName])[ctx->size]) {
197-
(*ctx->fonts[ctx->fontName])[ctx->size] = newFont(default_font, 67548);
198+
(*ctx->fonts[ctx->fontName])[ctx->size] = newFont(notoFont, notoFontSize);
198199
(*ctx->fonts[ctx->fontName])[ctx->size]->FaceSize(ctx->size);
199200
}
200201
ctx->initialized = true;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//******************************************************************************
2+
// Copyright (c) 2024 Autodesk Inc. All rights reserved.
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
//
6+
//******************************************************************************
7+
8+
#ifndef __NOTO_H__
9+
#define __NOTO_H__
10+
11+
extern const unsigned char notoFont[];
12+
const unsigned int notoFontSize = 10560380;
13+
14+
#endif // End #ifdef __NOTO_H__

0 commit comments

Comments
 (0)