Skip to content

Commit

Permalink
Merge pull request sakura-editor#645 from berryzplus/feature/dpi_font…
Browse files Browse the repository at this point in the history
…_label

フォントラベルのHighDPI対応
  • Loading branch information
berryzplus authored Nov 25, 2018
2 parents 8dfaad2 + 13f0991 commit 589ca90
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions sakura_core/prop/CPropCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "env/CDocTypeManager.h"
#include "CEditApp.h"
#include "util/shell.h"
#include "util/window.h"
#include "sakura_rc.h"

int CPropCommon::SearchIntArr( int nKey, int* pnArr, int nArrNum )
Expand Down Expand Up @@ -495,9 +496,11 @@ HFONT CPropCommon::SetFontLabel( HWND hwndDlg, int idc_static, const LOGFONT& lf
TCHAR szFontName[80];
LOGFONT lfTemp;
lfTemp = lf;

// 大きすぎるフォントは小さく表示
if( lfTemp.lfHeight < -16 ){
lfTemp.lfHeight = -16;
LONG limitSize = ::DpiPointsToPixels( 16 );
if ( lfTemp.lfHeight < -limitSize ) {
lfTemp.lfHeight = -limitSize;
}

hFont = SetCtrlFont( hwndDlg, idc_static, lfTemp );
Expand Down
7 changes: 5 additions & 2 deletions sakura_core/typeprop/CPropTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "CEditApp.h"
#include "view/colors/EColorIndexType.h"
#include "util/shell.h"
#include "util/window.h"
#include "sakura_rc.h"


Expand Down Expand Up @@ -282,9 +283,11 @@ HFONT CPropTypes::SetFontLabel( HWND hwndDlg, int idc_static, const LOGFONT& lf,
TCHAR szFontName[80];
LOGFONT lfTemp;
lfTemp = lf;

// 大きすぎるフォントは小さく表示
if( lfTemp.lfHeight < -16 ){
lfTemp.lfHeight = -16;
LONG limitSize = ::DpiPointsToPixels( 16 );
if ( lfTemp.lfHeight < -limitSize ) {
lfTemp.lfHeight = -limitSize;
}

if (bUse) {
Expand Down

0 comments on commit 589ca90

Please sign in to comment.