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] [ftinspect] Add samp


From: Charlie Jiang (@cqjjjzr)
Subject: [Git][freetype/freetype-demos][gsoc-2022-chariri-3] [ftinspect] Add sample text for Continuous View.
Date: Mon, 08 Aug 2022 14:05:21 +0000

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

Commits:

  • e0bb5a13
    by Charlie Jiang at 2022-08-08T21:47:42+08:00
    [ftinspect] Add sample text for Continuous View.
    
    * src/ftinspect/panels/continuous.cpp, src/ftinspect/panels/continuous.hpp:
      Add a combo box to the UI so the user can choose a preset text.
    

2 changed files:

Changes:

  • src/ftinspect/panels/continuous.cpp
    ... ... @@ -139,6 +139,7 @@ ContinuousTab::checkModeSource()
    139 139
                     || src == GlyphContinuous::SRC_TextStringRepeated;
    
    140 140
       indexSelector_->setEnabled(src == GlyphContinuous::SRC_AllGlyphs);
    
    141 141
       sourceTextEdit_->setEnabled(isText);
    
    142
    +  sampleStringSelector_->setEnabled(isText);
    
    142 143
       canvas_->setSource(src);
    
    143 144
     
    
    144 145
       {
    
    ... ... @@ -184,6 +185,23 @@ ContinuousTab::sourceTextChanged()
    184 185
     }
    
    185 186
     
    
    186 187
     
    
    188
    +void
    
    189
    +ContinuousTab::presetStringSelected()
    
    190
    +{
    
    191
    +  auto index = sampleStringSelector_->currentIndex();
    
    192
    +  if (index < 0)
    
    193
    +    return;
    
    194
    +
    
    195
    +  auto var = sampleStringSelector_->currentData();
    
    196
    +  if (var.isValid() && var.canConvert<QString>())
    
    197
    +  {
    
    198
    +    auto str = var.toString();
    
    199
    +    if (!str.isEmpty())
    
    200
    +      sourceTextEdit_->setPlainText(str);
    
    201
    +  }
    
    202
    +}
    
    203
    +
    
    204
    +
    
    187 205
     void
    
    188 206
     ContinuousTab::reloadGlyphsAndRepaint()
    
    189 207
     {
    
    ... ... @@ -258,6 +276,7 @@ ContinuousTab::createLayout()
    258 276
       modeSelector_ = new QComboBox(this);
    
    259 277
       charMapSelector_ = new CharMapComboBox(this, engine_);
    
    260 278
       sourceSelector_ = new QComboBox(this);
    
    279
    +  sampleStringSelector_ = new QComboBox(this);
    
    261 280
     
    
    262 281
       charMapSelector_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    
    263 282
     
    
    ... ... @@ -289,6 +308,7 @@ ContinuousTab::createLayout()
    289 308
       rotationLabel_ = new QLabel(tr("Rotation:"), this);
    
    290 309
     
    
    291 310
       resetPositionButton_ = new QPushButton(tr("Reset Pos"));
    
    311
    +  configWaterfallButton_ = new QPushButton(tr("WF Config"));
    
    292 312
     
    
    293 313
       xEmboldeningSpinBox_ = new QDoubleSpinBox(this);
    
    294 314
       yEmboldeningSpinBox_ = new QDoubleSpinBox(this);
    
    ... ... @@ -338,12 +358,14 @@ ContinuousTab::createLayout()
    338 358
       bottomLayout_->addWidget(strokeRadiusSpinBox_, 3, 1);
    
    339 359
       bottomLayout_->addWidget(rotationSpinBox_, 0, 3);
    
    340 360
     
    
    341
    -  bottomLayout_->addWidget(indexSelector_, 0, 4, 1, 1);
    
    361
    +  bottomLayout_->addWidget(indexSelector_, 0, 4, 1, 2);
    
    342 362
       bottomLayout_->addWidget(sourceTextEdit_, 1, 4, 3, 1);
    
    343
    -  bottomLayout_->addWidget(resetPositionButton_, 0, 5);
    
    344
    -  bottomLayout_->addWidget(waterfallCheckBox_, 1, 5);
    
    345
    -  bottomLayout_->addWidget(verticalCheckBox_, 2, 5);
    
    346
    -  bottomLayout_->addWidget(kerningCheckBox_, 3, 5);
    
    363
    +  bottomLayout_->addWidget(resetPositionButton_, 0, 6);
    
    364
    +  bottomLayout_->addWidget(waterfallCheckBox_, 1, 6);
    
    365
    +  bottomLayout_->addWidget(verticalCheckBox_, 2, 6);
    
    366
    +  bottomLayout_->addWidget(kerningCheckBox_, 3, 6);
    
    367
    +  bottomLayout_->addWidget(configWaterfallButton_, 1, 5);
    
    368
    +  bottomLayout_->addWidget(sampleStringSelector_, 2, 5);
    
    347 369
     
    
    348 370
       bottomLayout_->setColumnStretch(4, 1);
    
    349 371
     
    
    ... ... @@ -414,12 +436,17 @@ ContinuousTab::createConnections()
    414 436
               this, &ContinuousTab::reloadGlyphsAndRepaint);
    
    415 437
       connect(sourceTextEdit_, &QPlainTextEdit::textChanged,
    
    416 438
               this, &ContinuousTab::sourceTextChanged);
    
    439
    +  connect(sampleStringSelector_, 
    
    440
    +          QOverload<int>::of(&QComboBox::currentIndexChanged),
    
    441
    +          this, &ContinuousTab::presetStringSelected);
    
    417 442
     
    
    418 443
       sizeSelector_->installEventFilterForWidget(canvas_);
    
    419 444
       sizeSelector_->installEventFilterForWidget(this);
    
    420 445
     }
    
    421 446
     
    
    422 447
     
    
    448
    +extern const char* StringSamples[];
    
    449
    +
    
    423 450
     void
    
    424 451
     ContinuousTab::setDefaults()
    
    425 452
     {
    
    ... ... @@ -431,6 +458,15 @@ ContinuousTab::setDefaults()
    431 458
     
    
    432 459
       canvas_->setSourceText(sourceTextEdit_->toPlainText());
    
    433 460
       canvas_->setSource(GlyphContinuous::SRC_AllGlyphs);
    
    461
    +
    
    462
    +  sampleStringSelector_->addItem(tr("<Sample>"));
    
    463
    +  sampleStringSelector_->addItem(tr("English"),  QString(StringSamples[0]));
    
    464
    +  sampleStringSelector_->addItem(tr("Latin"),    QString(StringSamples[1]));
    
    465
    +  sampleStringSelector_->addItem(tr("Greek"),    QString(StringSamples[2]));
    
    466
    +  sampleStringSelector_->addItem(tr("Cyrillic"), QString(StringSamples[3]));
    
    467
    +  sampleStringSelector_->addItem(tr("Chinese"),  QString(StringSamples[4]));
    
    468
    +  sampleStringSelector_->addItem(tr("Japanese"), QString(StringSamples[5]));
    
    469
    +  sampleStringSelector_->addItem(tr("Korean"),   QString(StringSamples[6]));
    
    434 470
     }
    
    435 471
     
    
    436 472
     
    
    ... ... @@ -444,4 +480,48 @@ ContinuousTab::formatIndex(int index)
    444 480
     }
    
    445 481
     
    
    446 482
     
    
    483
    +const char* StringSamples[] = {
    
    484
    +  "The quick brown fox jumps over the lazy dog",
    
    485
    +
    
    486
    +  /* Luís argüia à Júlia que «brações, fé, chá, óxido, pôr, zângão» */
    
    487
    +  /* eram palavras do português */
    
    488
    +  "Lu\u00EDs arg\u00FCia \u00E0 J\u00FAlia que \u00ABbra\u00E7\u00F5es, "
    
    489
    +  "f\u00E9, ch\u00E1, \u00F3xido, p\u00F4r, z\u00E2ng\u00E3o\u00BB eram "
    
    490
    +  "palavras do portugu\u00EAs",
    
    491
    +
    
    492
    +  /* Ο καλύμνιος σφουγγαράς ψιθύρισε πως θα βουτήξει χωρίς να διστάζει */
    
    493
    +  "\u039F \u03BA\u03B1\u03BB\u03CD\u03BC\u03BD\u03B9\u03BF\u03C2 \u03C3"
    
    494
    +  "\u03C6\u03BF\u03C5\u03B3\u03B3\u03B1\u03C1\u03AC\u03C2 \u03C8\u03B9"
    
    495
    +  "\u03B8\u03CD\u03C1\u03B9\u03C3\u03B5 \u03C0\u03C9\u03C2 \u03B8\u03B1 "
    
    496
    +  "\u03B2\u03BF\u03C5\u03C4\u03AE\u03BE\u03B5\u03B9 \u03C7\u03C9\u03C1"
    
    497
    +  "\u03AF\u03C2 \u03BD\u03B1 \u03B4\u03B9\u03C3\u03C4\u03AC\u03B6\u03B5"
    
    498
    +  "\u03B9",
    
    499
    +
    
    500
    +  /* Съешь ещё этих мягких французских булок да выпей же чаю */
    
    501
    +  "\u0421\u044A\u0435\u0448\u044C \u0435\u0449\u0451 \u044D\u0442\u0438"
    
    502
    +  "\u0445 \u043C\u044F\u0433\u043A\u0438\u0445 \u0444\u0440\u0430\u043D"
    
    503
    +  "\u0446\u0443\u0437\u0441\u043A\u0438\u0445 \u0431\u0443\u043B\u043E"
    
    504
    +  "\u043A \u0434\u0430 \u0432\u044B\u043F\u0435\u0439 \u0436\u0435 "
    
    505
    +  "\u0447\u0430\u044E",
    
    506
    +
    
    507
    +  /* 天地玄黃,宇宙洪荒。日月盈昃,辰宿列張。寒來暑往,秋收冬藏。*/
    
    508
    +  "\u5929\u5730\u7384\u9EC3\uFF0C\u5B87\u5B99\u6D2A\u8352\u3002\u65E5"
    
    509
    +  "\u6708\u76C8\u6603\uFF0C\u8FB0\u5BBF\u5217\u5F35\u3002\u5BD2\u4F86"
    
    510
    +  "\u6691\u5F80\uFF0C\u79CB\u6536\u51AC\u85CF\u3002",
    
    511
    +
    
    512
    +  /* いろはにほへと ちりぬるを わかよたれそ つねならむ */
    
    513
    +  /* うゐのおくやま けふこえて あさきゆめみし ゑひもせす */
    
    514
    +  "\u3044\u308D\u306F\u306B\u307B\u3078\u3068 \u3061\u308A\u306C\u308B"
    
    515
    +  "\u3092 \u308F\u304B\u3088\u305F\u308C\u305D \u3064\u306D\u306A\u3089"
    
    516
    +  "\u3080 \u3046\u3090\u306E\u304A\u304F\u3084\u307E \u3051\u3075\u3053"
    
    517
    +  "\u3048\u3066 \u3042\u3055\u304D\u3086\u3081\u307F\u3057 \u3091\u3072"
    
    518
    +  "\u3082\u305B\u3059",
    
    519
    +
    
    520
    +  /* 키스의 고유조건은 입술끼리 만나야 하고 특별한 기술은 필요치 않다 */
    
    521
    +  "\uD0A4\uC2A4\uC758 \uACE0\uC720\uC870\uAC74\uC740 \uC785\uC220\uB07C"
    
    522
    +  "\uB9AC \uB9CC\uB098\uC57C \uD558\uACE0 \uD2B9\uBCC4\uD55C \uAE30"
    
    523
    +  "\uC220\uC740 \uD544\uC694\uCE58 \uC54A\uB2E4"
    
    524
    +};
    
    525
    +
    
    526
    +
    
    447 527
     // end of continuous.cpp

  • src/ftinspect/panels/continuous.hpp
    ... ... @@ -51,6 +51,7 @@ public:
    51 51
       void checkModeSource();
    
    52 52
       void charMapChanged();
    
    53 53
       void sourceTextChanged();
    
    54
    +  void presetStringSelected();
    
    54 55
       void reloadGlyphsAndRepaint();
    
    55 56
       void changeBeginIndexFromCanvas(int index);
    
    56 57
       void updateGlyphDetails(GlyphCacheEntry* ctxt, 
    
    ... ... @@ -81,8 +82,10 @@ private:
    81 82
       QComboBox* modeSelector_;
    
    82 83
       QComboBox* sourceSelector_;
    
    83 84
       CharMapComboBox* charMapSelector_ = NULL;
    
    85
    +  QComboBox* sampleStringSelector_;
    
    84 86
     
    
    85 87
       QPushButton* resetPositionButton_;
    
    88
    +  QPushButton* configWaterfallButton_;
    
    86 89
     
    
    87 90
       QLabel* modeLabel_;
    
    88 91
       QLabel* sourceLabel_;
    


  • reply via email to

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