EgtGeomKernel 1.5f2 :
- aggiunta gestione testi multilinea - migliorie e correzioni varie sui testi.
This commit is contained in:
+27
-19
@@ -25,7 +25,7 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::Init( const std::string& sNfeFontDir, const std::string& sDefaultFont)
|
||||
FontManager::Init( const string& sNfeFontDir, const string& sDefaultFont)
|
||||
{
|
||||
// assegno direttorio file per font Nfe
|
||||
m_sNfeFontDir = sNfeFontDir ;
|
||||
@@ -37,22 +37,30 @@ FontManager::Init( const std::string& sNfeFontDir, const std::string& sDefaultFo
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::SetCurrFont( const std::string& sFont, int nWeight, bool bItalic,
|
||||
FontManager::SetCurrFont( const string& sFont, int nWeight, bool bItalic,
|
||||
double dHeight, double dRatio, double dAddAdvance)
|
||||
{
|
||||
// gestione font di default
|
||||
string sTFont = (( sFont.empty()) ? m_sDefaultFont : sFont) ;
|
||||
string sFontName = (( sFont.empty()) ? m_sDefaultFont : sFont) ;
|
||||
|
||||
// lo cerco tra i font Nfe
|
||||
if ( FileExtensionMatches( sTFont, "NFE")) {
|
||||
if ( FileExtensionMatches( sFontName, "NFE")) {
|
||||
// verifico che il font richiesto esista, altrimenti prendo il primo dello stesso tipo
|
||||
string sPath = m_sNfeFontDir + "\\" + sFontName ;
|
||||
if ( ! ExistsFile( sPath)) {
|
||||
if ( FindFirstFileEgt( m_sNfeFontDir + "\\*.Nfe", sFontName))
|
||||
sPath = m_sNfeFontDir + "\\" + sFontName ;
|
||||
}
|
||||
// imposto il font corrente
|
||||
m_bCurrNfeFont = true ;
|
||||
if ( ! m_NfeFont.SetCurrFont( m_sNfeFontDir + "\\" + sTFont, nWeight, bItalic,
|
||||
dHeight, dRatio, dAddAdvance))
|
||||
if ( ! m_NfeFont.SetCurrFont( sPath, nWeight, bItalic, dHeight, dRatio, dAddAdvance))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// altrimenti lo cerco tra i font di sistema
|
||||
else {
|
||||
m_bCurrNfeFont = false ;
|
||||
if ( ! m_OsFont.SetCurrFont( sTFont, nWeight, bItalic, dHeight, dRatio, dAddAdvance))
|
||||
if ( ! m_OsFont.SetCurrFont( sFontName, nWeight, bItalic, dHeight, dRatio, dAddAdvance))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -91,40 +99,40 @@ FontManager::GetDescent( double& dDesc)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetLength( const string& sText, double& dLen)
|
||||
FontManager::GetCapBox( const string& sText, int nInsPos, BBox3d& b3Box)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetLength( sText, dLen) ;
|
||||
return m_NfeFont.GetXBox( sText, nInsPos, true, b3Box) ;
|
||||
else
|
||||
return m_OsFont.GetLength( sText, dLen) ;
|
||||
return m_OsFont.GetXBox( sText, nInsPos, true, b3Box) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetBBox( const string& sText, BBox3d& b3Box)
|
||||
FontManager::GetBBox( const string& sText, int nInsPos, BBox3d& b3Box)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetBBox( sText, b3Box) ;
|
||||
return m_NfeFont.GetXBox( sText, nInsPos, false, b3Box) ;
|
||||
else
|
||||
return m_OsFont.GetBBox( sText, b3Box) ;
|
||||
return m_OsFont.GetXBox( sText, nInsPos, false, b3Box) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::GetOutline( const string& sText, ICURVEPLIST& lstPC)
|
||||
FontManager::GetOutline( const string& sText, int nInsPos, ICURVEPLIST& lstPC)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.GetOutline( sText, lstPC) ;
|
||||
return m_NfeFont.GetOutline( sText, nInsPos, lstPC) ;
|
||||
else
|
||||
return m_OsFont.GetOutline( sText, lstPC) ;
|
||||
return m_OsFont.GetOutline( sText, nInsPos, lstPC) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FontManager::ApproxWithLines( const string& sText, double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL)
|
||||
FontManager::ApproxWithLines( const string& sText, int nInsPos, double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL)
|
||||
{
|
||||
if ( m_bCurrNfeFont)
|
||||
return m_NfeFont.ApproxWithLines( sText, dLinTol, dAngTolDeg, lstPL) ;
|
||||
return m_NfeFont.ApproxWithLines( sText, nInsPos, dLinTol, dAngTolDeg, lstPL) ;
|
||||
else
|
||||
return m_OsFont.ApproxWithLines( sText, dLinTol, dAngTolDeg, lstPL) ;
|
||||
return m_OsFont.ApproxWithLines( sText, nInsPos, dLinTol, dAngTolDeg, lstPL) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user