Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Noto font so that RV can render Mandarin characters #518

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/ui/TwkGLText/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SET(_target
)

SET(_sources
GLT.cpp TwkGLText.cpp defaultFont.cpp
GLT.cpp TwkGLText.cpp defaultFont.cpp noto.cpp
)

FIND_PACKAGE(OpenGL REQUIRED)
Expand Down
3 changes: 2 additions & 1 deletion src/lib/ui/TwkGLText/GLT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//******************************************************************************
#include <TwkGLText/TwkGLText.h>
#include <TwkGLText/defaultFont.h>
#include <TwkGLText/noto.h>
#include <TwkGLText/GLT.h>
#include <FTGL/ftgl.h>
#include <TwkExc/TwkExcException.h>
Expand Down Expand Up @@ -41,7 +42,7 @@ void gltFace(const std::string& fontName, size_t fontSize)

if (!face)
{
face = new GLTFace(default_font, 67548);
face = new GLTFace(notoFont, notoFontSize);
face->FaceSize(fontSize);
cache[d] = face;
}
Expand Down
5 changes: 3 additions & 2 deletions src/lib/ui/TwkGLText/TwkGLText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <iostream>
#include <stl_ext/string_algo.h>
#include <TwkGLText/defaultFont.h>
#include <TwkGLText/noto.h>
#include <iterator>
#include <pthread.h>

Expand Down Expand Up @@ -147,7 +148,7 @@ Context GLtext::newContext()
}

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

Expand Down Expand Up @@ -194,7 +195,7 @@ void GLtext::init()
(*ctx->fonts[ctx->fontName]).resize(ctx->size+1);
}
if (!(*ctx->fonts[ctx->fontName])[ctx->size]) {
(*ctx->fonts[ctx->fontName])[ctx->size] = newFont(default_font, 67548);
(*ctx->fonts[ctx->fontName])[ctx->size] = newFont(notoFont, notoFontSize);
(*ctx->fonts[ctx->fontName])[ctx->size]->FaceSize(ctx->size);
}
ctx->initialized = true;
Expand Down
7 changes: 2 additions & 5 deletions src/lib/ui/TwkGLText/TwkGLText/courier.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
//
//******************************************************************************

#ifndef __COURIER_H__
#define __COURIER_H__
#pragma once

//
// This font is from /usr/X11R6/lib/X11/fonts/TTF/cour.ttf
//

extern const unsigned char courierFont[];
const unsigned int courierFontSize = 297660;

#endif // End #ifdef __COURIER_H__
const unsigned int courierFontSize = 297660;
13 changes: 13 additions & 0 deletions src/lib/ui/TwkGLText/TwkGLText/noto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//******************************************************************************
// Copyright (c) 2024 Autodesk Inc. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
//******************************************************************************

#pragma once

// Sourced from Noto Sans Simplified: https://fonts.google.com/noto/specimen/Noto+Sans+SC

extern const unsigned char notoFont[];
const unsigned int notoFontSize = 10560380;
7 changes: 2 additions & 5 deletions src/lib/ui/TwkGLText/TwkGLText/tweakFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
//
//******************************************************************************

#ifndef __TWEAKFONT_H__
#define __TWEAKFONT_H__
#pragma once

// Nedian Medium

extern const unsigned char tweakFont[];
const unsigned int tweakFontSize = 62376;

#endif // End #ifdef __TWEAKFONT_H__
const unsigned int tweakFontSize = 62376;
660,037 changes: 660,037 additions & 0 deletions src/lib/ui/TwkGLText/noto.cpp

Large diffs are not rendered by default.