[ENHANCEMENT] Improve the usage of Source Code Pro font

1. fix the hanging problem for some rare situation (some specific
graphic cards?) by replacing otf file by ttf file.
2. make better font look by adding bold, italic and bold-italic fonts
3. load Source Code Pro privately so it won't be listed for the other
application during Notepad++ session.
This commit is contained in:
Don Ho 2015-07-29 23:38:18 +02:00
parent 11ad9f699a
commit 9bb3c7d5be
9 changed files with 38 additions and 20 deletions

View File

@ -489,7 +489,10 @@ Section -"Notepad++" mainSection
SetOverwrite off
File "..\bin\shortcuts.xml"
File "..\bin\SourceCodePro-Regular.otf"
File "..\bin\SourceCodePro-Regular.ttf"
File "..\bin\SourceCodePro-Bold.ttf"
File "..\bin\SourceCodePro-It.ttf"
File "..\bin\SourceCodePro-BoldIt.ttf"
; Set Section Files and Shortcuts
SetOverwrite on
@ -1947,7 +1950,6 @@ Section Uninstall
Delete "$INSTDIR\notepad++.exe"
Delete "$INSTDIR\readme.txt"
Delete "$INSTDIR\config.xml"
Delete "$INSTDIR\config.model.xml"
Delete "$INSTDIR\langs.xml"
@ -1961,7 +1963,10 @@ Section Uninstall
Delete "$INSTDIR\nativeLang.xml"
Delete "$INSTDIR\session.xml"
Delete "$INSTDIR\localization\english.xml"
Delete "$INSTDIR\SourceCodePro-Regular.otf"
Delete "$INSTDIR\SourceCodePro-Regular.ttf"
Delete "$INSTDIR\SourceCodePro-Bold.ttf"
Delete "$INSTDIR\SourceCodePro-It.ttf"
Delete "$INSTDIR\SourceCodePro-BoldIt.ttf"
SetShellVarContext current
Delete "$APPDATA\Notepad++\langs.xml"

View File

@ -47,7 +47,13 @@ copy /Y ..\bin\"notepad++.exe" .\minimalist\
If ErrorLevel 1 PAUSE
copy /Y ..\bin\SciLexer.dll .\minimalist\
If ErrorLevel 1 PAUSE
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-Regular.otf .\minimalist\
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-Regular.ttf .\minimalist\
If ErrorLevel 1 PAUSE
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-Bold.ttf .\minimalist\
If ErrorLevel 1 PAUSE
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-It.ttf .\minimalist\
If ErrorLevel 1 PAUSE
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-BoldIt.ttf .\minimalist\
If ErrorLevel 1 PAUSE
@ -89,7 +95,13 @@ copy /Y ..\bin\"notepad++.exe" .\zipped.package.release\
If ErrorLevel 1 PAUSE
copy /Y ..\bin\SciLexer.dll .\zipped.package.release\
If ErrorLevel 1 PAUSE
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-Regular.otf .\zipped.package.release\
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-Regular.ttf .\zipped.package.release\
If ErrorLevel 1 PAUSE
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-Bold.ttf .\zipped.package.release\
If ErrorLevel 1 PAUSE
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-It.ttf .\zipped.package.release\
If ErrorLevel 1 PAUSE
copy /Y ..\src\fonts\sourceCodePro\SourceCodePro-BoldIt.ttf .\zipped.package.release\
If ErrorLevel 1 PAUSE
rem Plugins

View File

@ -56,7 +56,10 @@ enum tb_stat {tb_saved, tb_unsaved, tb_ro};
#define NPP_INTERNAL_FUCTION_STR TEXT("Notepad++::InternalFunction")
#define SOURCECODEPRO_FONT TEXT("SourceCodePro-Regular.otf")
#define SOURCECODEPRO_FONT TEXT("SourceCodePro-Regular.ttf")
#define SOURCECODEPRO_I_FONT TEXT("SourceCodePro-It.ttf")
#define SOURCECODEPRO_B_FONT TEXT("SourceCodePro-Bold.ttf")
#define SOURCECODEPRO_IB_FONT TEXT("SourceCodePro-BoldIt.ttf")
int docTabIconIDs[] = {IDI_SAVED_ICON, IDI_UNSAVED_ICON, IDI_READONLY_ICON};
@ -123,11 +126,6 @@ ToolBarButtonUnit toolBarIcons[] = {
{IDM_MACRO_SAVECURRENTMACRO, IDI_SAVERECORD_OFF_ICON, IDI_SAVERECORD_ON_ICON, IDI_SAVERECORD_DISABLE_ICON, IDR_SAVERECORD}
};
Notepad_plus::Notepad_plus(): _mainWindowStatus(0), _pDocTab(NULL), _pEditView(NULL),
_pMainSplitter(NULL),
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _pFileSwitcherPanel(NULL),
@ -180,7 +178,6 @@ Notepad_plus::Notepad_plus(): _mainWindowStatus(0), _pDocTab(NULL), _pEditView(N
_isAdministrator = is_admin ? true : false;
}
Notepad_plus::~Notepad_plus()
{
// ATTENTION : the order of the destruction is very important
@ -201,19 +198,22 @@ Notepad_plus::~Notepad_plus()
delete _pProjectPanel_3;
delete _pDocMap;
delete _pFuncList;
::RemoveFontResource(SOURCECODEPRO_FONT);
::RemoveFontResourceEx(SOURCECODEPRO_FONT, FR_PRIVATE, 0);
::RemoveFontResourceEx(SOURCECODEPRO_I_FONT, FR_PRIVATE, 0);
::RemoveFontResourceEx(SOURCECODEPRO_B_FONT, FR_PRIVATE, 0);
::RemoveFontResourceEx(SOURCECODEPRO_IB_FONT, FR_PRIVATE, 0);
}
LRESULT Notepad_plus::init(HWND hwnd)
{
NppParameters *pNppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
// Add Main font
::AddFontResource(SOURCECODEPRO_FONT);
::AddFontResourceEx(SOURCECODEPRO_FONT, FR_PRIVATE, 0);
::AddFontResourceEx(SOURCECODEPRO_I_FONT, FR_PRIVATE, 0);
::AddFontResourceEx(SOURCECODEPRO_B_FONT, FR_PRIVATE, 0);
::AddFontResourceEx(SOURCECODEPRO_IB_FONT, FR_PRIVATE, 0);
// Menu
_mainMenuHandle = ::GetMenu(hwnd);
@ -713,8 +713,6 @@ LRESULT Notepad_plus::init(HWND hwnd)
return TRUE;
}
void Notepad_plus::killAllChildren()
{
_toolBar.destroy();

View File

@ -204,7 +204,10 @@ copy ..\src\stylers.model.xml ..\bin\stylers.model.xml
copy ..\src\shortcuts.xml ..\bin\shortcuts.xml
copy ..\src\functionList.xml ..\bin\functionList.xml
copy ..\src\contextMenu.xml ..\bin\contextMenu.xml
copy ..\src\fonts\sourceCodePro\SourceCodePro-Regular.otf ..\bin\SourceCodePro-Regular.otf
copy ..\src\fonts\sourceCodePro\SourceCodePro-Regular.ttf ..\bin\SourceCodePro-Regular.ttf
copy ..\src\fonts\sourceCodePro\SourceCodePro-Bold.ttf ..\bin\SourceCodePro-Bold.ttf
copy ..\src\fonts\sourceCodePro\SourceCodePro-It.ttf ..\bin\SourceCodePro-It.ttf
copy ..\src\fonts\sourceCodePro\SourceCodePro-BoldIt.ttf ..\bin\SourceCodePro-BoldIt.ttf
..\misc\vistaIconTool\changeIcon.bat "..\misc\vistaIconTool\ChangeIcon.exe" "$(OutDir)notepad++.exe"
</Command>
</PostBuildEvent>