Skip to content

Commit

Permalink
Hide debug messages with macro _DEBUG_DRAW.
Browse files Browse the repository at this point in the history
  • Loading branch information
virxkane committed Apr 27, 2021
1 parent 537396a commit 4290b99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lowlevel_textrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

#include <math.h>

//#define _DEBUG_DRAW

GLowLevelTextRender::GLowLevelTextRender(QWidget *parent)
: QWidget(parent)
{
Expand Down Expand Up @@ -244,13 +246,17 @@ bool GLowLevelTextRender::renderText()
{
#if USE_HARFBUZZ && HARFBUZZ_SHAPING
glyph_index = glyph_info[i].codepoint;
#ifdef _DEBUG_DRAW
qDebug() << "glyph index" << i << ": codepoint = " << QString("U+%1").arg(ucs4_data[glyph_info[i].cluster], 4, 16, QChar('0'));
qDebug() << Qt::dec << "glyph index" << i << ": glyph index =" << glyph_index;
#endif
#else
/* retrieve glyph index from character code */
glyph_index = FT_Get_Char_Index(m_d->m_ft_face, ucs4_data.at(i));
#ifdef _DEBUG_DRAW
qDebug() << "glyph index" << i << ": codepoint = " << QString("U+%1").arg(ucs4_data[i], 4, 16, QChar('0'));
qDebug() << "glyph index" << i << ": glyph index =" << glyph_index;
#endif
#endif

/* load glyph image into the slot (erase previous one) */
Expand Down Expand Up @@ -402,21 +408,25 @@ bool GLowLevelTextRender::renderText()
}
/* increment pen position */
#if USE_HARFBUZZ && HARFBUZZ_SHAPING
#ifdef _DEBUG_DRAW
qDebug() << "glyph index" << i << ": ft_bitmap_left =" << m_d->m_ft_face->glyph->bitmap_left;
qDebug() << "glyph index" << i << ": hb_x_offset =" << (glyph_pos[i].x_offset >> 6);
qDebug() << "glyph index" << i << ": hb_x_advance =" << (glyph_pos[i].x_advance >> 6);
qDebug() << "glyph index" << i << ": hb_y_offset =" << (glyph_pos[i].y_offset >> 6);
qDebug() << "glyph index" << i << ": ft_x_advance=" << (m_d->m_ft_face->glyph->advance.x >> 6);
#endif

pen_x += (glyph_pos[i].x_advance >> 6);
pen_y += (glyph_pos[i].y_advance >> 6);
#else
#ifdef _DEBUG_DRAW
qDebug() << "glyph index" << i << "x_offset=" << (m_d->m_ft_face->glyph->bitmap_left);
qDebug() << "glyph index" << i << "x_advance=" << (m_d->m_ft_face->glyph->advance.x >> 6);
if (m_useKerning)
{
qDebug() << "glyph index" << i << "kerning=" << kerning;
}
#endif

pen_x += m_d->m_ft_face->glyph->advance.x >> 6;
pen_x += kerning;
Expand Down
3 changes: 3 additions & 0 deletions src/lowlevel_textrender_private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ bool GLowLevelTextRenderPrivate::setFontFace(const QString& fileName)
{
// OK
qDebug() << "Font face created OK.";
qDebug() << "family_name: " << m_ft_face->family_name;
qDebug() << "style_flags: " << m_ft_face->style_flags;
qDebug() << "style_name: " << m_ft_face->style_name;
if (FT_HAS_KERNING(m_ft_face))
qDebug() << "Font face have freetype compatible kerning table";
else
Expand Down

0 comments on commit 4290b99

Please sign in to comment.