[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 31e81a9 6/7: [ftinspect] Minor issues.
From: |
Werner LEMBERG |
Subject: |
[freetype2-demos] master 31e81a9 6/7: [ftinspect] Minor issues. |
Date: |
Mon, 16 May 2016 05:56:44 +0000 (UTC) |
branch: master
commit 31e81a98d2f4a95927ec5b9227f3041ccf4c7eb1
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[ftinspect] Minor issues.
* src/ftinspect.cpp (Engine::loadFont): More readable code.
(MainGUI::showFont): Remove no longer needed argument.
Updated.
(MainGUI::checkCurrentFontIndex, MainGUI::checkCurrentFaceIndex,
MainGUI::checkCurrentNamedInstanceIndex): Minor generalization.
* src/ftinspect.h (MainGUI): Updated.
---
ChangeLog | 12 ++++++++++++
src/ftinspect.cpp | 24 +++++++++---------------
src/ftinspect.h | 2 +-
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dbbb1ad..aa8af8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2016-05-15 Werner Lemberg <address@hidden>
+ [ftinspect] Minor issues.
+
+ * src/ftinspect.cpp (Engine::loadFont): More readable code.
+ (MainGUI::showFont): Remove no longer needed argument.
+ Updated.
+ (MainGUI::checkCurrentFontIndex, MainGUI::checkCurrentFaceIndex,
+ MainGUI::checkCurrentNamedInstanceIndex): Minor generalization.
+
+ * src/ftinspect.h (MainGUI): Updated.
+
+2016-05-15 Werner Lemberg <address@hidden>
+
[ftinspect] Replace face ID hash with a map.
We need this for later changes that will rely on ordered data.
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index 97b87bf..eb39851 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -350,11 +350,12 @@ Engine::loadFont(int fontIndex,
curStyleName = QString(ftSize->face->style_name);
FT_Module module = &ftSize->face->driver->root;
+ const char*moduleName = module->clazz->module_name;
// XXX cover all available modules
- if (!strcmp(module->clazz->module_name, "cff"))
+ if (!strcmp(moduleName, "cff"))
fontType = FontType_CFF;
- else if (!strcmp(module->clazz->module_name, "truetype"))
+ else if (!strcmp(moduleName, "truetype"))
fontType = FontType_TrueType;
return ftSize->face->num_glyphs;
@@ -1255,7 +1256,7 @@ MainGUI::closeFont()
void
-MainGUI::showFont(bool preserveIndices)
+MainGUI::showFont()
{
if (currentFontIndex >= 0)
{
@@ -1277,10 +1278,7 @@ MainGUI::showFont(bool preserveIndices)
for (int i = 0; i < currentNumberOfFaces; i++)
font.numberOfNamedInstancesList.append(-1);
- if (preserveIndices)
- currentFaceIndex = qMin(currentFaceIndex, currentNumberOfFaces - 1);
- else
- currentFaceIndex = 0;
+ currentFaceIndex = 0;
}
else
{
@@ -1317,11 +1315,7 @@ MainGUI::showFont(bool preserveIndices)
// instance index 0 represents a face without an instance;
// consequently, `n' instances are enumerated from 1 to `n'
// (instead of having indices 0 to `n-1')
- if (preserveIndices)
- currentNamedInstanceIndex = qMin(currentNamedInstanceIndex,
- currentNumberOfNamedInstances - 1);
- else
- currentNamedInstanceIndex = 0;
+ currentNamedInstanceIndex = 0;
}
// up to now we only called for rudimentary font handling (via the
@@ -1591,7 +1585,7 @@ MainGUI::checkCurrentFontIndex()
previousFontButton->setEnabled(false);
nextFontButton->setEnabled(true);
}
- else if (currentFontIndex == fontList.size() - 1)
+ else if (currentFontIndex >= fontList.size() - 1)
{
previousFontButton->setEnabled(true);
nextFontButton->setEnabled(false);
@@ -1625,7 +1619,7 @@ MainGUI::checkCurrentFaceIndex()
previousFaceButton->setEnabled(false);
nextFaceButton->setEnabled(true);
}
- else if (currentFaceIndex == currentNumberOfFaces - 1)
+ else if (currentFaceIndex >= currentNumberOfFaces - 1)
{
previousFaceButton->setEnabled(true);
nextFaceButton->setEnabled(false);
@@ -1665,7 +1659,7 @@ MainGUI::checkCurrentNamedInstanceIndex()
previousNamedInstanceButton->setEnabled(false);
nextNamedInstanceButton->setEnabled(true);
}
- else if (currentNamedInstanceIndex == currentNumberOfNamedInstances - 1)
+ else if (currentNamedInstanceIndex >= currentNumberOfNamedInstances - 1)
{
previousNamedInstanceButton->setEnabled(true);
nextNamedInstanceButton->setEnabled(false);
diff --git a/src/ftinspect.h b/src/ftinspect.h
index b591a89..c06fece 100644
--- a/src/ftinspect.h
+++ b/src/ftinspect.h
@@ -523,7 +523,7 @@ private:
void createStatusBar();
void readSettings();
void setGraphicsDefaults();
- void showFont(bool = false);
+ void showFont();
void writeSettings();
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 31e81a9 6/7: [ftinspect] Minor issues.,
Werner LEMBERG <=