From c4a7fa659ed2ddb439d4a1b309fdfe0734def6d8 Mon Sep 17 00:00:00 2001 From: Katsuhisa Yuasa Date: Mon, 28 Sep 2020 03:28:42 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88=E5=B9=85?= =?UTF-8?q?=E8=A8=88=E7=AE=97=E3=81=AB=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8B?= =?UTF-8?q?=E6=96=87=E5=AD=97=E9=96=93=E9=9A=94=E9=85=8D=E5=88=97=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=86=E3=83=8A=E3=82=92=E4=BD=BF=E3=81=84?= =?UTF-8?q?=E3=81=BE=E3=82=8F=E3=81=99=E4=BA=8B=E3=81=A7=E8=B2=A0=E8=8D=B7?= =?UTF-8?q?=E3=82=92=E5=89=8A=E6=B8=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/print/CPrintPreview.cpp | 5 +++-- sakura_core/view/CTextMetrics.cpp | 9 ++++----- sakura_core/view/CTextMetrics.h | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sakura_core/print/CPrintPreview.cpp b/sakura_core/print/CPrintPreview.cpp index 826c322f50..71bacf9585 100644 --- a/sakura_core/print/CPrintPreview.cpp +++ b/sakura_core/print/CPrintPreview.cpp @@ -1347,7 +1347,8 @@ void CPrintPreview::DrawHeaderFooter( HDC hdc, const CMyRect& rect, bool bHeader bHeader ? m_pPrintSetting->m_szHeaderForm[POS_CENTER] : m_pPrintSetting->m_szFooterForm[POS_CENTER], szWork, nWorkLen); nLen = wcslen( szWork ); - nTextWidth = CTextMetrics::CalcTextWidth2(szWork, nLen, nDx, spaceing); //テキスト幅 + std::vector vDxArray; + nTextWidth = CTextMetrics::CalcTextWidth2(szWork, nLen, nDx, spaceing, vDxArray); //テキスト幅 Print_DrawLine( hdc, CMyPoint( @@ -1366,7 +1367,7 @@ void CPrintPreview::DrawHeaderFooter( HDC hdc, const CMyRect& rect, bool bHeader bHeader ? m_pPrintSetting->m_szHeaderForm[POS_RIGHT] : m_pPrintSetting->m_szFooterForm[POS_RIGHT], szWork, nWorkLen); nLen = wcslen( szWork ); - nTextWidth = CTextMetrics::CalcTextWidth2(szWork, nLen, nDx, spaceing); //テキスト幅 + nTextWidth = CTextMetrics::CalcTextWidth2(szWork, nLen, nDx, spaceing, vDxArray); //テキスト幅 Print_DrawLine( hdc, CMyPoint( diff --git a/sakura_core/view/CTextMetrics.cpp b/sakura_core/view/CTextMetrics.cpp index d96fbb21a7..70dec7cb39 100644 --- a/sakura_core/view/CTextMetrics.cpp +++ b/sakura_core/view/CTextMetrics.cpp @@ -237,11 +237,10 @@ int CTextMetrics::CalcTextWidth2( const wchar_t* pText, //!< 文字列 int nLength, //!< 文字列長 int nHankakuDx, //!< 半角文字の文字間隔 - int nCharSpacing //!< 文字の隙間 + int nCharSpacing, //!< 文字の隙間 + std::vector& vDxArray //!< [out] 文字間隔配列 ) { - //文字間隔配列を生成 - vector vDxArray; const int* pDxArray = CTextMetrics::GenerateDxArray( &vDxArray, pText, @@ -258,8 +257,8 @@ int CTextMetrics::CalcTextWidth2( int CTextMetrics::CalcTextWidth3( const wchar_t* pText, //!< 文字列 - int nLength //!< 文字列長 + int nLength //!< 文字列長 ) const { - return CalcTextWidth2(pText, nLength, GetCharPxWidth(), GetCharSpacing()); + return CalcTextWidth2(pText, nLength, GetCharPxWidth(), GetCharSpacing(), m_vDxArray); } diff --git a/sakura_core/view/CTextMetrics.h b/sakura_core/view/CTextMetrics.h index a986aca376..3f9e4386ce 100644 --- a/sakura_core/view/CTextMetrics.h +++ b/sakura_core/view/CTextMetrics.h @@ -112,7 +112,8 @@ class CTextMetrics{ const wchar_t* pText, //!< 文字列 int nLength, //!< 文字列長 int nHankakuDx, //!< 半角文字の文字間隔 - int nCharSpacing + int nCharSpacing, //!< 文字の隙間 + std::vector& vDxArray //!< [out] 文字間隔配列 ); int CalcTextWidth3( @@ -129,5 +130,6 @@ class CTextMetrics{ int m_anHankakuDx[64]; //!< 半角用文字間隔配列 int m_anZenkakuDx[64]; //!< 全角用文字間隔配列 std::vector m_aFontHeightMargin; + mutable std::vector m_vDxArray; //!< 文字間隔配列 }; #endif /* SAKURA_CTEXTMETRICS_7972A864_FDFF_4852_9EA5_A91D39657A7F_H_ */