From bc0d55b1bbc7e90e9384a8dee40e7e1c1e24a849 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 27 Feb 2024 13:23:58 +0800 Subject: [PATCH] - enhancement: Display ascii control chars. --- NEWS.md | 1 + RedPandaIDE/RedPandaIDE.pro | 1 + RedPandaIDE/fonts.qrc | 5 +++++ RedPandaIDE/main.cpp | 2 ++ RedPandaIDE/resources/fonts/asciicontrol.ttf | Bin 0 -> 12280 bytes RedPandaIDE/settings.cpp | 1 + libs/qsynedit/qsynedit/document.cpp | 4 ++-- libs/redpanda_qt_utils/qt_utils/utils.cpp | 20 +++++++++---------- 8 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 RedPandaIDE/fonts.qrc create mode 100644 RedPandaIDE/resources/fonts/asciicontrol.ttf diff --git a/NEWS.md b/NEWS.md index 7008242d..260938eb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,7 @@ Red Panda C++ Version 2.27 - enhancement: Support unicode combining characters. - enhancement: Don't force fixed-width when using non fixed-width fonts. - change: Replace non-ascii font with fallback font. + - enhancement: Display ascii control chars. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 0a6ee8ee..00984131 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -555,6 +555,7 @@ else: unix:!android: target.path = $${PREFIX}/bin !isEmpty(target.path): INSTALLS += target RESOURCES += \ + fonts.qrc \ codes.qrc \ defaultconfigs.qrc \ icons.qrc \ diff --git a/RedPandaIDE/fonts.qrc b/RedPandaIDE/fonts.qrc new file mode 100644 index 00000000..9c7b82f9 --- /dev/null +++ b/RedPandaIDE/fonts.qrc @@ -0,0 +1,5 @@ + + + resources/fonts/asciicontrol.ttf + + diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 87067454..b60714df 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include "widgets/cpudialog.h" #endif @@ -404,6 +405,7 @@ int main(int argc, char *argv[]) e.reason(), QMessageBox::Ok); } + // qDebug()<<"Load font"<SojcBgEP(j{ z%^!Vyc(mGG`zOq2F|RFMu3vfC`@++h{~A79OV>AK+h1~lv6PJcp4BVoFQ3c)_s?Pu ze2@El{n{0*dol0CXg`1H#_D^W4;B~`M;Hq|ePN}(+;@59GGkpD_Qx+^!S=_(9n8N= z^e$Z9*!U6R$o0J;tJto;`iJzIlZ|)INpzGnmV3^~)=po!Wn5 z4*A5!mGx^IuMA&qFqW)9-p^mTx^iWC=J#G=Yp1B+^mfyS%E#s9%WCkDtq6~ z4pxa~8}qOndkdRqkFkor&Y7_D8sj_vvh%H-Z|;0!=j%J4GwJI`_J46u=c2`Glk5(s z%iZP?+P%IGe;^nNcXmahv3MdW?>~WAs$1#VyV%>;KQK6yRx>O+Jdzt_`NG)v#3Y+K zvKQ%4c>2(t|Gy1^rC^64;YHY6VnfA#uoeX-o@WB*!dsaj@Us>`{87dvo7Dm|(Py=V z(|KRY*Pr((Den00pZ%He;_Is^p~A>JJCou`QTFz+qezZnHZ0f~>stjh!TyCk-?!>( zXStoP@xH!Q=4%LCdtMt$H$;Ay_W=NVgN87r(>SKnDBvV$;AFpf(y@Eu0G?`#=V*)P z*e*}O;Ay#+r+8|Q+*2(Y;|I|=Ozs~`V{qqd>_4EpcaQGce?avE^cZi+u&W2oH*I&Q z9((PdZ_&uL^w^~#ntJTB#m*1l!^ig6BHNKnn z7}*mCV>oHVLGz@eAv8~zakCenJZIpmCMV!Gy?y}xPz!(fAbhgRK6!TOPacF%xv&p^ zm;TV3!Y8jA@;9URzPR5G=t19Gok?hIRMXyEm1yxt1J9S~Qvw@CG$g+-r}%7LDEd zwVU@A)3?@UHZ<$*zWCUcV^^1E1%@1l=^`B4ld~hOm~3*tF9#2id-uNB)&0%M-QUuk zDu!|AG`YWl{r2V3Z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wg59f zs@}%`QwFdIfD`bTdYkJjrvT_Hj}y)bY@H??0?rT)0Z$MP0dH0DzlvEIPz4a~c0g72 z4mZ}G1Z1qejqo__zMb%N=%)xzhklyybm%PcoC8{ocoI-2o&=mDo&+or&Pf2vghRjz z;SjJ&I0T&6<(dU_L6?i5i@IC{{fsUbLGRGzBIuGX7eSYGxd>X*t7LRS(@L0K!(9uIa5fB(aGug}XoGOBcpEW>2c#i=R!h3-`)1vpZKGW&F&j1PirU4TA&*9{ZLGR}ckPzN)fQ0Z2a35&V zdsd(6^nSqr3H<{GNa)YuFi`aHy)lqtd z8So$Br5c-U^zi2%!*jrM6`C*4HU?;Z*UpRuHd~E0`f2GE`%S#dD?Yb$TF1l&{oL^g Z+%t5S?>wtnK7yNh_KtPg#%5>P{{r#F@%8`! literal 0 HcmV?d00001 diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 2c2144e5..cc4d7360 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -723,6 +723,7 @@ QStringList Settings::Editor::fontFamilies() const result.append(mFallbackFontName2); if (mUseFallbackFont3) result.append(mFallbackFontName3); + result.append("Red Panda Control"); return result; } diff --git a/libs/qsynedit/qsynedit/document.cpp b/libs/qsynedit/qsynedit/document.cpp index c6a672ef..d5acbfb3 100644 --- a/libs/qsynedit/qsynedit/document.cpp +++ b/libs/qsynedit/qsynedit/document.cpp @@ -669,8 +669,8 @@ void Document::loadFromFile(const QString& filename, const QByteArray& encoding, } else if (line.endsWith("\n")){ line.remove(line.length()-1,1); } - if (isBinaryContent(line)) - throw BinaryFileError(tr("'%1' is a binaray File!").arg(filename)); + // if (isBinaryContent(line)) + // throw BinaryFileError(tr("'%1' is a binaray File!").arg(filename)); if (allAscii) { allAscii = isTextAllAscii(line); } diff --git a/libs/redpanda_qt_utils/qt_utils/utils.cpp b/libs/redpanda_qt_utils/qt_utils/utils.cpp index 41ebab47..12839677 100644 --- a/libs/redpanda_qt_utils/qt_utils/utils.cpp +++ b/libs/redpanda_qt_utils/qt_utils/utils.cpp @@ -724,17 +724,15 @@ QStringList absolutePaths(const QString &dirPath, const QStringList &relativePat return list; } - - -bool isBinaryContent(const QByteArray &text) -{ - for (char c:text) { - if (c>=0 && c<' ' && c!='\t' && c!='\n' && c!='\r') { - return true; - } - } - return false; -} +// bool isBinaryContent(const QByteArray &text) +// { +// for (char c:text) { +// if (c>=0 && c<' ' && c!='\t' && c!='\n' && c!='\r') { +// return true; +// } +// } +// return false; +// } void clearQPlainTextEditFormat(QTextEdit *editor) {