[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 1819920 1/5: [ftinspect] Display glyph index.
From: |
Werner LEMBERG |
Subject: |
[freetype2-demos] master 1819920 1/5: [ftinspect] Display glyph index. |
Date: |
Thu, 12 May 2016 10:05:37 +0000 (UTC) |
branch: master
commit 1819920498d6e7263a19077b33f8aafa01704506
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[ftinspect] Display glyph index.
* src/ftinspect.cpp (MainGUI::createLayout): Add `infoLeftLayout'
and `infoRightLayout' at the top of the window; add
`glyphIndexLabel' to the right.
(MainGUI::adjustGlyphIndex): Set text for `glyphIndexLabel'
(MainGUI::setDefaults): Call `adjustGlyphIndex'.
* src/ftinspect.h: Updated.
---
ChangeLog | 12 ++++++++++++
src/ftinspect.cpp | 29 ++++++++++++++++++++++-------
src/ftinspect.h | 3 +++
3 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2d59e64..1bc86f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2016-05-11 Werner Lemberg <address@hidden>
+ [ftinspect] Display glyph index.
+
+ * src/ftinspect.cpp (MainGUI::createLayout): Add `infoLeftLayout'
+ and `infoRightLayout' at the top of the window; add
+ `glyphIndexLabel' to the right.
+ (MainGUI::adjustGlyphIndex): Set text for `glyphIndexLabel'
+ (MainGUI::setDefaults): Call `adjustGlyphIndex'.
+
+ * src/ftinspect.h: Updated.
+
+2016-05-11 Werner Lemberg <address@hidden>
+
[ftinspect] Only use integer values for size if units are px.
* src/ftinspect.cpp (MainGUI::checkUnits): Implement it.
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index 8727778..d942a07 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -1576,14 +1576,19 @@ void
MainGUI::adjustGlyphIndex(int delta)
{
// don't adjust current glyph index if we have an invalid font
- if (currentFaceIndex < 0 || currentNumGlyphs < 0)
- return;
+ if (currentFaceIndex >= 0 && currentNumGlyphs >= 0)
+ {
+ currentGlyphIndex += delta;
+ if (currentGlyphIndex < 0)
+ currentGlyphIndex = 0;
+ else if (currentGlyphIndex >= currentNumGlyphs)
+ currentGlyphIndex = currentNumGlyphs - 1;
+ }
- currentGlyphIndex += delta;
- if (currentGlyphIndex < 0)
- currentGlyphIndex = 0;
- else if (currentGlyphIndex >= currentNumGlyphs)
- currentGlyphIndex = currentNumGlyphs - 1;
+ QString upperHex = QString::number(currentGlyphIndex, 16).toUpper();
+ glyphIndexLabel->setText(tr("Glyph Index %1 (0x%2)")
+ .arg(currentGlyphIndex)
+ .arg(upperHex));
drawGlyph();
}
@@ -1918,6 +1923,8 @@ void
MainGUI::createLayout()
{
// left side
+ infoLeftLayout = new QHBoxLayout;
+
hintingCheckBox = new QCheckBox(tr("Hinting"));
hintingModeLabel = new QLabel(tr("Hinting Mode"));
@@ -2074,6 +2081,7 @@ MainGUI::createLayout()
tabWidget->addTab(mmgxTabWidget, tr("MM/GX"));
leftLayout = new QVBoxLayout;
+ leftLayout->addLayout(infoLeftLayout);
leftLayout->addWidget(tabWidget);
// we don't want to expand the left side horizontally;
@@ -2089,6 +2097,11 @@ MainGUI::createLayout()
leftWidget->setSizePolicy(leftWidgetPolicy);
// right side
+ glyphIndexLabel = new QLabel;
+
+ infoRightLayout = new QHBoxLayout;
+ infoRightLayout->addWidget(glyphIndexLabel);
+
glyphScene = new QGraphicsScene;
glyphScene->addItem(new Grid(gridPen, axisPen));
@@ -2192,6 +2205,7 @@ MainGUI::createLayout()
fontLayout->setColumnStretch(6, 2);
rightLayout = new QVBoxLayout;
+ rightLayout->addLayout(infoRightLayout);
rightLayout->addWidget(glyphView);
rightLayout->addLayout(navigationLayout);
rightLayout->addSpacing(10); // XXX px
@@ -2437,6 +2451,7 @@ MainGUI::setDefaults()
checkCurrentFontIndex();
checkCurrentFaceIndex();
checkCurrentInstanceIndex();
+ adjustGlyphIndex(0);
zoom();
}
diff --git a/src/ftinspect.h b/src/ftinspect.h
index 7a453cd..a7c6786 100644
--- a/src/ftinspect.h
+++ b/src/ftinspect.h
@@ -412,6 +412,8 @@ private:
QHBoxLayout *gammaLayout;
QHBoxLayout *hintingModeLayout;
QHBoxLayout *horizontalHintingLayout;
+ QHBoxLayout *infoLeftLayout;
+ QHBoxLayout *infoRightLayout;
QHBoxLayout *lcdFilterLayout;
QHBoxLayout *navigationLayout;
QHBoxLayout *pointNumbersLayout;
@@ -423,6 +425,7 @@ private:
QLabel *antiAliasingLabel;
QLabel *dpiLabel;
QLabel *gammaLabel;
+ QLabel *glyphIndexLabel;
QLabel *hintingModeLabel;
QLabel *lcdFilterLabel;
QLabel *sizeLabel;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 1819920 1/5: [ftinspect] Display glyph index.,
Werner LEMBERG <=