Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
CAMP
campvis-public
Commits
40e26d0b
Commit
40e26d0b
authored
Dec 20, 2014
by
Declara Denis
Committed by
Christian Schulte zu Berge
Feb 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FontAtlas: Added code for handling newlines
parent
e0ae041b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
modules/fontrendering/tools/fontatlas.cpp
modules/fontrendering/tools/fontatlas.cpp
+7
-0
modules/fontrendering/tools/fontatlas.h
modules/fontrendering/tools/fontatlas.h
+1
-0
No files found.
modules/fontrendering/tools/fontatlas.cpp
View file @
40e26d0b
...
...
@@ -44,6 +44,7 @@ namespace campvis {
,
_ftFace
(
nullptr
)
,
_texture
(
nullptr
)
,
_shader
(
nullptr
)
,
_height
(
height
)
{
// Initialize the FreeType2 library
if
(
FT_Init_FreeType
(
&
_ftLibrary
))
{
...
...
@@ -154,6 +155,12 @@ namespace campvis {
// Loop through all characters
for
(
size_t
i
=
0
;
i
<
text
.
length
();
++
i
)
{
unsigned
char
p
=
text
[
i
];
// Hanlde "\n"
if
(
p
==
10
)
{
pos
=
cgt
::
vec2
(
position
.
x
,
pos
.
y
-
_height
*
1.2
f
);
}
if
(
p
>=
32
&&
p
<
256
)
{
cgt
::
vec2
pos2
(
pos
.
x
+
_glyphs
[
p
].
bitmapOffset
.
x
,
-
pos
.
y
-
_glyphs
[
p
].
bitmapOffset
.
y
);
cgt
::
vec2
size
=
_glyphs
[
p
].
bitmapSize
;
...
...
modules/fontrendering/tools/fontatlas.h
View file @
40e26d0b
...
...
@@ -107,6 +107,7 @@ namespace fontrendering {
FT_Face
_ftFace
;
///< Pointer to the font face
cgt
::
Texture
*
_texture
;
///< OpenGL texture storing the texture atlas
cgt
::
Shader
*
_shader
;
///< Shader used for font rendering
int
_height
;
static
const
int
MAX_TEXTURE_WIDTH
;
static
const
std
::
string
loggerCat_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment