freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] gsoc-2022-chariri-3 aeb4bab 31/36: [ftinspect] Show pl


From: Werner Lemberg
Subject: [freetype2-demos] gsoc-2022-chariri-3 aeb4bab 31/36: [ftinspect] Show platform and encoding id in the charmap selector.
Date: Wed, 27 Jul 2022 06:32:46 -0400 (EDT)

branch: gsoc-2022-chariri-3
commit aeb4babac87d18379f38076143e8cc2e7805be47
Author: Charlie Jiang <w@chariri.moe>
Commit: Charlie Jiang <w@chariri.moe>

    [ftinspect] Show platform and encoding id in the charmap selector.
    
    * src/ftinspect/panels/continuous.cpp: Show PID and EID in the combobox.
      Add necessary layout change.
    
    * src/ftinspect/engine/charmap.cpp, src/ftinspect/engine/charmap.hpp:
      Retrieve PID and EID from the charmap struct and expose them as fields.
---
 src/ftinspect/engine/charmap.cpp    | 5 ++++-
 src/ftinspect/engine/charmap.hpp    | 2 ++
 src/ftinspect/panels/continuous.cpp | 8 ++++++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/ftinspect/engine/charmap.cpp b/src/ftinspect/engine/charmap.cpp
index 284bd0c..3c7d7d2 100644
--- a/src/ftinspect/engine/charmap.cpp
+++ b/src/ftinspect/engine/charmap.cpp
@@ -35,7 +35,10 @@ encodingNames()
 
 
 CharMapInfo::CharMapInfo(int index, FT_CharMap cmap)
-: index(index), ptr(cmap), encoding(cmap->encoding), maxIndex(-1)
+: index(index), ptr(cmap),
+  encoding(cmap->encoding),
+  platformID(cmap->platform_id), encodingID(cmap->encoding_id),
+  maxIndex(-1)
 {
   auto& names = encodingNames();
   auto it = names.find(encoding);
diff --git a/src/ftinspect/engine/charmap.hpp b/src/ftinspect/engine/charmap.hpp
index a6c55e9..f4d4e70 100644
--- a/src/ftinspect/engine/charmap.hpp
+++ b/src/ftinspect/engine/charmap.hpp
@@ -17,6 +17,8 @@ struct CharMapInfo
   int index;
   FT_CharMap ptr;
   FT_Encoding encoding;
+  unsigned short platformID;
+  unsigned short encodingID;
   QString* encodingName;
 
   // Actually this shouldn't go here, but for convenience...
diff --git a/src/ftinspect/panels/continuous.cpp 
b/src/ftinspect/panels/continuous.cpp
index 6762321..0ccaf7f 100644
--- a/src/ftinspect/panels/continuous.cpp
+++ b/src/ftinspect/panels/continuous.cpp
@@ -139,9 +139,11 @@ ContinuousTab::setCharMaps(std::vector<CharMapInfo>& 
charMaps)
     int newIndex = 0;
     for (auto& map : charMaps)
     {
-      charMapSelector_->addItem(tr("%1: %2")
+      charMapSelector_->addItem(tr("%1: %2 (platform %3, encoding %4)")
                                 .arg(i)
-                                .arg(*map.encodingName));
+                                .arg(*map.encodingName)
+                                .arg(map.platformID)
+                                .arg(map.encodingID));
       auto encoding = static_cast<unsigned>(map.encoding);
       charMapSelector_->setItemData(i, encoding, EncodingRole);
 
@@ -296,6 +298,8 @@ ContinuousTab::createLayout()
   charMapSelector_ = new QComboBox(this);
   sourceSelector_ = new QComboBox(this);
 
+  charMapSelector_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
   // Note: in sync with the enum!!
   modeSelector_->insertItem(GlyphContinuous::M_Normal, tr("Normal"));
   modeSelector_->insertItem(GlyphContinuous::M_Fancy, tr("Fancy"));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]