Fixes for qttxf texture font file creation tool:
- Corrected glyph uv coordinates - Show debug output indicating whether an exact font match was possiblepull/110/head
parent
4ca7da71c1
commit
321eab2717
|
@ -152,6 +152,7 @@ void MainWindow::findSizes(const QFont &font)
|
|||
void
|
||||
MainWindow::updateFont(const QFont& font)
|
||||
{
|
||||
qDebug() << font.family() << " match: " << font.exactMatch();
|
||||
m_currentFont.setFamily(font.family());
|
||||
buildTxf();
|
||||
}
|
||||
|
@ -315,7 +316,7 @@ MainWindow::buildTxf(const QFont& font, QDataStream& out, int texWidth, int texH
|
|||
int ySpacing = 3;
|
||||
|
||||
painter.setFont(devFont);
|
||||
foreach(BasicGlyphInfo info, glyphInfoList)
|
||||
foreach (BasicGlyphInfo info, glyphInfoList)
|
||||
{
|
||||
QRect bounds = fm.boundingRect(info.ch);
|
||||
if (x + bounds.width() >= texWidth)
|
||||
|
@ -348,7 +349,7 @@ MainWindow::buildTxf(const QFont& font, QDataStream& out, int texWidth, int texH
|
|||
out << (qint8) bounds.left() << (qint8) (-bounds.bottom());
|
||||
out << (qint8) fm.width(info.ch);
|
||||
out << (quint8) 0; /* unused */
|
||||
out << (quint16) (x - 1) << (quint16) (texWidth - y - 2);
|
||||
out << (quint16) (x - 1) << (quint16) (texHeight - y - 2);
|
||||
|
||||
x += bounds.width() + xSpacing;
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ class MainWindow : public QMainWindow
|
|||
public:
|
||||
MainWindow();
|
||||
|
||||
void findStyles(const QFont& font);
|
||||
void findSizes(const QFont& font);
|
||||
bool buildTxf();
|
||||
bool buildTxf(const QFont& font, QDataStream& out, int texWidth, int texHeight);
|
||||
|
||||
public slots:
|
||||
void findStyles(const QFont& font);
|
||||
void findSizes(const QFont& font);
|
||||
void updateFont(const QFont& font);
|
||||
void updateSize(const QString& sizeString);
|
||||
void updateStyle(const QString& styleName);
|
||||
|
|
Loading…
Reference in New Issue