font: work save

This commit is contained in:
Roy Qu 2024-02-26 16:43:40 +08:00
parent 979427da27
commit 174808d416
8 changed files with 53 additions and 33 deletions

View File

@ -5289,6 +5289,7 @@ void Editor::applySettings()
pSettings->editor().fontName(),
pSettings->editor().fallbackFontName()
};
QFont f=QFont();
f.setFamilies(fontFamilies);
f.setPixelSize(pointToPixel(pSettings->editor().fontSize()));

View File

@ -447,7 +447,7 @@ public:
//Font
//font
QString mFontName;
QString mNonAsciiFontName;
QString mFallbackFontName;
int mFontSize;
bool mFontOnlyMonospaced;
double mLineSpacing;

View File

@ -48,6 +48,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>*Needs restart</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">

View File

@ -1557,6 +1557,10 @@
<source>Fallback Font:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>*Needs restart</source>
<translation type="unfinished">*Necessário reiniciar</translation>
</message>
</context>
<context>
<name>EditorGeneralWidget</name>

View File

@ -1653,7 +1653,7 @@ p, li { white-space: pre-wrap; }
<translation>:</translation>
</message>
<message>
<location filename="../editor.cpp" line="5476"/>
<location filename="../editor.cpp" line="5477"/>
<source>Readonly</source>
<translation></translation>
</message>
@ -2059,20 +2059,25 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="117"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="501"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="54"/>
<source>*Needs restart</source>
<translation>*</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="124"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="508"/>
<source>Size:</source>
<translation>:</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="234"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="494"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="241"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="501"/>
<source>Font:</source>
<translation>:</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="204"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="589"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="211"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="596"/>
<source>Show only monospaced fonts</source>
<translation></translation>
</message>
@ -2089,92 +2094,92 @@ p, li { white-space: pre-wrap; }
<translation type="vanished"></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="124"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="131"/>
<source>Enable ligatures support</source>
<translation>(ligratures)</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="131"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="138"/>
<source>Line Spacing:</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="227"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="234"/>
<source>Fallback Font:</source>
<translation>:</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="244"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="251"/>
<source>Show whitespaces</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="250"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="257"/>
<source>Leading</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="257"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="264"/>
<source>Inner</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="264"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="271"/>
<source>Trailing</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="271"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="278"/>
<source>Line break</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="281"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="288"/>
<source>Gutter</source>
<translation>线</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="302"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="309"/>
<source>Gutter is visible</source>
<translation>线</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="324"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="331"/>
<source>Left Offset</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="341"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="348"/>
<source>Right Offset</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="374"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="381"/>
<source>Show Line Numbers</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="398"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="405"/>
<source>Add leading zeros to line numbers</source>
<translation>0</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="405"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="412"/>
<source>Line numbers starts at zero</source>
<translation>0</translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="412"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="419"/>
<source>Auto calculate the digit count of line number</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="434"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="441"/>
<source>Digit count</source>
<translation></translation>
</message>
<message>
<location filename="../settingsdialog/editorfontwidget.ui" line="470"/>
<location filename="../settingsdialog/editorfontwidget.ui" line="477"/>
<source>Use Custom Font</source>
<translation>使</translation>
</message>

View File

@ -1390,6 +1390,10 @@
<source>Fallback Font:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>*Needs restart</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditorGeneralWidget</name>

View File

@ -6131,15 +6131,16 @@ bool QSynEdit::event(QEvent *event)
}
}
break;
case QEvent::FontChange:
synFontChanged();
if (mDocument)
mDocument->setFont(font());
break;
case QEvent::MouseMove: {
updateMouseCursor();
break;
}
case QEvent::FontChange: {
if (mDocument)
mDocument->setFont(font());
synFontChanged();
break;
}
default:
break;
}

View File

@ -454,7 +454,6 @@ public:
void setBackgroundColor(const QColor &newBackgroundColor);
bool isEmpty();
signals:
void linesDeleted(int FirstLine, int Count);
void linesInserted(int FirstLine, int Count);
@ -481,7 +480,6 @@ signals:
void fontChanged();
void tabSizeChanged();
protected:
virtual bool onGetSpecialLineColors(int Line,
QColor& foreground, QColor& backgroundColor) ;