freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][gsoc-2022-chariri-3] 2 commits: [ftinspec


From: Charlie Jiang (@cqjjjzr)
Subject: [Git][freetype/freetype-demos][gsoc-2022-chariri-3] 2 commits: [ftinspect] Add SFNT names showing.
Date: Tue, 16 Aug 2022 15:37:22 +0000

Charlie Jiang pushed to branch gsoc-2022-chariri-3 at FreeType / FreeType Demo Programs

Commits:

  • f4cd83e8
    by Charlie Jiang at 2022-08-16T22:46:38+08:00
    [ftinspect] Add SFNT names showing.
    
    There're slight performance issues.
    
    * src/ftinspect/engine/fontinfo.cpp, src/ftinspect/engine/fontinfo.hpp:
      Add `SFNTName` and code to retrieve SFNT table from the font.
    
    * src/ftinspect/panels/info.cpp, src/ftinspect/panels/info.hpp:
      Implement `SFNTInfoTab`.
    
    * src/ftinspect/engine/fontinfonamesmapping.cpp: Add mappings from
      TrueType IDs to names.
    
    * src/ftinspect/models/fontinfomodels.cpp,
      src/ftinspect/models/fontinfomodels.hpp:
      Add `SFNTNameModel`, and modify `CharMapInfoModel` to display item names
      besides item ID.
    
    * src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
      Update SFNT names table when reloading the font and add getter.
    
    * src/ftinspect/engine/paletteinfo.cpp: Add code to retrieve palatte name
      when possible.
    
    * src/ftinspect/engine/charmap.cpp: Add comment.
    
    * src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
    
  • 312f7299
    by Charlie Jiang at 2022-08-16T23:35:01+08:00
    [ftinspect] Support double click on SFNT name cells for a detailed view.
    
    There's also minor fixes.
    
    * src/ftinspect/panels/info.cpp, src/ftinspect/panels/info.hpp:
      Double click on SFNT name "Content" column cells will open a window
      showing the text and raw hex values.
    
    * src/ftinspect/engine/fontinfo.cpp, src/ftinspect/engine/fontinfo.hpp:
      Add fields to `SFNTName` to store raw byte values. Also do minor fixes to
      the conversion methods.
    
    * src/ftinspect/models/fontinfomodels.cpp: Add tooltip.
    
    * src/ftinspect/engine/fontinfonamesmapping.cpp: Fix name.
    

13 changed files:

Changes:

  • src/ftinspect/CMakeLists.txt
    ... ... @@ -26,6 +26,7 @@ add_executable(ftinspect
    26 26
       "engine/paletteinfo.cpp"
    
    27 27
       "engine/stringrenderer.cpp"
    
    28 28
       "engine/fontinfo.cpp"
    
    29
    +  "engine/fontinfonamesmapping.cpp"
    
    29 30
     
    
    30 31
       "rendering/glyphbitmap.cpp"
    
    31 32
       "rendering/glyphoutline.cpp"
    

  • src/ftinspect/engine/charmap.cpp
    ... ... @@ -8,6 +8,7 @@
    8 8
     #include <freetype/freetype.h>
    
    9 9
     #include <freetype/tttables.h>
    
    10 10
     
    
    11
    +// Mapping for `FT_Encoding` is placed here since it's only for the charmap.
    
    11 12
     QHash<FT_Encoding, QString> encodingNamesCache;
    
    12 13
     QHash<FT_Encoding, QString>&
    
    13 14
     encodingNames()
    

  • src/ftinspect/engine/engine.cpp
    ... ... @@ -323,6 +323,7 @@ Engine::loadFont(int fontIndex,
    323 323
     
    
    324 324
         curCharMaps_.clear();
    
    325 325
         curPaletteInfos_.clear();
    
    326
    +    curSFNTNames_.clear();
    
    326 327
       }
    
    327 328
       else
    
    328 329
       {
    
    ... ... @@ -343,6 +344,8 @@ Engine::loadFont(int fontIndex,
    343 344
         for (int i = 0; i < face->num_charmaps; i++)
    
    344 345
           curCharMaps_.emplace_back(i, face->charmaps[i]);
    
    345 346
     
    
    347
    +    SFNTName::get(this, curSFNTNames_);
    
    348
    +
    
    346 349
         loadPaletteInfos();
    
    347 350
       }
    
    348 351
     
    

  • src/ftinspect/engine/engine.hpp
    ... ... @@ -8,6 +8,7 @@
    8 8
     #include "fontfilemanager.hpp"
    
    9 9
     #include "charmap.hpp"
    
    10 10
     #include "paletteinfo.hpp"
    
    11
    +#include "fontinfo.hpp"
    
    11 12
     
    
    12 13
     #include <vector>
    
    13 14
     #include <utility>
    
    ... ... @@ -153,6 +154,7 @@ public:
    153 154
       
    
    154 155
       std::vector<CharMapInfo>& currentFontCharMaps() { return curCharMaps_; }
    
    155 156
       std::vector<PaletteInfo>& currentFontPalettes() { return curPaletteInfos_; }
    
    157
    +  std::vector<SFNTName>& currentFontSFNTNames() { return curSFNTNames_; }
    
    156 158
       FontFileManager& fontFileManager() { return fontFileManager_; }
    
    157 159
       EngineDefaultValues& engineDefaults() { return engineDefaults_; }
    
    158 160
       bool antiAliasingEnabled() { return antiAliasingEnabled_; }
    
    ... ... @@ -221,6 +223,7 @@ private:
    221 223
       QString curFamilyName_;
    
    222 224
       QString curStyleName_;
    
    223 225
       int curNumGlyphs_ = -1;
    
    226
    +  std::vector<SFNTName> curSFNTNames_;
    
    224 227
       std::vector<CharMapInfo> curCharMaps_;
    
    225 228
       std::vector<PaletteInfo> curPaletteInfos_;
    
    226 229
     
    

  • src/ftinspect/engine/fontinfo.cpp
    ... ... @@ -6,10 +6,143 @@
    6 6
     
    
    7 7
     #include "engine.hpp"
    
    8 8
     
    
    9
    +#include <unordered_map>
    
    10
    +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    
    11
    +#include <QTextCodec>
    
    12
    +#else
    
    13
    +#include <QStringConverter>
    
    14
    +#include <QByteArrayView>
    
    15
    +#endif
    
    9 16
     #include <freetype/ftmodapi.h>
    
    17
    +#include <freetype/ttnameid.h>
    
    10 18
     #include <freetype/tttables.h>
    
    11 19
     
    
    12 20
     
    
    21
    +void
    
    22
    +SFNTName::get(Engine* engine,
    
    23
    +  std::vector<SFNTName>& list)
    
    24
    +{
    
    25
    +  auto size = engine->currentFtSize();
    
    26
    +  if (!size || !FT_IS_SFNT(size->face))
    
    27
    +  {
    
    28
    +    list.clear();
    
    29
    +    return;
    
    30
    +  }
    
    31
    +
    
    32
    +  auto face = size->face;
    
    33
    +  auto newSize = FT_Get_Sfnt_Name_Count(face);
    
    34
    +  if (list.size() != static_cast<size_t>(newSize))
    
    35
    +    list.resize(newSize);
    
    36
    +
    
    37
    +  FT_SfntName sfntName;
    
    38
    +  FT_SfntLangTag langTag;
    
    39
    +  for (unsigned int i = 0; i < newSize; ++i)
    
    40
    +  {
    
    41
    +    FT_Get_Sfnt_Name(face, i, &sfntName);
    
    42
    +    auto& obj = list[i];
    
    43
    +    obj.platformID = sfntName.platform_id;
    
    44
    +    obj.encodingID = sfntName.encoding_id;
    
    45
    +    obj.languageID = sfntName.language_id;
    
    46
    +    obj.nameID = sfntName.name_id;
    
    47
    +    
    
    48
    +    obj.strBuf = QByteArray(reinterpret_cast<const char*>(sfntName.string),
    
    49
    +                            sfntName.string_len);
    
    50
    +    obj.str = sfntNameToQString(sfntName);
    
    51
    +
    
    52
    +    if (obj.languageID >= 0x8000)
    
    53
    +    {
    
    54
    +      auto err = FT_Get_Sfnt_LangTag(face, obj.languageID, &langTag);
    
    55
    +      if (!err)
    
    56
    +        obj.langTag = utf16BEToQString(reinterpret_cast<char*>(langTag.string),
    
    57
    +                                       langTag.string_len);
    
    58
    +    }
    
    59
    +  }
    
    60
    +}
    
    61
    +
    
    62
    +
    
    63
    +QString
    
    64
    +SFNTName::sfntNameToQString(FT_SfntName const& sfntName)
    
    65
    +{
    
    66
    +  return sfntNameToQString(sfntName.platform_id, sfntName.encoding_id,
    
    67
    +                           reinterpret_cast<char const*>(sfntName.string),
    
    68
    +                           sfntName.string_len);
    
    69
    +}
    
    70
    +
    
    71
    +
    
    72
    +QString
    
    73
    +SFNTName::sfntNameToQString(SFNTName const& sfntName)
    
    74
    +{
    
    75
    +  return sfntNameToQString(sfntName.platformID, sfntName.encodingID,
    
    76
    +                           sfntName.strBuf.data(), sfntName.strBuf.size());
    
    77
    +}
    
    78
    +
    
    79
    +
    
    80
    +QString
    
    81
    +SFNTName::sfntNameToQString(unsigned short platformID,
    
    82
    +                            unsigned short encodingID,
    
    83
    +                            char const* str,
    
    84
    +                            size_t size)
    
    85
    +{
    
    86
    +  // TODO not complete.
    
    87
    +  if (size >= INT_MAX - 1)
    
    88
    +    return "";
    
    89
    +  switch (platformID)
    
    90
    +  {
    
    91
    +  case TT_PLATFORM_APPLE_UNICODE:
    
    92
    +    // All UTF-16BE.
    
    93
    +    return utf16BEToQString(str, size);
    
    94
    +  case TT_PLATFORM_MACINTOSH:
    
    95
    +    if (platformID == TT_MAC_ID_ROMAN)
    
    96
    +      return QString::fromLatin1(str, static_cast<int>(size));
    
    97
    +    return "<encoding unsupported>";
    
    98
    +  case TT_PLATFORM_ISO:
    
    99
    +    switch (encodingID)
    
    100
    +    {
    
    101
    +    case TT_ISO_ID_7BIT_ASCII:
    
    102
    +    case TT_ISO_ID_8859_1:
    
    103
    +      return QString::fromLatin1(str, static_cast<int>(size));
    
    104
    +    case TT_ISO_ID_10646:
    
    105
    +      return utf16BEToQString(str, size);
    
    106
    +    default:
    
    107
    +      return "<encoding unsupported>";
    
    108
    +    }
    
    109
    +  case TT_PLATFORM_MICROSOFT:
    
    110
    +    switch (encodingID)
    
    111
    +    {
    
    112
    +      /* TT_MS_ID_SYMBOL_CS is Unicode, similar to PID/EID=3/1 */
    
    113
    +    case TT_MS_ID_SYMBOL_CS:
    
    114
    +    case TT_MS_ID_UNICODE_CS:
    
    115
    +    case TT_MS_ID_UCS_4: // This is UTF-16LE as well, according to MS doc
    
    116
    +      return utf16BEToQString(str, size);
    
    117
    +
    
    118
    +    default:
    
    119
    +      return "<encoding unsupported>";
    
    120
    +    }
    
    121
    +  }
    
    122
    +  return "<platform unsupported>";
    
    123
    +}
    
    124
    +
    
    125
    +
    
    126
    +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    
    127
    +QTextCodec* utf16BECodec = QTextCodec::codecForName("UTF-16BE");
    
    128
    +#else
    
    129
    +QStringDecoder utf16BECvt = (QStringDecoder(QStringDecoder::Utf16BE))(size);
    
    130
    +#endif
    
    131
    +
    
    132
    +QString
    
    133
    +SFNTName::utf16BEToQString(char const* str,
    
    134
    +                           size_t size)
    
    135
    +{
    
    136
    +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    
    137
    +  if (size >= INT_MAX)
    
    138
    +    size = INT_MAX - 1;
    
    139
    +  return utf16BECodec->toUnicode(str, static_cast<int>(size));
    
    140
    +#else
    
    141
    +  return utf16BECvt(QByteArrayView(reinterpret_cast<char*>(str), size));
    
    142
    +#endif
    
    143
    +}
    
    144
    +
    
    145
    +
    
    13 146
     FontBasicInfo
    
    14 147
     FontBasicInfo::get(Engine* engine)
    
    15 148
     {
    

  • src/ftinspect/engine/fontinfo.hpp
    ... ... @@ -5,16 +5,55 @@
    5 5
     #pragma once
    
    6 6
     
    
    7 7
     #include <QDateTime>
    
    8
    +#include <QByteArray>
    
    8 9
     #include <QString>
    
    9 10
     #include <freetype/freetype.h>
    
    11
    +#include <freetype/ftsnames.h>
    
    10 12
     
    
    11 13
     class Engine;
    
    12 14
     
    
    13
    -struct SFNTNameTable
    
    15
    +struct SFNTName
    
    14 16
     {
    
    15
    -  
    
    17
    +  unsigned short nameID;
    
    18
    +  unsigned short platformID;
    
    19
    +  unsigned short encodingID;
    
    20
    +  unsigned short languageID;
    
    21
    +  QByteArray strBuf;
    
    22
    +  QString str;
    
    23
    +  QString langTag;
    
    24
    +
    
    25
    +  static void get(Engine* engine,
    
    26
    +                  std::vector<SFNTName>& list);
    
    27
    +  static QString sfntNameToQString(FT_SfntName const& sfntName);
    
    28
    +  static QString sfntNameToQString(SFNTName const& sfntName);
    
    29
    +  static QString sfntNameToQString(unsigned short platformID,
    
    30
    +                                   unsigned short encodingID, 
    
    31
    +                                   char const* str, size_t size);
    
    32
    +  static QString utf16BEToQString(char const* str, size_t size);
    
    33
    +
    
    34
    +
    
    35
    +  friend bool
    
    36
    +  operator==(const SFNTName& lhs,
    
    37
    +             const SFNTName& rhs)
    
    38
    +  {
    
    39
    +    return lhs.nameID == rhs.nameID
    
    40
    +      && lhs.platformID == rhs.platformID
    
    41
    +      && lhs.encodingID == rhs.encodingID
    
    42
    +      && lhs.languageID == rhs.languageID
    
    43
    +      && lhs.strBuf == rhs.strBuf
    
    44
    +      && lhs.langTag == rhs.langTag;
    
    45
    +  }
    
    46
    +
    
    47
    +
    
    48
    +  friend bool
    
    49
    +  operator!=(const SFNTName& lhs,
    
    50
    +             const SFNTName& rhs)
    
    51
    +  {
    
    52
    +    return !(lhs == rhs);
    
    53
    +  }
    
    16 54
     };
    
    17 55
     
    
    56
    +
    
    18 57
     struct FontBasicInfo
    
    19 58
     {
    
    20 59
       int numFaces = -1;
    
    ... ... @@ -159,4 +198,12 @@ struct FontFixedSize
    159 198
     };
    
    160 199
     
    
    161 200
     
    
    201
    +QString* mapSFNTNameIDToName(unsigned short nameID);
    
    202
    +QString* mapTTPlatformIDToName(unsigned short platformID);
    
    203
    +QString* mapTTEncodingIDToName(unsigned short platformID,
    
    204
    +                               unsigned short encodingID);
    
    205
    +QString* mapTTLanguageIDToName(unsigned short platformID,
    
    206
    +                               unsigned short languageID);
    
    207
    +
    
    208
    +
    
    162 209
     // end of fontinfo.hpp

  • src/ftinspect/engine/fontinfonamesmapping.cpp
    1
    +// fontinfonamesmapping.cpp
    
    2
    +
    
    3
    +// Copyright (C) 2022 by Charlie Jiang.
    
    4
    +
    
    5
    +#include "fontinfo.hpp"
    
    6
    +
    
    7
    +#include <unordered_map>
    
    8
    +#include <freetype/ttnameid.h>
    
    9
    +
    
    10
    +#define FTI_UnknownID 0xFFFE
    
    11
    +
    
    12
    +// No more Qt containers since there's no any apparent advantage.
    
    13
    +using TableType = std::unordered_map<unsigned short, QString>;
    
    14
    +TableType ttSFNTNames;
    
    15
    +
    
    16
    +TableType ttPlatformNames;
    
    17
    +TableType ttEncodingUnicodeNames;
    
    18
    +TableType ttEncodingMacNames;
    
    19
    +TableType ttEncodingWindowsNames;
    
    20
    +TableType ttEncodingISONames;
    
    21
    +TableType ttEncodingAdobeNames;
    
    22
    +
    
    23
    +TableType ttLanguageMacNames;
    
    24
    +TableType ttLanguageWindowsNames;
    
    25
    +
    
    26
    +QString*
    
    27
    +mapSFNTNameIDToName(unsigned short nameID)
    
    28
    +{
    
    29
    +  if (ttSFNTNames.empty())
    
    30
    +  {
    
    31
    +    ttSFNTNames[FTI_UnknownID] = "Unknown";
    
    32
    +    ttSFNTNames[TT_NAME_ID_COPYRIGHT] = "Copyright";
    
    33
    +    ttSFNTNames[TT_NAME_ID_FONT_FAMILY] = "Font Family";
    
    34
    +    ttSFNTNames[TT_NAME_ID_FONT_SUBFAMILY] = "Font Subfamily";
    
    35
    +    ttSFNTNames[TT_NAME_ID_UNIQUE_ID] = "Unique Font ID";
    
    36
    +    ttSFNTNames[TT_NAME_ID_FULL_NAME] = "Full Name";
    
    37
    +    ttSFNTNames[TT_NAME_ID_VERSION_STRING] = "Version String";
    
    38
    +    ttSFNTNames[TT_NAME_ID_PS_NAME] = "PostScript Name";
    
    39
    +    ttSFNTNames[TT_NAME_ID_TRADEMARK] = "Trademark";
    
    40
    +    ttSFNTNames[TT_NAME_ID_MANUFACTURER] = "Manufacturer";
    
    41
    +    ttSFNTNames[TT_NAME_ID_DESIGNER] = "Designer";
    
    42
    +    ttSFNTNames[TT_NAME_ID_DESCRIPTION] = "Description";
    
    43
    +    ttSFNTNames[TT_NAME_ID_VENDOR_URL] = "Vendor URL";
    
    44
    +    ttSFNTNames[TT_NAME_ID_DESIGNER_URL] = "Designer URL";
    
    45
    +    ttSFNTNames[TT_NAME_ID_LICENSE] = "License";
    
    46
    +    ttSFNTNames[TT_NAME_ID_LICENSE_URL] = "License URL";
    
    47
    +    ttSFNTNames[TT_NAME_ID_TYPOGRAPHIC_FAMILY] = "Typographic Family";
    
    48
    +    ttSFNTNames[TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY] = "Typographic Subfamily";
    
    49
    +    ttSFNTNames[TT_NAME_ID_MAC_FULL_NAME] = "Mac Full Name";
    
    50
    +    ttSFNTNames[TT_NAME_ID_SAMPLE_TEXT] = "Sample Text";
    
    51
    +    ttSFNTNames[TT_NAME_ID_WWS_FAMILY] = "WWS Family Name";
    
    52
    +    ttSFNTNames[TT_NAME_ID_WWS_SUBFAMILY] = "WWS Subfamily Name";
    
    53
    +    ttSFNTNames[TT_NAME_ID_LIGHT_BACKGROUND] = "Light Background Palette";
    
    54
    +    ttSFNTNames[TT_NAME_ID_DARK_BACKGROUND] = "Dark Background Palette";
    
    55
    +    ttSFNTNames[TT_NAME_ID_VARIATIONS_PREFIX]
    
    56
    +      = "Variations PostScript Name Prefix";
    
    57
    +  }
    
    58
    +
    
    59
    +  auto it = ttSFNTNames.find(nameID);
    
    60
    +  if (it == ttSFNTNames.end())
    
    61
    +    return &ttSFNTNames[FTI_UnknownID];
    
    62
    +  return &it->second;
    
    63
    +}
    
    64
    +
    
    65
    +QString*
    
    66
    +mapTTPlatformIDToName(unsigned short platformID)
    
    67
    +{
    
    68
    +  if (ttPlatformNames.empty())
    
    69
    +  {
    
    70
    +    ttPlatformNames[FTI_UnknownID] = "Unknown Platform";
    
    71
    +    // Unicode codepoints are encoded as UTF-16BE
    
    72
    +    ttPlatformNames[TT_PLATFORM_APPLE_UNICODE] = "Apple (Unicode)";
    
    73
    +    ttPlatformNames[TT_PLATFORM_MACINTOSH] = "Macintosh";
    
    74
    +    ttPlatformNames[TT_PLATFORM_ISO] = "ISO (deprecated)";
    
    75
    +    ttPlatformNames[TT_PLATFORM_MICROSOFT] = "Microsoft";
    
    76
    +    ttPlatformNames[TT_PLATFORM_CUSTOM] = "Custom";
    
    77
    +    ttPlatformNames[TT_PLATFORM_ADOBE] = "Adobe";
    
    78
    +  }
    
    79
    +  
    
    80
    +  auto it = ttPlatformNames.find(platformID);
    
    81
    +  if (it == ttPlatformNames.end())
    
    82
    +    return &ttPlatformNames[FTI_UnknownID];
    
    83
    +  return &it->second;
    
    84
    +}
    
    85
    +
    
    86
    +
    
    87
    +QString*
    
    88
    +mapTTEncodingIDToName(unsigned short platformID, 
    
    89
    +                      unsigned short encodingID)
    
    90
    +{
    
    91
    +  if (ttEncodingUnicodeNames.empty())
    
    92
    +  {
    
    93
    +    // Note: different from the Apple doc.
    
    94
    +    ttEncodingUnicodeNames[FTI_UnknownID] = "Unknown Encoding";
    
    95
    +    ttEncodingUnicodeNames[TT_APPLE_ID_DEFAULT] = "Unicode 1.0";
    
    96
    +    ttEncodingUnicodeNames[TT_APPLE_ID_UNICODE_1_1] = "Unicode 1.1";
    
    97
    +    ttEncodingUnicodeNames[TT_APPLE_ID_ISO_10646] = "ISO/IEC 10646";
    
    98
    +    ttEncodingUnicodeNames[TT_APPLE_ID_UNICODE_2_0]
    
    99
    +        = "Unicode 2.0 or later (BMP only)";
    
    100
    +    ttEncodingUnicodeNames[TT_APPLE_ID_UNICODE_32]
    
    101
    +        = "Unicode 2.0 or later (non-BMP characters allowed)";
    
    102
    +    //ttEncodingUnicodeNames[TT_APPLE_ID_VARIANT_SELECTOR] = "Variant Selector";
    
    103
    +    //ttEncodingUnicodeNames[TT_APPLE_ID_FULL_UNICODE] = ???;
    
    104
    +  }
    
    105
    +
    
    106
    +  if (ttEncodingMacNames.empty())
    
    107
    +  {
    
    108
    +    ttEncodingMacNames[FTI_UnknownID] = "Unknown Encoding";
    
    109
    +    ttEncodingMacNames[0] = "Roman";
    
    110
    +    ttEncodingMacNames[1] = "Japanese";
    
    111
    +    ttEncodingMacNames[2] = "Chinese (Traditional)";
    
    112
    +    ttEncodingMacNames[3] = "Korean";
    
    113
    +    ttEncodingMacNames[4] = "Arabic";
    
    114
    +    ttEncodingMacNames[5] = "Hebrew";
    
    115
    +    ttEncodingMacNames[6] = "Greek";
    
    116
    +    ttEncodingMacNames[7] = "Russian";
    
    117
    +    ttEncodingMacNames[8] = "RSymbol";
    
    118
    +    ttEncodingMacNames[9] = "Devanagari";
    
    119
    +    ttEncodingMacNames[10] = "Gurmukhi";
    
    120
    +    ttEncodingMacNames[11] = "Gujarati";
    
    121
    +    ttEncodingMacNames[12] = "Oriya";
    
    122
    +    ttEncodingMacNames[13] = "Bengali";
    
    123
    +    ttEncodingMacNames[14] = "Tamil";
    
    124
    +    ttEncodingMacNames[15] = "Telugu";
    
    125
    +    ttEncodingMacNames[16] = "Kannada";
    
    126
    +    ttEncodingMacNames[17] = "Malayalam";
    
    127
    +    ttEncodingMacNames[18] = "Sinhalese";
    
    128
    +    ttEncodingMacNames[19] = "Burmese";
    
    129
    +    ttEncodingMacNames[20] = "Khmer";
    
    130
    +    ttEncodingMacNames[21] = "Thai";
    
    131
    +    ttEncodingMacNames[22] = "Laotian";
    
    132
    +    ttEncodingMacNames[23] = "Georgian";
    
    133
    +    ttEncodingMacNames[24] = "Armenian";
    
    134
    +    ttEncodingMacNames[25] = "Chinese (Simplified)";
    
    135
    +    ttEncodingMacNames[26] = "Tibetan";
    
    136
    +    ttEncodingMacNames[27] = "Mongolian";
    
    137
    +    ttEncodingMacNames[28] = "Geez";
    
    138
    +    ttEncodingMacNames[29] = "Slavic";
    
    139
    +    ttEncodingMacNames[30] = "Vietnamese";
    
    140
    +    ttEncodingMacNames[31] = "Sindhi";
    
    141
    +    ttEncodingMacNames[32] = "Uninterpreted";
    
    142
    +  }
    
    143
    +
    
    144
    +  if (ttEncodingWindowsNames.empty())
    
    145
    +  {
    
    146
    +    ttEncodingMacNames[FTI_UnknownID] = "Unknown Encoding";
    
    147
    +    ttEncodingWindowsNames[0] = "Symbol";
    
    148
    +    ttEncodingWindowsNames[1] = "Unicode BMP";
    
    149
    +    ttEncodingWindowsNames[2] = "ShiftJIS";
    
    150
    +    ttEncodingWindowsNames[3] = "GBK";
    
    151
    +    ttEncodingWindowsNames[4] = "Big5";
    
    152
    +    ttEncodingWindowsNames[5] = "Wansung";
    
    153
    +    ttEncodingWindowsNames[6] = "Johab";
    
    154
    +    ttEncodingWindowsNames[7] = "Reserved";
    
    155
    +    ttEncodingWindowsNames[8] = "Reserved";
    
    156
    +    ttEncodingWindowsNames[9] = "Reserved";
    
    157
    +    ttEncodingWindowsNames[10] = "Unicode full repertoire";
    
    158
    +  }
    
    159
    +
    
    160
    +  if (ttEncodingISONames.empty())
    
    161
    +  {
    
    162
    +    ttEncodingISONames[FTI_UnknownID] = "Unknown Encoding";
    
    163
    +    ttEncodingISONames[TT_ISO_ID_7BIT_ASCII] = "ASCII";
    
    164
    +    ttEncodingISONames[TT_ISO_ID_10646] = "ISO/IEC 10646";
    
    165
    +    ttEncodingISONames[TT_ISO_ID_8859_1] = "ISO 8859-1";
    
    166
    +  }
    
    167
    +
    
    168
    +  if (ttEncodingAdobeNames.empty())
    
    169
    +  {
    
    170
    +    ttEncodingAdobeNames[FTI_UnknownID] = "Unknown Encoding";
    
    171
    +    ttEncodingAdobeNames[TT_ADOBE_ID_STANDARD] = "Adobe Standard";
    
    172
    +    ttEncodingAdobeNames[TT_ADOBE_ID_EXPERT] = "Adobe Expert";
    
    173
    +    ttEncodingAdobeNames[TT_ADOBE_ID_CUSTOM] = "Adobe Custom";
    
    174
    +    ttEncodingAdobeNames[TT_ADOBE_ID_LATIN_1] = "Adobe Latin 1";
    
    175
    +  }
    
    176
    +
    
    177
    +  TableType* table = NULL;
    
    178
    +
    
    179
    +  switch (platformID)
    
    180
    +  {
    
    181
    +  case TT_PLATFORM_APPLE_UNICODE:
    
    182
    +    table = &ttEncodingUnicodeNames;
    
    183
    +    break;
    
    184
    +  case TT_PLATFORM_MACINTOSH:
    
    185
    +    table = &ttEncodingMacNames;
    
    186
    +    break;
    
    187
    +  case TT_PLATFORM_MICROSOFT:
    
    188
    +    table = &ttEncodingWindowsNames;
    
    189
    +    break;
    
    190
    +  case TT_PLATFORM_ISO:
    
    191
    +    table = &ttEncodingISONames;
    
    192
    +    break;
    
    193
    +  case TT_PLATFORM_ADOBE:
    
    194
    +    table = &ttEncodingAdobeNames;
    
    195
    +    break;
    
    196
    +
    
    197
    +  default:
    
    198
    +    return &ttEncodingUnicodeNames[FTI_UnknownID];
    
    199
    +  }
    
    200
    +
    
    201
    +  auto it = table->find(encodingID);
    
    202
    +  if (it == table->end())
    
    203
    +    return &(*table)[FTI_UnknownID];
    
    204
    +  return &it->second;
    
    205
    +}
    
    206
    +
    
    207
    +
    
    208
    +QString*
    
    209
    +mapTTLanguageIDToName(unsigned short platformID,
    
    210
    +                      unsigned short languageID)
    
    211
    +{
    
    212
    +  if (ttLanguageMacNames.empty())
    
    213
    +  {
    
    214
    +    ttLanguageMacNames[FTI_UnknownID] = "Unknown Language";
    
    215
    +    ttLanguageMacNames[0] = "English";
    
    216
    +    ttLanguageMacNames[1] = "French";
    
    217
    +    ttLanguageMacNames[2] = "German";
    
    218
    +    ttLanguageMacNames[3] = "Italian";
    
    219
    +    ttLanguageMacNames[4] = "Dutch";
    
    220
    +    ttLanguageMacNames[5] = "Swedish";
    
    221
    +    ttLanguageMacNames[6] = "Spanish";
    
    222
    +    ttLanguageMacNames[7] = "Danish";
    
    223
    +    ttLanguageMacNames[8] = "Portuguese";
    
    224
    +    ttLanguageMacNames[9] = "Norwegian";
    
    225
    +    ttLanguageMacNames[10] = "Hebrew";
    
    226
    +    ttLanguageMacNames[11] = "Japanese";
    
    227
    +    ttLanguageMacNames[12] = "Arabic";
    
    228
    +    ttLanguageMacNames[13] = "Finnish";
    
    229
    +    ttLanguageMacNames[14] = "Greek";
    
    230
    +    ttLanguageMacNames[15] = "Icelandic";
    
    231
    +    ttLanguageMacNames[16] = "Maltese";
    
    232
    +    ttLanguageMacNames[17] = "Turkish";
    
    233
    +    ttLanguageMacNames[18] = "Croatian";
    
    234
    +    ttLanguageMacNames[19] = "Chinese (Traditional)";
    
    235
    +    ttLanguageMacNames[20] = "Urdu";
    
    236
    +    ttLanguageMacNames[21] = "Hindi";
    
    237
    +    ttLanguageMacNames[22] = "Thai";
    
    238
    +    ttLanguageMacNames[23] = "Korean";
    
    239
    +    ttLanguageMacNames[24] = "Lithuanian";
    
    240
    +    ttLanguageMacNames[25] = "Polish";
    
    241
    +    ttLanguageMacNames[26] = "Hungarian";
    
    242
    +    ttLanguageMacNames[27] = "Estonian";
    
    243
    +    ttLanguageMacNames[28] = "Latvian";
    
    244
    +    ttLanguageMacNames[29] = "Sami";
    
    245
    +    ttLanguageMacNames[30] = "Faroese";
    
    246
    +    ttLanguageMacNames[31] = "Farsi/Persian";
    
    247
    +    ttLanguageMacNames[32] = "Russian";
    
    248
    +    ttLanguageMacNames[33] = "Chinese (Simplified)";
    
    249
    +    ttLanguageMacNames[34] = "Flemish";
    
    250
    +    ttLanguageMacNames[35] = "Irish Gaelic";
    
    251
    +    ttLanguageMacNames[36] = "Albanian";
    
    252
    +    ttLanguageMacNames[37] = "Romanian";
    
    253
    +    ttLanguageMacNames[38] = "Czech";
    
    254
    +    ttLanguageMacNames[39] = "Slovak";
    
    255
    +    ttLanguageMacNames[40] = "Slovenian";
    
    256
    +    ttLanguageMacNames[41] = "Yiddish";
    
    257
    +    ttLanguageMacNames[42] = "Serbian";
    
    258
    +    ttLanguageMacNames[43] = "Macedonian";
    
    259
    +    ttLanguageMacNames[44] = "Bulgarian";
    
    260
    +    ttLanguageMacNames[45] = "Ukrainian";
    
    261
    +    ttLanguageMacNames[46] = "Byelorussian";
    
    262
    +    ttLanguageMacNames[47] = "Uzbek";
    
    263
    +    ttLanguageMacNames[48] = "Kazakh";
    
    264
    +    ttLanguageMacNames[49] = "Azerbaijani (Cyrillic script)";
    
    265
    +    ttLanguageMacNames[50] = "Azerbaijani (Arabic script)";
    
    266
    +    ttLanguageMacNames[51] = "Armenian";
    
    267
    +    ttLanguageMacNames[52] = "Georgian";
    
    268
    +    ttLanguageMacNames[53] = "Moldavian";
    
    269
    +    ttLanguageMacNames[54] = "Kirghiz";
    
    270
    +    ttLanguageMacNames[55] = "Tajiki";
    
    271
    +    ttLanguageMacNames[56] = "Turkmen";
    
    272
    +    ttLanguageMacNames[57] = "Mongolian (Mongolian script)";
    
    273
    +    ttLanguageMacNames[58] = "Mongolian (Cyrillic script)";
    
    274
    +    ttLanguageMacNames[59] = "Pashto";
    
    275
    +    ttLanguageMacNames[60] = "Kurdish";
    
    276
    +    ttLanguageMacNames[61] = "Kashmiri";
    
    277
    +    ttLanguageMacNames[62] = "Sindhi";
    
    278
    +    ttLanguageMacNames[63] = "Tibetan";
    
    279
    +    ttLanguageMacNames[64] = "Nepali";
    
    280
    +    ttLanguageMacNames[65] = "Sanskrit";
    
    281
    +    ttLanguageMacNames[66] = "Marathi";
    
    282
    +    ttLanguageMacNames[67] = "Bengali";
    
    283
    +    ttLanguageMacNames[68] = "Assamese";
    
    284
    +    ttLanguageMacNames[69] = "Gujarati";
    
    285
    +    ttLanguageMacNames[70] = "Punjabi";
    
    286
    +    ttLanguageMacNames[71] = "Oriya";
    
    287
    +    ttLanguageMacNames[72] = "Malayalam";
    
    288
    +    ttLanguageMacNames[73] = "Kannada";
    
    289
    +    ttLanguageMacNames[74] = "Tamil";
    
    290
    +    ttLanguageMacNames[75] = "Telugu";
    
    291
    +    ttLanguageMacNames[76] = "Sinhalese";
    
    292
    +    ttLanguageMacNames[77] = "Burmese";
    
    293
    +    ttLanguageMacNames[78] = "Khmer";
    
    294
    +    ttLanguageMacNames[79] = "Lao";
    
    295
    +    ttLanguageMacNames[80] = "Vietnamese";
    
    296
    +    ttLanguageMacNames[81] = "Indonesian";
    
    297
    +    ttLanguageMacNames[82] = "Tagalog";
    
    298
    +    ttLanguageMacNames[83] = "Malay (Roman script)";
    
    299
    +    ttLanguageMacNames[84] = "Malay (Arabic script)";
    
    300
    +    ttLanguageMacNames[85] = "Amharic";
    
    301
    +    ttLanguageMacNames[86] = "Tigrinya";
    
    302
    +    ttLanguageMacNames[87] = "Galla";
    
    303
    +    ttLanguageMacNames[88] = "Somali";
    
    304
    +    ttLanguageMacNames[89] = "Swahili";
    
    305
    +    ttLanguageMacNames[90] = "Kinyarwanda/Ruanda";
    
    306
    +    ttLanguageMacNames[91] = "Rundi";
    
    307
    +    ttLanguageMacNames[92] = "Nyanja/Chewa";
    
    308
    +    ttLanguageMacNames[93] = "Malagasy";
    
    309
    +    ttLanguageMacNames[94] = "Esperanto";
    
    310
    +    ttLanguageMacNames[128] = "Welsh";
    
    311
    +    ttLanguageMacNames[129] = "Basque";
    
    312
    +    ttLanguageMacNames[130] = "Catalan";
    
    313
    +    ttLanguageMacNames[131] = "Latin";
    
    314
    +    ttLanguageMacNames[132] = "Quechua";
    
    315
    +    ttLanguageMacNames[133] = "Guarani";
    
    316
    +    ttLanguageMacNames[134] = "Aymara";
    
    317
    +    ttLanguageMacNames[135] = "Tatar";
    
    318
    +    ttLanguageMacNames[136] = "Uighur";
    
    319
    +    ttLanguageMacNames[137] = "Dzongkha";
    
    320
    +    ttLanguageMacNames[138] = "Javanese (Roman script)";
    
    321
    +    ttLanguageMacNames[139] = "Sundanese (Roman script)";
    
    322
    +    ttLanguageMacNames[140] = "Galician";
    
    323
    +    ttLanguageMacNames[141] = "Afrikaans";
    
    324
    +    ttLanguageMacNames[142] = "Breton";
    
    325
    +    ttLanguageMacNames[143] = "Inuktitut";
    
    326
    +    ttLanguageMacNames[144] = "Scottish Gaelic";
    
    327
    +    ttLanguageMacNames[145] = "Manx Gaelic";
    
    328
    +    ttLanguageMacNames[146] = "Irish Gaelic (with dot above)";
    
    329
    +    ttLanguageMacNames[147] = "Tongan";
    
    330
    +    ttLanguageMacNames[148] = "Greek (polytonic)";
    
    331
    +    ttLanguageMacNames[149] = "Greenlandic";
    
    332
    +    ttLanguageMacNames[150] = "Azerbaijani (Roman script)";
    
    333
    +  }
    
    334
    +
    
    335
    +  if (ttLanguageWindowsNames.empty())
    
    336
    +  {
    
    337
    +    ttLanguageWindowsNames[FTI_UnknownID] = "Unknown Language";
    
    338
    +    ttLanguageWindowsNames[0x0436] = "Afrikaans";
    
    339
    +    ttLanguageWindowsNames[0x041C] = "Albanian";
    
    340
    +    ttLanguageWindowsNames[0x0402] = "Bulgarian";
    
    341
    +    ttLanguageWindowsNames[0x0484] = "Alsatian";
    
    342
    +    ttLanguageWindowsNames[0x045E] = "Amharic";
    
    343
    +    ttLanguageWindowsNames[0x0405] = "Czech";
    
    344
    +    ttLanguageWindowsNames[0x1401] = "Arabic";
    
    345
    +    ttLanguageWindowsNames[0x3C01] = "Arabic";
    
    346
    +    ttLanguageWindowsNames[0x0C01] = "Arabic";
    
    347
    +    ttLanguageWindowsNames[0x0401] = "Arabic";
    
    348
    +    ttLanguageWindowsNames[0x0404] = "Chinese";
    
    349
    +    ttLanguageWindowsNames[0x0406] = "Danish";
    
    350
    +    ttLanguageWindowsNames[0x0423] = "Belarusian";
    
    351
    +    ttLanguageWindowsNames[0x0445] = "Bengali";
    
    352
    +    ttLanguageWindowsNames[0x0465] = "Divehi";
    
    353
    +    ttLanguageWindowsNames[0x0801] = "Arabic";
    
    354
    +    ttLanguageWindowsNames[0x2C01] = "Arabic";
    
    355
    +    ttLanguageWindowsNames[0x0403] = "Catalan";
    
    356
    +    ttLanguageWindowsNames[0x0413] = "Dutch";
    
    357
    +    ttLanguageWindowsNames[0x0483] = "Corsican";
    
    358
    +    ttLanguageWindowsNames[0x0804] = "Chinese";
    
    359
    +    ttLanguageWindowsNames[0x0813] = "Dutch";
    
    360
    +    ttLanguageWindowsNames[0x0845] = "Bengali";
    
    361
    +    ttLanguageWindowsNames[0x1001] = "Arabic";
    
    362
    +    ttLanguageWindowsNames[0x1004] = "Chinese";
    
    363
    +    ttLanguageWindowsNames[0x1009] = "English";
    
    364
    +    ttLanguageWindowsNames[0x1404] = "Chinese";
    
    365
    +    ttLanguageWindowsNames[0x1801] = "Arabic";
    
    366
    +    ttLanguageWindowsNames[0x2001] = "Arabic";
    
    367
    +    ttLanguageWindowsNames[0x2401] = "Arabic";
    
    368
    +    ttLanguageWindowsNames[0x2801] = "Arabic";
    
    369
    +    ttLanguageWindowsNames[0x3001] = "Arabic";
    
    370
    +    ttLanguageWindowsNames[0x3401] = "Arabic";
    
    371
    +    ttLanguageWindowsNames[0x3801] = "Arabic";
    
    372
    +    ttLanguageWindowsNames[0x4001] = "Arabic";
    
    373
    +    ttLanguageWindowsNames[0x1C01] = "Arabic";
    
    374
    +    ttLanguageWindowsNames[0x042B] = "Armenian";
    
    375
    +    ttLanguageWindowsNames[0x044D] = "Assamese";
    
    376
    +    ttLanguageWindowsNames[0x082C] = "Azeri (Cyrillic)";
    
    377
    +    ttLanguageWindowsNames[0x042C] = "Azeri (Latin)";
    
    378
    +    ttLanguageWindowsNames[0x046D] = "Bashkir";
    
    379
    +    ttLanguageWindowsNames[0x042D] = "Basque";
    
    380
    +    ttLanguageWindowsNames[0x201A] = "Bosnian (Cyrillic)";
    
    381
    +    ttLanguageWindowsNames[0x141A] = "Bosnian (Latin)";
    
    382
    +    ttLanguageWindowsNames[0x047E] = "Breton";
    
    383
    +    ttLanguageWindowsNames[0x0C04] = "Chinese";
    
    384
    +    ttLanguageWindowsNames[0x041A] = "Croatian";
    
    385
    +    ttLanguageWindowsNames[0x101A] = "Croatian (Latin)";
    
    386
    +    ttLanguageWindowsNames[0x048C] = "Dari";
    
    387
    +    ttLanguageWindowsNames[0x0C09] = "English";
    
    388
    +    ttLanguageWindowsNames[0x0407] = "German";
    
    389
    +    ttLanguageWindowsNames[0x0408] = "Greek";
    
    390
    +    ttLanguageWindowsNames[0x0409] = "English";
    
    391
    +    ttLanguageWindowsNames[0x0410] = "Italian";
    
    392
    +    ttLanguageWindowsNames[0x0411] = "Japanese";
    
    393
    +    ttLanguageWindowsNames[0x0421] = "Indonesian";
    
    394
    +    ttLanguageWindowsNames[0x0425] = "Estonian";
    
    395
    +    ttLanguageWindowsNames[0x0434] = "isiXhosa";
    
    396
    +    ttLanguageWindowsNames[0x0435] = "isiZulu";
    
    397
    +    ttLanguageWindowsNames[0x0437] = "Georgian";
    
    398
    +    ttLanguageWindowsNames[0x0438] = "Faroese";
    
    399
    +    ttLanguageWindowsNames[0x0439] = "Hindi";
    
    400
    +    ttLanguageWindowsNames[0x0447] = "Gujarati";
    
    401
    +    ttLanguageWindowsNames[0x0453] = "Khmer";
    
    402
    +    ttLanguageWindowsNames[0x0456] = "Galician";
    
    403
    +    ttLanguageWindowsNames[0x0462] = "Frisian";
    
    404
    +    ttLanguageWindowsNames[0x0464] = "Filipino";
    
    405
    +    ttLanguageWindowsNames[0x0468] = "Hausa (Latin)";
    
    406
    +    ttLanguageWindowsNames[0x0470] = "Igbo";
    
    407
    +    ttLanguageWindowsNames[0x0486] = "K’iche";
    
    408
    +    ttLanguageWindowsNames[0x0807] = "German";
    
    409
    +    ttLanguageWindowsNames[0x0809] = "English";
    
    410
    +    ttLanguageWindowsNames[0x0810] = "Italian";
    
    411
    +    ttLanguageWindowsNames[0x1007] = "German";
    
    412
    +    ttLanguageWindowsNames[0x1407] = "German";
    
    413
    +    ttLanguageWindowsNames[0x1409] = "English";
    
    414
    +    ttLanguageWindowsNames[0x1809] = "English";
    
    415
    +    ttLanguageWindowsNames[0x2009] = "English";
    
    416
    +    ttLanguageWindowsNames[0x2409] = "English";
    
    417
    +    ttLanguageWindowsNames[0x2809] = "English";
    
    418
    +    ttLanguageWindowsNames[0x3009] = "English";
    
    419
    +    ttLanguageWindowsNames[0x3409] = "English";
    
    420
    +    ttLanguageWindowsNames[0x4009] = "English";
    
    421
    +    ttLanguageWindowsNames[0x4409] = "English";
    
    422
    +    ttLanguageWindowsNames[0x4809] = "English";
    
    423
    +    ttLanguageWindowsNames[0x1C09] = "English";
    
    424
    +    ttLanguageWindowsNames[0x2C09] = "English";
    
    425
    +    ttLanguageWindowsNames[0x040B] = "Finnish";
    
    426
    +    ttLanguageWindowsNames[0x080C] = "French";
    
    427
    +    ttLanguageWindowsNames[0x0C0C] = "French";
    
    428
    +    ttLanguageWindowsNames[0x040C] = "French";
    
    429
    +    ttLanguageWindowsNames[0x140c] = "French";
    
    430
    +    ttLanguageWindowsNames[0x180C] = "French";
    
    431
    +    ttLanguageWindowsNames[0x100C] = "French";
    
    432
    +    ttLanguageWindowsNames[0x0C07] = "German";
    
    433
    +    ttLanguageWindowsNames[0x046F] = "Greenlandic";
    
    434
    +    ttLanguageWindowsNames[0x040D] = "Hebrew";
    
    435
    +    ttLanguageWindowsNames[0x040E] = "Hungarian";
    
    436
    +    ttLanguageWindowsNames[0x040F] = "Icelandic";
    
    437
    +    ttLanguageWindowsNames[0x045D] = "Inuktitut";
    
    438
    +    ttLanguageWindowsNames[0x085D] = "Inuktitut (Latin)";
    
    439
    +    ttLanguageWindowsNames[0x083C] = "Irish";
    
    440
    +    ttLanguageWindowsNames[0x044B] = "Kannada";
    
    441
    +    ttLanguageWindowsNames[0x043F] = "Kazakh";
    
    442
    +    ttLanguageWindowsNames[0x0412] = "Korean";
    
    443
    +    ttLanguageWindowsNames[0x0426] = "Latvian";
    
    444
    +    ttLanguageWindowsNames[0x0427] = "Lithuanian";
    
    445
    +    ttLanguageWindowsNames[0x0440] = "Kyrgyz";
    
    446
    +    ttLanguageWindowsNames[0x0441] = "Kiswahili";
    
    447
    +    ttLanguageWindowsNames[0x0454] = "Lao";
    
    448
    +    ttLanguageWindowsNames[0x0457] = "Konkani";
    
    449
    +    ttLanguageWindowsNames[0x0481] = "Maori";
    
    450
    +    ttLanguageWindowsNames[0x0487] = "Kinyarwanda";
    
    451
    +    ttLanguageWindowsNames[0x082E] = "Lower Sorbian";
    
    452
    +    ttLanguageWindowsNames[0x046E] = "Luxembourgish";
    
    453
    +    ttLanguageWindowsNames[0x042F] = "Macedonian";
    
    454
    +    ttLanguageWindowsNames[0x083E] = "Malay";
    
    455
    +    ttLanguageWindowsNames[0x043E] = "Malay";
    
    456
    +    ttLanguageWindowsNames[0x044C] = "Malayalam";
    
    457
    +    ttLanguageWindowsNames[0x043A] = "Maltese";
    
    458
    +    ttLanguageWindowsNames[0x047A] = "Mapudungun";
    
    459
    +    ttLanguageWindowsNames[0x044E] = "Marathi";
    
    460
    +    ttLanguageWindowsNames[0x047C] = "Mohawk";
    
    461
    +    ttLanguageWindowsNames[0x0414] = "Norwegian (Bokmal)";
    
    462
    +    ttLanguageWindowsNames[0x0415] = "Polish";
    
    463
    +    ttLanguageWindowsNames[0x0416] = "Portuguese";
    
    464
    +    ttLanguageWindowsNames[0x0417] = "Romansh";
    
    465
    +    ttLanguageWindowsNames[0x0418] = "Romanian";
    
    466
    +    ttLanguageWindowsNames[0x0419] = "Russian";
    
    467
    +    ttLanguageWindowsNames[0x0446] = "Punjabi";
    
    468
    +    ttLanguageWindowsNames[0x0448] = "Odia (formerly Oriya)";
    
    469
    +    ttLanguageWindowsNames[0x0450] = "Mongolian (Cyrillic)";
    
    470
    +    ttLanguageWindowsNames[0x0461] = "Nepali";
    
    471
    +    ttLanguageWindowsNames[0x0463] = "Pashto";
    
    472
    +    ttLanguageWindowsNames[0x0482] = "Occitan";
    
    473
    +    ttLanguageWindowsNames[0x0814] = "Norwegian (Nynorsk)";
    
    474
    +    ttLanguageWindowsNames[0x0816] = "Portuguese";
    
    475
    +    ttLanguageWindowsNames[0x0850] = "Mongolian (Traditional)";
    
    476
    +    ttLanguageWindowsNames[0x046B] = "Quechua";
    
    477
    +    ttLanguageWindowsNames[0x086B] = "Quechua";
    
    478
    +    ttLanguageWindowsNames[0x0C6B] = "Quechua";
    
    479
    +    ttLanguageWindowsNames[0x243B] = "Sami (Inari)";
    
    480
    +    ttLanguageWindowsNames[0x103B] = "Sami (Lule)";
    
    481
    +    ttLanguageWindowsNames[0x143B] = "Sami (Lule)";
    
    482
    +    ttLanguageWindowsNames[0x0C3B] = "Sami (Northern)";
    
    483
    +    ttLanguageWindowsNames[0x043B] = "Sami (Northern)";
    
    484
    +    ttLanguageWindowsNames[0x083B] = "Sami (Northern)";
    
    485
    +    ttLanguageWindowsNames[0x203B] = "Sami (Skolt)";
    
    486
    +    ttLanguageWindowsNames[0x183B] = "Sami (Southern)";
    
    487
    +    ttLanguageWindowsNames[0x1C3B] = "Sami (Southern)";
    
    488
    +    ttLanguageWindowsNames[0x044F] = "Sanskrit";
    
    489
    +    ttLanguageWindowsNames[0x1C1A] = "Serbian (Cyrillic)";
    
    490
    +    ttLanguageWindowsNames[0x0C1A] = "Serbian (Cyrillic)";
    
    491
    +    ttLanguageWindowsNames[0x181A] = "Serbian (Latin)";
    
    492
    +    ttLanguageWindowsNames[0x081A] = "Serbian (Latin)";
    
    493
    +    ttLanguageWindowsNames[0x046C] = "Sesotho sa Leboa";
    
    494
    +    ttLanguageWindowsNames[0x0432] = "Setswana";
    
    495
    +    ttLanguageWindowsNames[0x045B] = "Sinhala";
    
    496
    +    ttLanguageWindowsNames[0x041B] = "Slovak";
    
    497
    +    ttLanguageWindowsNames[0x0424] = "Slovenian";
    
    498
    +    ttLanguageWindowsNames[0x2C0A] = "Spanish";
    
    499
    +    ttLanguageWindowsNames[0x400A] = "Spanish";
    
    500
    +    ttLanguageWindowsNames[0x340A] = "Spanish";
    
    501
    +    ttLanguageWindowsNames[0x240A] = "Spanish";
    
    502
    +    ttLanguageWindowsNames[0x140A] = "Spanish";
    
    503
    +    ttLanguageWindowsNames[0x1C0A] = "Spanish";
    
    504
    +    ttLanguageWindowsNames[0x300A] = "Spanish";
    
    505
    +    ttLanguageWindowsNames[0x440A] = "Spanish";
    
    506
    +    ttLanguageWindowsNames[0x100A] = "Spanish";
    
    507
    +    ttLanguageWindowsNames[0x480A] = "Spanish";
    
    508
    +    ttLanguageWindowsNames[0x080A] = "Spanish";
    
    509
    +    ttLanguageWindowsNames[0x4C0A] = "Spanish";
    
    510
    +    ttLanguageWindowsNames[0x180A] = "Spanish";
    
    511
    +    ttLanguageWindowsNames[0x3C0A] = "Spanish";
    
    512
    +    ttLanguageWindowsNames[0x280A] = "Spanish";
    
    513
    +    ttLanguageWindowsNames[0x500A] = "Spanish";
    
    514
    +    ttLanguageWindowsNames[0x0C0A] = "Spanish (Modern Sort)";
    
    515
    +    ttLanguageWindowsNames[0x040A] = "Spanish (Traditional Sort)";
    
    516
    +    ttLanguageWindowsNames[0x540A] = "Spanish";
    
    517
    +    ttLanguageWindowsNames[0x380A] = "Spanish";
    
    518
    +    ttLanguageWindowsNames[0x200A] = "Spanish";
    
    519
    +    ttLanguageWindowsNames[0x081D] = "Swedish";
    
    520
    +    ttLanguageWindowsNames[0x041D] = "Swedish";
    
    521
    +    ttLanguageWindowsNames[0x045A] = "Syriac";
    
    522
    +    ttLanguageWindowsNames[0x0420] = "Urdu";
    
    523
    +    ttLanguageWindowsNames[0x0428] = "Tajik (Cyrillic)";
    
    524
    +    ttLanguageWindowsNames[0x085F] = "Tamazight (Latin)";
    
    525
    +    ttLanguageWindowsNames[0x0443] = "Uzbek (Latin)";
    
    526
    +    ttLanguageWindowsNames[0x0444] = "Tatar";
    
    527
    +    ttLanguageWindowsNames[0x0449] = "Tamil";
    
    528
    +    ttLanguageWindowsNames[0x044A] = "Telugu";
    
    529
    +    ttLanguageWindowsNames[0x041E] = "Thai";
    
    530
    +    ttLanguageWindowsNames[0x0422] = "Ukrainian";
    
    531
    +    ttLanguageWindowsNames[0x0442] = "Turkmen";
    
    532
    +    ttLanguageWindowsNames[0x0451] = "Tibetan";
    
    533
    +    ttLanguageWindowsNames[0x041F] = "Turkish";
    
    534
    +    ttLanguageWindowsNames[0x0480] = "Uighur";
    
    535
    +    ttLanguageWindowsNames[0x042E] = "Upper Sorbian";
    
    536
    +    ttLanguageWindowsNames[0x0452] = "Welsh";
    
    537
    +    ttLanguageWindowsNames[0x0478] = "Yi";
    
    538
    +    ttLanguageWindowsNames[0x0485] = "Yakut";
    
    539
    +    ttLanguageWindowsNames[0x0488] = "Wolof";
    
    540
    +    ttLanguageWindowsNames[0x0843] = "Uzbek (Cyrillic)";
    
    541
    +    ttLanguageWindowsNames[0x042A] = "Vietnamese";
    
    542
    +    ttLanguageWindowsNames[0x046A] = "Yoruba";
    
    543
    +  }
    
    544
    +
    
    545
    +  TableType* table = NULL;
    
    546
    +
    
    547
    +  switch (platformID)
    
    548
    +  {
    
    549
    +  case TT_PLATFORM_MACINTOSH:
    
    550
    +    table = &ttLanguageMacNames;
    
    551
    +    break;
    
    552
    +  case TT_PLATFORM_MICROSOFT:
    
    553
    +    table = &ttLanguageWindowsNames;
    
    554
    +    break;
    
    555
    +
    
    556
    +  default:
    
    557
    +    return &ttLanguageWindowsNames[FTI_UnknownID];
    
    558
    +  }
    
    559
    +
    
    560
    +  auto it = table->find(languageID);
    
    561
    +  if (it == table->end())
    
    562
    +    return &(*table)[FTI_UnknownID];
    
    563
    +  return &it->second;
    
    564
    +}
    
    565
    +
    
    566
    +
    
    567
    +// end of fontinfonamesmapping.cpp

  • src/ftinspect/engine/paletteinfo.cpp
    ... ... @@ -4,6 +4,8 @@
    4 4
     
    
    5 5
     #include "paletteinfo.hpp"
    
    6 6
     
    
    7
    +#include "fontinfo.hpp"
    
    8
    +
    
    7 9
     PaletteInfo::PaletteInfo(FT_Face face, 
    
    8 10
                              FT_Palette_Data& data, 
    
    9 11
                              int index)
    
    ... ... @@ -14,13 +16,10 @@ PaletteInfo::PaletteInfo(FT_Face face,
    14 16
         auto id = data.palette_name_ids[index];
    
    15 17
         FT_SfntName sname;
    
    16 18
         FT_Get_Sfnt_Name(face, id, &sname);
    
    17
    -    name = "(SFNT no impl)";
    
    18
    -    // TODO: Get SFNT Name: After implemented SFNT names functionality.
    
    19
    +    name = SFNTName::sfntNameToQString(sname);
    
    19 20
       }
    
    20 21
       else
    
    21
    -  {
    
    22 22
         name = "(unnamed)";
    
    23
    -  }
    
    24 23
     }
    
    25 24
     
    
    26 25
     
    

  • src/ftinspect/meson.build
    ... ... @@ -27,6 +27,7 @@ if qt5_dep.found()
    27 27
         'engine/paletteinfo.cpp',
    
    28 28
         'engine/stringrenderer.cpp',
    
    29 29
         'engine/fontinfo.cpp',
    
    30
    +    'engine/fontinfonamesmapping.cpp',
    
    30 31
     
    
    31 32
         'rendering/glyphbitmap.cpp',
    
    32 33
         'rendering/glyphoutline.cpp',
    

  • src/ftinspect/models/fontinfomodels.cpp
    ... ... @@ -119,15 +119,17 @@ CharMapInfoModel::data(const QModelIndex& index,
    119 119
       {
    
    120 120
       case CMIM_Index: 
    
    121 121
         return index.row();
    
    122
    +  case CMIM_Platform: 
    
    123
    +    return QString("%1 <%2>")
    
    124
    +             .arg(obj.platformID)
    
    125
    +             .arg(*mapTTPlatformIDToName(obj.platformID));
    
    122 126
       case CMIM_Encoding:
    
    123
    -    return *obj.encodingName;
    
    124
    -  case CMIM_PlatformID: 
    
    125
    -    return obj.platformID;
    
    126
    -  case CMIM_EncodingID: 
    
    127
    -    return obj.encodingID;
    
    127
    +    return QString("%1 <%2>")
    
    128
    +             .arg(obj.encodingID)
    
    129
    +             .arg(*obj.encodingName);
    
    128 130
       case CMIM_FormatID: 
    
    129 131
         return static_cast<long long>(obj.formatID);
    
    130
    -  case CMIM_LanguageID:
    
    132
    +  case CMIM_Language:
    
    131 133
         return static_cast<unsigned long long>(obj.languageID);
    
    132 134
       case CMIM_MaxIndex: 
    
    133 135
         return obj.maxIndex;
    
    ... ... @@ -151,16 +153,14 @@ CharMapInfoModel::headerData(int section,
    151 153
       {
    
    152 154
       case CMIM_Index:
    
    153 155
         return "#";
    
    156
    +  case CMIM_Platform:
    
    157
    +    return "Platform";
    
    154 158
       case CMIM_Encoding:
    
    155 159
         return "Encoding";
    
    156
    -  case CMIM_PlatformID:
    
    157
    -    return "Platform ID";
    
    158
    -  case CMIM_EncodingID:
    
    159
    -    return "Encoding ID";
    
    160 160
       case CMIM_FormatID:
    
    161 161
         return "Format ID";
    
    162
    -  case CMIM_LanguageID:
    
    163
    -    return "Language ID";
    
    162
    +  case CMIM_Language:
    
    163
    +    return "Language";
    
    164 164
       case CMIM_MaxIndex:
    
    165 165
         return "Max Code Point";
    
    166 166
       default:
    
    ... ... @@ -171,4 +171,103 @@ CharMapInfoModel::headerData(int section,
    171 171
     }
    
    172 172
     
    
    173 173
     
    
    174
    +int
    
    175
    +SFNTNameModel::rowCount(const QModelIndex& parent) const
    
    176
    +{
    
    177
    +  if (parent.isValid())
    
    178
    +    return 0;
    
    179
    +  return static_cast<int>(storage_.size());
    
    180
    +}
    
    181
    +
    
    182
    +
    
    183
    +int
    
    184
    +SFNTNameModel::columnCount(const QModelIndex& parent) const
    
    185
    +{
    
    186
    +  if (parent.isValid())
    
    187
    +    return 0;
    
    188
    +  return SNM_Max;
    
    189
    +}
    
    190
    +
    
    191
    +
    
    192
    +QVariant
    
    193
    +SFNTNameModel::data(const QModelIndex& index,
    
    194
    +                    int role) const
    
    195
    +{
    
    196
    +  if (index.row() < 0 || index.column() < 0)
    
    197
    +    return {};
    
    198
    +
    
    199
    +  if (role == Qt::ToolTipRole && index.column() == SNM_Content)
    
    200
    +    return tr("Double click to view the string.");
    
    201
    +
    
    202
    +  auto r = static_cast<size_t>(index.row());
    
    203
    +  if (role != Qt::DisplayRole || r > storage_.size())
    
    204
    +    return {};
    
    205
    +
    
    206
    +  auto& obj = storage_[r];
    
    207
    +  switch (static_cast<Columns>(index.column()))
    
    208
    +  {
    
    209
    +  case SNM_Index:
    
    210
    +    return index.row();
    
    211
    +  case SNM_Name:
    
    212
    +    return QString("%1 <%2>")
    
    213
    +             .arg(obj.nameID)
    
    214
    +             .arg(*mapSFNTNameIDToName(obj.nameID));
    
    215
    +  case SNM_Platform:
    
    216
    +    return QString("%1 <%2>")
    
    217
    +             .arg(obj.platformID)
    
    218
    +             .arg(*mapTTPlatformIDToName(obj.platformID));
    
    219
    +  case SNM_Encoding:
    
    220
    +    return QString("%1 <%2>")
    
    221
    +             .arg(obj.encodingID)
    
    222
    +             .arg(*mapTTEncodingIDToName(obj.platformID, obj.encodingID));
    
    223
    +  case SNM_Language:
    
    224
    +    if (obj.languageID >= 0x8000)
    
    225
    +      return obj.langTag + "(lang tag)";
    
    226
    +    if (obj.platformID == 3)
    
    227
    +      return QString("0x%1 <%2>")
    
    228
    +               .arg(obj.languageID, 4, 16, QChar('0'))
    
    229
    +               .arg(*mapTTLanguageIDToName(obj.platformID, obj.languageID));
    
    230
    +    return QString("%1 <%2>")
    
    231
    +             .arg(obj.languageID)
    
    232
    +        .arg(*mapTTLanguageIDToName(obj.platformID, obj.languageID));
    
    233
    +  case SNM_Content:
    
    234
    +    return obj.str;
    
    235
    +  default:
    
    236
    +    break;
    
    237
    +  }
    
    238
    +
    
    239
    +  return {};
    
    240
    +}
    
    241
    +
    
    242
    +
    
    243
    +QVariant
    
    244
    +SFNTNameModel::headerData(int section,
    
    245
    +                          Qt::Orientation orientation,
    
    246
    +                          int role) const
    
    247
    +{
    
    248
    +  if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
    
    249
    +    return {};
    
    250
    +
    
    251
    +  switch (static_cast<Columns>(section))
    
    252
    +  {
    
    253
    +  case SNM_Index:
    
    254
    +    return "#";
    
    255
    +  case SNM_Name:
    
    256
    +    return "Name";
    
    257
    +  case SNM_Platform:
    
    258
    +    return "Platform";
    
    259
    +  case SNM_Encoding:
    
    260
    +    return "Encoding";
    
    261
    +  case SNM_Language:
    
    262
    +    return "Language";
    
    263
    +  case SNM_Content:
    
    264
    +    return "Content";
    
    265
    +  default:
    
    266
    +    break;
    
    267
    +  }
    
    268
    +
    
    269
    +  return {};
    
    270
    +}
    
    271
    +
    
    272
    +
    
    174 273
     // end of fontinfomodels.cpp

  • src/ftinspect/models/fontinfomodels.hpp
    ... ... @@ -78,12 +78,11 @@ public:
    78 78
       enum Columns : int
    
    79 79
       {
    
    80 80
         CMIM_Index      = 0,
    
    81
    -    CMIM_Encoding   = 1,
    
    82
    -    CMIM_PlatformID = 2,
    
    83
    -    CMIM_EncodingID = 3,
    
    84
    -    CMIM_FormatID   = 4,
    
    85
    -    CMIM_LanguageID = 5,
    
    86
    -    CMIM_MaxIndex   = 6,
    
    81
    +    CMIM_Platform   = 1,
    
    82
    +    CMIM_Encoding   = 2,
    
    83
    +    CMIM_FormatID   = 3,
    
    84
    +    CMIM_Language   = 4,
    
    85
    +    CMIM_MaxIndex   = 5,
    
    87 86
         CMIM_Max
    
    88 87
       };
    
    89 88
     
    
    ... ... @@ -93,4 +92,42 @@ private:
    93 92
     };
    
    94 93
     
    
    95 94
     
    
    95
    +class SFNTNameModel
    
    96
    +: public QAbstractTableModel
    
    97
    +{
    
    98
    +  Q_OBJECT
    
    99
    +public:
    
    100
    +  explicit SFNTNameModel(QObject* parent) : QAbstractTableModel(parent) {}
    
    101
    +  ~SFNTNameModel() override = default;
    
    102
    +
    
    103
    +  int rowCount(const QModelIndex& parent) const override;
    
    104
    +  int columnCount(const QModelIndex& parent) const override;
    
    105
    +  QVariant data(const QModelIndex& index,
    
    106
    +                int role) const override;
    
    107
    +  QVariant headerData(int section,
    
    108
    +                      Qt::Orientation orientation,
    
    109
    +                      int role) const override;
    
    110
    +
    
    111
    +  // Same to `FixedSizeInfoModel`
    
    112
    +  void beginModelUpdate() { beginResetModel(); }
    
    113
    +  void endModelUpdate() { endResetModel(); }
    
    114
    +  std::vector<SFNTName>& storage() { return storage_; }
    
    115
    +
    
    116
    +  enum Columns : int
    
    117
    +  {
    
    118
    +    SNM_Index      = 0,
    
    119
    +    SNM_Name       = 1,
    
    120
    +    SNM_Platform   = 2,
    
    121
    +    SNM_Encoding   = 3,
    
    122
    +    SNM_Language   = 4,
    
    123
    +    SNM_Content    = 5,
    
    124
    +    SNM_Max
    
    125
    +  };
    
    126
    +
    
    127
    +private:
    
    128
    +  // Don't let the item count exceed INT_MAX!
    
    129
    +  std::vector<SFNTName> storage_;
    
    130
    +};
    
    131
    +
    
    132
    +
    
    96 133
     // end of fontinfomodels.hpp

  • src/ftinspect/panels/info.cpp
    ... ... @@ -349,16 +349,130 @@ GeneralInfoTab::createLayout()
    349 349
     }
    
    350 350
     
    
    351 351
     
    
    352
    +StringViewDialog::StringViewDialog(QWidget* parent)
    
    353
    +: QDialog(parent)
    
    354
    +{
    
    355
    +  createLayout();
    
    356
    +}
    
    357
    +
    
    358
    +
    
    359
    +void
    
    360
    +StringViewDialog::updateString(QByteArray const& rawArray,
    
    361
    +                               QString const& str)
    
    362
    +{
    
    363
    +  textEdit_->setText(str);
    
    364
    +  hexTextEdit_->setText(rawArray.toHex());
    
    365
    +}
    
    366
    +
    
    367
    +
    
    368
    +void
    
    369
    +StringViewDialog::createLayout()
    
    370
    +{
    
    371
    +  textEdit_ = new QTextEdit(this);
    
    372
    +  hexTextEdit_ = new QTextEdit(this);
    
    373
    +
    
    374
    +  textEdit_->setLineWrapMode(QTextEdit::WidgetWidth);
    
    375
    +  hexTextEdit_->setLineWrapMode(QTextEdit::WidgetWidth);
    
    376
    +
    
    377
    +  textLabel_ = new QLabel(tr("Text"), this);
    
    378
    +  hexTextLabel_ = new QLabel(tr("Raw Bytes"), this);
    
    379
    +
    
    380
    +  layout_ = new QVBoxLayout;
    
    381
    +
    
    382
    +  layout_->addWidget(textLabel_);
    
    383
    +  layout_->addWidget(textEdit_);
    
    384
    +  layout_->addWidget(hexTextLabel_);
    
    385
    +  layout_->addWidget(hexTextEdit_);
    
    386
    +
    
    387
    +  resize(600, 400);
    
    388
    +
    
    389
    +  setLayout(layout_);
    
    390
    +}
    
    391
    +
    
    392
    +
    
    352 393
     SFNTInfoTab::SFNTInfoTab(QWidget* parent,
    
    353 394
                              Engine* engine)
    
    354 395
     : QWidget(parent), engine_(engine)
    
    355 396
     {
    
    397
    +  createLayout();
    
    398
    +  createConnections();
    
    356 399
     }
    
    357 400
     
    
    358 401
     
    
    359 402
     void
    
    360 403
     SFNTInfoTab::reloadFont()
    
    361 404
     {
    
    405
    +  if (engine_->currentFontSFNTNames() != sfntNamesModel_->storage())
    
    406
    +  {
    
    407
    +    sfntNamesModel_->beginModelUpdate();
    
    408
    +    sfntNamesModel_->storage() = engine_->currentFontSFNTNames();
    
    409
    +    sfntNamesModel_->endModelUpdate();
    
    410
    +  }
    
    411
    +}
    
    412
    +
    
    413
    +
    
    414
    +void
    
    415
    +SFNTInfoTab::createLayout()
    
    416
    +{
    
    417
    +  sfntNamesGroupBox_ = new QGroupBox(tr("SFNT Name Table"), this);
    
    418
    +  sfntTablesGroupBox_ = new QGroupBox(tr("SFNT Tables"), this);
    
    419
    +
    
    420
    +  sfntNamesTable_ = new QTableView(this);
    
    421
    +  sfntTablesTable_ = new QTableView(this);
    
    422
    +
    
    423
    +  sfntNamesModel_ = new SFNTNameModel(this);
    
    424
    +  sfntNamesTable_->setModel(sfntNamesModel_);
    
    425
    +  auto header = sfntNamesTable_->verticalHeader();
    
    426
    +  // This will force the minimal size to be used
    
    427
    +  header->setDefaultSectionSize(0);
    
    428
    +  header->setSectionResizeMode(QHeaderView::Fixed);
    
    429
    +  sfntNamesTable_->horizontalHeader()->setStretchLastSection(true);
    
    430
    +
    
    431
    +  header = sfntTablesTable_->verticalHeader();
    
    432
    +  // This will force the minimal size to be used
    
    433
    +  header->setDefaultSectionSize(0);
    
    434
    +  header->setSectionResizeMode(QHeaderView::Fixed);
    
    435
    +
    
    436
    +  sfntNamesLayout_ = new QHBoxLayout;
    
    437
    +  sfntTablesLayout_ = new QHBoxLayout;
    
    438
    +
    
    439
    +  sfntNamesLayout_->addWidget(sfntNamesTable_);
    
    440
    +  sfntTablesLayout_->addWidget(sfntTablesTable_);
    
    441
    +
    
    442
    +  sfntNamesGroupBox_->setLayout(sfntNamesLayout_);
    
    443
    +  sfntTablesGroupBox_->setLayout(sfntTablesLayout_);
    
    444
    +
    
    445
    +  mainLayout_ = new QHBoxLayout;
    
    446
    +
    
    447
    +  mainLayout_->addWidget(sfntNamesGroupBox_);
    
    448
    +  mainLayout_->addWidget(sfntTablesGroupBox_);
    
    449
    +
    
    450
    +  setLayout(mainLayout_);
    
    451
    +
    
    452
    +  stringViewDialog_ = new StringViewDialog(this);
    
    453
    +}
    
    454
    +
    
    455
    +
    
    456
    +void
    
    457
    +SFNTInfoTab::createConnections()
    
    458
    +{
    
    459
    +  connect(sfntNamesTable_, &QTableView::doubleClicked,
    
    460
    +          this, &SFNTInfoTab::nameTableDoubleClicked);
    
    461
    +}
    
    462
    +
    
    463
    +
    
    464
    +void
    
    465
    +SFNTInfoTab::nameTableDoubleClicked(QModelIndex const& index)
    
    466
    +{
    
    467
    +  if (index.column() != SFNTNameModel::SNM_Content)
    
    468
    +    return;
    
    469
    +  auto& storage = sfntNamesModel_->storage();
    
    470
    +  if (index.row() < 0 || static_cast<size_t>(index.row()) > storage.size())
    
    471
    +    return;
    
    472
    +
    
    473
    +  auto& obj = storage[index.row()];
    
    474
    +  stringViewDialog_->updateString(obj.strBuf, obj.str);
    
    475
    +  stringViewDialog_->exec();
    
    362 476
     }
    
    363 477
     
    
    364 478
     
    

  • src/ftinspect/panels/info.hpp
    ... ... @@ -12,6 +12,8 @@
    12 12
     #include <QWidget>
    
    13 13
     #include <QTabWidget>
    
    14 14
     #include <QBoxLayout>
    
    15
    +#include <QTextEdit>
    
    16
    +#include <QDialog>
    
    15 17
     #include <QGridLayout>
    
    16 18
     #include <QVector>
    
    17 19
     #include <QLabel>
    
    ... ... @@ -125,6 +127,29 @@ private:
    125 127
     };
    
    126 128
     
    
    127 129
     
    
    130
    +class StringViewDialog
    
    131
    +: public QDialog
    
    132
    +{
    
    133
    +  Q_OBJECT
    
    134
    +public:
    
    135
    +  StringViewDialog(QWidget* parent);
    
    136
    +  ~StringViewDialog() override = default;
    
    137
    +
    
    138
    +  void updateString(QByteArray const& rawArray, QString const& str);
    
    139
    +
    
    140
    +private:
    
    141
    +  QLabel* textLabel_;
    
    142
    +  QLabel* hexTextLabel_;
    
    143
    +
    
    144
    +  QTextEdit* textEdit_;
    
    145
    +  QTextEdit* hexTextEdit_;
    
    146
    +
    
    147
    +  QVBoxLayout* layout_;
    
    148
    +
    
    149
    +  void createLayout();
    
    150
    +};
    
    151
    +
    
    152
    +
    
    128 153
     class SFNTInfoTab
    
    129 154
     : public QWidget, public AbstractTab
    
    130 155
     {
    
    ... ... @@ -138,6 +163,25 @@ public:
    138 163
     
    
    139 164
     private:
    
    140 165
       Engine* engine_;
    
    166
    +
    
    167
    +  QGroupBox* sfntNamesGroupBox_;
    
    168
    +  QGroupBox* sfntTablesGroupBox_;
    
    169
    +
    
    170
    +  QTableView* sfntNamesTable_;
    
    171
    +  QTableView* sfntTablesTable_;
    
    172
    +
    
    173
    +  SFNTNameModel* sfntNamesModel_;
    
    174
    +
    
    175
    +  QHBoxLayout* sfntNamesLayout_;
    
    176
    +  QHBoxLayout* sfntTablesLayout_;
    
    177
    +  QHBoxLayout* mainLayout_;
    
    178
    +
    
    179
    +  StringViewDialog* stringViewDialog_;
    
    180
    +
    
    181
    +  void createLayout();
    
    182
    +  void createConnections();
    
    183
    +
    
    184
    +  void nameTableDoubleClicked(QModelIndex const& index);
    
    141 185
     };
    
    142 186
     
    
    143 187
     
    


  • reply via email to

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